|
Development Forum |
 |
|

HavenHerbaven
   
|
11/26/2013 | |
Okay so I used some of Malkin's tweaks on my previous help thing. Here is the code: inst
new: simp 2 23 14882 "hot_puddings" 1 12 3000
bhvr 11
attr 198
perm 60
elas 15
fric 50
accg 7
aero 5
doif tmvt 5000 3400 = 1
mvto 5000 3400
else
mvsf 5000 3400
else
mvsf rand 748 1550 9547
endi
tick 16
**Vendor Push
scrp 2 23 14882 1
stim writ from 90 1
rnge 300
setv va66 0
esee 2 11 14882
addv va66 1
next
doif va66 le 4
setv va00 posl
addv va00 30
setv va01 post
addv va01 10
*now we are making the food.
inst
setv va60 rand 0 3
mulv va60 4
new: simp 2 11 14882 "hot_puddings" 4 va60 4900
attr 195
bhvr 48
elas 30
fric 50
accg 3
doif tmvt va00 va01 = 1
mvto va00 va01
else
mvsf va00 va01
endi
velo rand -10 10 rand -15 -20
tick 8
emit 8 0.35
endi
endm
**Vendor Timer Script
scrp 2 23 14882 9
doif carr = null
lock
rnge 300
esee 2 11 14882
addv va00 1
next
doif va00 le 4
setv va00 posl
addv va00 30
setv va01 post
addv va01 10
inst
setv va60 rand 0 10
mulv va60 11
new: simp 2 11 14882 "hot_puddings" 2 va60 4900
attr 195
bhvr 48
elas 30
fric 50
accg 3
doif tmvt va00 va01 = 1
mvto va00 va01
else
mvsf va00 va01
endi
**Food timer script
scrp 2 11 14882 9
plne 5001
tick 0
endm
*****Food eat script
scrp 2 11 14882 12
lock
sndc "chwp"
stim writ from 79 1
pose 1
wait 20
kill ownr
endm
**Pudding Collision Script
scrp 2 11 14882 6
doif wall = down
snde "dr10"
endi
endm
**Remove script
rscr
enum 2 23 14882
kill targ
next
enum 2 11 14882
kill targ
next
scrx 2 23 14882 1
scrx 2 23 14882 2
scrx 2 23 14882 3
scrx 2 23 14882 9
scrx 2 11 14882 9
scrx 2 11 14882 12
scrx 2 11 14882 6
|
And the pray: group AGNT "Hot Puddings (C3)"
"Agent Type" 0
"Agent Animation File" "hot_puddings.c16"
"Agent Animation Gallery" "hot_puddings"
"Agent Animation String" "0"
"Remove script" "enum 2 23 14882 kill targ next enum 2 11 14882 kill targ next scrx 2 23 14882 1 scrx 2 23 14882 2 scrx 2 23 14882 3 scrx 2 23 14882 9 scrx 2 11 14882 9 scrx 2 11 14882 12 scrx 2 11 14882 6"
"Script Count" 1
"Script 1" @ "Hot Pudding vendor.cos"
"Dependency Count" 5
"Dependency 1" "hot_puddings.c16"
"Dependency Category 1" 2
"Dependency 2" "chwp.wav"
"Dependency Category 2" 1
"Dependency 3" "hit_.wav"
"Dependency Category 3" 1
"Dependency 4" "dr10.wav"
"Dependency Category 4" 1
"Dependency 5" "hot pudding.catalogue"
"Dependency Category 5" 7
group DSAG "Hot Puddings (DS)"
"Agent Type" 0
"Agent Description" "These puddings will surely fill any grumbling creature's belly"
"Web Label" "Creatures Caves"
"Web URL" "www.creaturescaves.com"
"Agent Animation File" "hot_puddings.c16"
"Agent Animation Gallery" "hot_puddings"
"Agent Animation String" "0"
"Agent Sprite First Image" 0
"Remove script" "enum 2 23 14882 kill targ next enum 2 11 14882 kill targ next scrx 2 23 14882 1 scrx 2 23 14882 2 scrx 2 23 14882 3 scrx 2 23 14882 9 scrx 2 11 14882 9 scrx 2 11 14882 12 scrx 2 11 14882 6"
"Script Count" 1
"Script 1" @ "Hot Pudding vendor.cos"
"Dependency Count" 5
"Dependency 1" "hot_puddings.c16"
"Dependency Category 1" 2
"Dependency 2" "chwp.wav"
"Dependency Category 2" 1
"Dependency 3" "hit_.wav"
"Dependency Category 3" 1
"Dependency 4" "dr10.wav"
"Dependency Category 4" 1
"Dependency 5" "hot pudding.catalogue"
"Dependency Category 5" 7
inline FILE "hot_puddings.c16" "hot_puddings.c16"
inline FILE "hot pudding.catalogue" "hot pudding.catalogue" |
I also got this Error Sorry the injection of this agent failed. Please contact the author for further assistance.
Script 12 23 14882 9
Invalid command at token "scrp"
...mvsf va00 va01 endi @ scrp 2 11 14882 9 plne 5001 ti ...
Herb
|

Malkin
     Manager

|
11/26/2013 | |
The problem here is the vendor's timer script - each script needs to close with the command ENDM. 
Try the following:
**Vendor Timer Script
scrp 2 23 14882 9
*check if you're being carried
doif carr = null
lock
*set a field of view
rnge 300
*see how many puddings you can see
esee 2 11 14882
addv va00 1
next
*if it's less than 4
doif va00 le 4
*set the position to vend
setv va00 posl
addv va00 30
setv va01 post
addv va01 10
*now let's vend some food
inst
*randomise the food from 3 choices (each with 4 pictures
setv va60 rand 0 3
mulv va60 4
*make the food
new: simp 2 11 14882 "hot_puddings" 4 va60 4900
attr 195
bhvr 48
elas 30
fric 50
accg 3
*move it safely
doif tmvt va00 va01 = 1
mvto va00 va01
else
mvsf va00 va01
endi
*give it some velocity
velo rand -10 10 rand -15 -20
*start the food timer
tick 8
*make it smell
emit 8 0.35
*close the 'if there are less than 4 doif'
endi
*close the 'if I'm not being carried doif'
endi
*end the script
endm |
My TCR Norns |

HavenHerbaven
   
|
11/26/2013 | |
Okay it no longer complains about that but it says Script 1Tried to set BHVR 11 when the agent doesn't have one of the appropriate scrips ... puddings" 1 12 3000 @ bhvr 11 attr 198 perm 60. Any Ideas?
Herb
|

Malkin
     Manager

|
11/26/2013 | 1 |
You need to add in a pull script and a hit script.
The pull script is exactly like your push script, except the script number is 2, not 1.
**Vendor Pull
scrp 2 23 14882 2
stim writ from 90 1
rnge 300
setv va66 0
esee 2 11 14882
addv va66 1
next
doif va66 le 4
setv va00 posl
addv va00 30
setv va01 post
addv va01 10
*now we are making the food.
inst
setv va60 rand 0 3
mulv va60 4
new: simp 2 11 14882 "hot_puddings" 4 va60 4900
attr 195
bhvr 48
elas 30
fric 50
accg 3
doif tmvt va00 va01 = 1
mvto va00 va01
else
mvsf va00 va01
endi
velo rand -10 10 rand -15 -20
tick 8
emit 8 0.35
endi
endm
|
The hit script, from your first draft, is perfect.
**Vendor Hit Script
scrp 2 23 14882 3
sndc "hit_"
velo 0 rand -20 -30
stim writ from 92 1
endm |
I mean, you could change the bhvr so that creatures are only allowed to push the agent, but it's more fun if they're more interactive. 
My TCR Norns |

Malkin
     Manager

|
11/27/2013 | |
I noticed a problem with your spritesheet, before we go any further - because this is for C3/DS, each of your puddings, no matter if it's full, half-eaten or empty needs to be on the same sized background, or it will crash when it's eaten.
As for the code side of things, because each pudding only has 3 pictures, not 4, each instance of the pudding installation code needs to be changed from
setv va60 rand 0 3
mulv va60 4
new: simp 2 11 14882 "hot_puddings" 4 va60 4900 |
to
setv va60 rand 0 3
mulv va60 3
new: simp 2 11 14882 "hot_puddings" 3 va60 4900 |
in the push script, the pull script and the timer script. 
My TCR Norns |

HavenHerbaven
   
|
12/12/2013 | |
Okay, I did that but it's still vending vendors half eaten the bowl and the full, and it keeps having a white square around them. :c
Herb
|

Malkin
     Manager

|
12/12/2013 | |
Could you please repost your entire code so far?
My TCR Norns |

HavenHerbaven
   
|
12/12/2013 | |
Yeah sure, COS code inst
new: simp 2 23 14882 "hot_puddings" 1 12 3000
bhvr 11
attr 198
perm 60
elas 15
fric 50
accg 7
aero 5
doif tmvt 6112 9155 = 1
mvto 6112 9155
else
mvsf 6112 9155
else
mvsf rand 748 1550 9547
endi
tick 16
endm
**Vendor Push
scrp 2 23 14882 1
stim writ from 90 1
rnge 300
setv va66 0
esee 2 11 14882
addv va66 1
next
doif va66 le 4
setv va00 posl
addv va00 30
setv va01 post
addv va01 10
*now we are making the food.
inst
setv va60 rand 0 3
mulv va60 4
new: simp 2 11 14882 "hot_puddings" 3 va60 4900
attr 195
bhvr 48
elas 30
fric 50
accg 3
doif tmvt va00 va01 = 1
mvto va00 va01
else
mvsf va00 va01
endi
velo rand -10 10 rand -15 -20
tick 8
emit 8 0.35
endi
endm
*Vendor Pull
scrp 2 23 14882 2
stim writ from 90 1
rnge 300
setv va66 0
esee 2 11 14882
addv va66 1
next
doif va66 le 4
setv va00 posl
addv va00 30
setv va01 post
addv va01 10
*now we are making the food.
inst
setv va60 rand 0 3
mulv va60 3
new: simp 2 11 14882 "hot_puddings" 3 va60 4900
attr 195
bhvr 48
elas 30
fric 50
accg 3
doif tmvt va00 va01 = 1
mvto va00 va01
else
mvsf va00 va01
endi
velo rand -10 10 rand -15 -20
tick 8
emit 8 0.35
endi
endm
**Vendor Hit Script
scrp 2 23 14882 3
sndc "hit_"
velo 0 rand -20 -30
stim writ from 92 1
endm
**Vendor Timer Script
scrp 2 23 14882 9
*check if you're being carried
doif carr = null
lock
*set a field of view
rnge 300
*see how many puddings you can see
esee 2 11 14882
addv va00 1
next
*if it's less than 4
doif va00 le 4
*set the position to vend
setv va00 posl
addv va00 30
setv va01 post
addv va01 10
*now let's vend some food
inst
*randomise the food from 3 choices (each with 3 pictures
setv va60 rand 0 3
mulv va60 3
*make the food
new: simp 2 11 14882 "hot_puddings" 3 va60 4900
attr 195
bhvr 48
elas 30
fric 50
accg 3
*move it safely
doif tmvt va00 va01 = 1
mvto va00 va01
else
mvsf va00 va01
endi
*give it some velocity
velo rand -10 10 rand -15 -20
*start the food timer
tick 8
*make it smell
emit 8 0.35
*close the 'if there are less than 4 doif'
endi
*close the 'if I'm not being carried doif'
endi
*end the script
endm
**Food timer script
scrp 2 11 14882 9
plne 5001
tick 0
endm
*****Food eat script
scrp 2 11 14882 12
lock
sndc "chwp"
stim writ from 79 1
pose 1
wait 20
kill ownr
endm
**Pudding Collision Script
scrp 2 11 14882 6
doif wall = down
snde "dr10"
endi
endm
**Remove script
rscr
enum 2 23 14882
kill targ
next
enum 2 11 14882
kill targ
next
scrx 2 23 14882 1
scrx 2 23 14882 2
scrx 2 23 14882 3
scrx 2 23 14882 9
scrx 2 11 14882 9
scrx 2 11 14882 12
scrx 2 11 14882 6
|
And PRAY code.
group AGNT "Hot Puddings (C3)"
"Agent Type" 0
"Agent Animation File" "hot_puddings.c16"
"Agent Animation Gallery" "hot_puddings"
"Agent Animation String" "0"
"Remove script" "enum 2 23 14882 kill targ next enum 2 11 14882 kill targ next scrx 2 23 14882 1 scrx 2 23 14882 2 scrx 2 23 14882 3 scrx 2 23 14882 9 scrx 2 11 14882 9 scrx 2 11 14882 12 scrx 2 11 14882 6"
"Script Count" 1
"Script 1" @ "Hot Pudding vendor.cos"
"Dependency Count" 5
"Dependency 1" "hot_puddings.c16"
"Dependency Category 1" 2
"Dependency 2" "chwp.wav"
"Dependency Category 2" 1
"Dependency 3" "hit_.wav"
"Dependency Category 3" 1
"Dependency 4" "dr10.wav"
"Dependency Category 4" 1
"Dependency 5" "hot pudding.catalogue"
"Dependency Category 5" 7
group DSAG "Hot Puddings (DS)"
"Agent Type" 0
"Agent Description" "These puddings will surely fill any grumbling creature's belly"
"Web Label" "Creatures Caves"
"Web URL" "www.creaturescaves.com"
"Agent Animation File" "hot_puddings.c16"
"Agent Animation Gallery" "hot_puddings"
"Agent Animation String" "0"
"Agent Sprite First Image" 0
"Remove script" "enum 2 23 14882 kill targ next enum 2 11 14882 kill targ next scrx 2 23 14882 1 scrx 2 23 14882 2 scrx 2 23 14882 3 scrx 2 23 14882 9 scrx 2 11 14882 9 scrx 2 11 14882 12 scrx 2 11 14882 6"
"Script Count" 1
"Script 1" @ "Hot Pudding vendor.cos"
"Dependency Count" 5
"Dependency 1" "hot_puddings.c16"
"Dependency Category 1" 2
"Dependency 2" "chwp.wav"
"Dependency Category 2" 1
"Dependency 3" "hit_.wav"
"Dependency Category 3" 1
"Dependency 4" "dr10.wav"
"Dependency Category 4" 1
"Dependency 5" "hot pudding.catalogue"
"Dependency Category 5" 7
inline FILE "hot_puddings.c16" "hot_puddings.c16"
inline FILE "hot pudding.catalogue" "hot pudding.catalogue" |
Herb
|

Malkin
     Manager

|
12/12/2013 | |
Thanks! I think there's a problem in the push script still:
Instead of
*now we are making the food.
inst
setv va60 rand 0 3
mulv va60 4
new: simp 2 11 14882 "hot_puddings" 3 va60 4900 |
it needs to be
*now we are making the food.
inst
setv va60 rand 0 3
mulv va60 3
new: simp 2 11 14882 "hot_puddings" 3 va60 4900 |
As is in the randomisation tutorial, because we are first choosing, from 0 (banana), 1 (chocolate) 2 (strawberry) and 3 (lavender), and then we have to multiply that by the amount of sprites for that food type, to make sure that this doesn't happen.
You might also like to check out the multi-bite foods thread to see how you might alter the eat script to give 3 bites. 
My TCR Norns |

HavenHerbaven
   
|
12/30/2013 | |
Okay so I've come back to coding and I adjusted my script: inst
new: simp 2 23 14882 "hot_puddings" 1 12 3000
bhvr 11
attr 198
perm 60
elas 15
fric 50
accg 7
aero 5
doif tmvt 6112 9155 = 1
mvto 6112 9155
else
mvsf 6112 9155
else
mvsf rand 748 1550 9547
endi
tick 16
endm
**Vendor Push
scrp 2 23 14882 1
stim writ from 90 1
rnge 300
setv va66 0
esee 2 11 14882
addv va66 1
next
doif va66 le 4
setv va00 posl
addv va00 30
setv va01 post
addv va01 10
*now we are making the food.
inst
setv va60 rand 0 3
mulv va60 4
new: simp 2 11 14882 "hot_puddings" 3 va60 4900
attr 195
bhvr 48
elas 30
fric 50
accg 3
doif tmvt va00 va01 = 1
mvto va00 va01
else
mvsf va00 va01
endi
velo rand -10 10 rand -15 -20
tick 8
emit 8 0.35
endi
endm
*Vendor Pull
scrp 2 23 14882 2
stim writ from 90 1
rnge 300
setv va66 0
esee 2 11 14882
addv va66 1
next
doif va66 le 4
setv va00 posl
addv va00 30
setv va01 post
addv va01 10
*now we are making the food.
inst
setv va60 rand 0 3
mulv va60 3
new: simp 2 11 14882 "hot_puddings" 3 va60 4900
attr 195
bhvr 48
elas 30
fric 50
accg 3
doif tmvt va00 va01 = 1
mvto va00 va01
else
mvsf va00 va01
endi
velo rand -10 10 rand -15 -20
tick 8
emit 8 0.35
endi
endm
**Vendor Hit Script
scrp 2 23 14882 3
sndc "hit_"
velo 0 rand -20 -30
stim writ from 92 1
endm
**Vendor Timer Script
scrp 2 23 14882 9
*check if you're being carried
doif carr = null
lock
*set a field of view
rnge 300
*see how many puddings you can see
esee 2 11 14882
addv va00 1
next
*if it's less than 4
doif va00 le 4
*set the position to vend
setv va00 posl
addv va00 30
setv va01 post
addv va01 10
*now let's vend some food
inst
*randomise the food from 3 choices (each with 3 pictures
setv va60 rand 0 3
mulv va60 3
*make the food
new: simp 2 11 14882 "hot_puddings" 3 va60 4900
attr 195
bhvr 48
elas 30
fric 50
accg 3
*move it safely
doif tmvt va00 va01 = 1
mvto va00 va01
else
mvsf va00 va01
endi
*give it some velocity
velo rand -10 10 rand -15 -20
*start the food timer
tick 8
*make it smell
emit 8 0.35
*close the 'if there are less than 4 doif'
endi
*close the 'if I'm not being carried doif'
endi
*end the script
endm
**Food timer script
scrp 2 11 14882 9
plne 5001
tick 0
endm
*****Food eat script
scrp 2 11 14882 12
lock
sndc "chwp"
stim writ from 79 1
pose 1
wait 20
kill ownr
endm
**Pudding Collision Script
scrp 2 11 14882 6
doif wall = down
snde "dr10"
endi
endm
**Remove script
rscr
enum 2 23 14882
kill targ
next
enum 2 11 14882
kill targ
next
scrx 2 23 14882 1
scrx 2 23 14882 2
scrx 2 23 14882 3
scrx 2 23 14882 9
scrx 2 11 14882 9
scrx 2 11 14882 12
scrx 2 11 14882 6
| I have done lots of testing on my code and colored the background black but it still shows up white and vends everything that I have in my sprite file. Any suggestions?
Herb
|
 Prodigal Sock
Ghosthande
    

|
12/30/2013 | |
If you aren't seeing any changes in the sprites, it's probably because the game is using the old version still. (Happens to me all the time.) Testing in a new world might help.
 |

HavenHerbaven
   
|
12/30/2013 | |
Okay I'll try that thanks. 
Herb
|
 Tea Queen
Laura
    

|
12/31/2013 | |
Also, make sure your new version of 'hot_puddings.c16' exists in your Program Files\...\Docking Station\Images folder too. That's a common mistake I always seem to make! ![[nlaugh] [nlaugh]](/images/smilies/emot_laugh.gif) |

Malkin
     Manager

|
12/31/2013 | |
In the push script, instead of
*now we are making the food.
inst
setv va60 rand 0 3
mulv va60 4
new: simp 2 11 14882 "hot_puddings" 3 va60 4900 |
it needs to be
*now we are making the food.
inst
setv va60 rand 0 3
mulv va60 3
new: simp 2 11 14882 "hot_puddings" 3 va60 4900 |
That still needs fixing. 
My TCR Norns |