|
Development Forum |
 |
| 
HavenHerbaven
   
|
11/18/2013 | |
Okay so I have tried everything and I have been coding for about a week trying to get it right, but I can't seem to get it. So this is my COS and Pray file;
This is the COS file
inst
new: simp 2 11 14882 "hotpuddings* 2 0 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 10 1
stim writ from 90 1
rnge 300
setv va66 0
esee 2 23 14882
addv va66 1
next
doif va66 le 4
anim [45 45 45 45 45 45 45 45 45 45 45]
setv va00 posl
addv va00 30
setv va01 post
addv va01 10
inst
new: simp 2 23 14882 "hot_pudding_vendor" 2 44 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
lock
rnge 300
setv va66 0
esee 2 23 14882
addv va66 1
next
doif va66 le 4
anim [45 45 45 45 45 45 45 45 45 45 45]
setv va00 posl
addv va00 30
setv va 01
addv va01
inst
new: simp 2 23 14882 "hot_pudding_vendor" 2 44 4900
attr 195
bhvr 48
elas 30
fric 50
accg 3
doif tmvt va00 va01 = 1
mvto va00 va01 = 1
else
mvsf va00 va01
endi
velo rand -10 10 rand -15 -29
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
doif carr = null
lock
rnge 300
esee 2 23 14882
addv va00 1
next
doif va00 le 4
setv va00 posl
addv va00 30
setv va01 post
addv va01 10
inst
new: simp 2 23 14882 "hot_pudding_vendor" 2 44 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
endi
endm
**Food timer script
scrp 2 23 14882 9
plne 5001
tick 0
endm
*****Food eat script
new: simp 3 4 1 "pudding" 8 va60 0
setv va60 rand 0 10
mulv va60 11
scrp 2 23 14882 12
lock
sndc "chwp"
stim writ from 79 1
pose 1
wait 20
kill ownr
endm
**Pudding Collision Script
scrp 2 23 14882 6
doif wall = down
snde "dr10"
endi
endm
**Remove script
rscr
enum 2 23 14882
kill targ
next
enum 2 23 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 23 14882 9
scrx 2 23 14882 12
scrx 2 23 14882 6 |
And this is the PRAY file. 
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 X X XXXX kill targ next scrx X X XXXX 1 scrx X X XXXX 2"
"Script Count" 1
"Script 1" @ "Hot Pudding vendor.cos"
"Dependency Count" 3
"Dependency 1" "hot_puddings.c16"
"Dependency 2" "chwp.wav"
"Dependency Category 1" 2
"Dependency Category 3" 1
"Dependency 3" "hot pudding.catalogue"
"Dependency Category 2" 7
group DSAG "Hot Puddings (DS)"
"Agent Type" 0
"Agent Description" "These puddings will surly fill any grumbling creatures 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 X X XXXX kill targ next scrx X X XXXX 1 scrx X X XXXX 2"
"Script Count" 1
"Script 1" @ "Hot Pudding vendor.cos"
"Dependency Count" 3
"Dependency 1" "hot_puddings.c16"
"Dependency 2" "chwp.wav"
"Dependency Category 1" 2
"Dependency Category 3" 1
"Dependency 2" "hot pudding.catalogue"
"Dependency Category 2" 7
inline FILE "hot_puddings.c16" "hot_puddings.c16"
inline FILE "chwp.wav" "chwp.wav"
inline FILE "hot pudding.catalogue" "hot pudding.catalogue"
|
(I don't know why there is "chwp" ^_^')
Herb
|

Malkin
     Manager

|
11/19/2013 | |
What are all the sprite files called, and what bits do they contain? hotpuddings.c16 or hot_puddings.c16?
What classifier number are you using for the vendor, and what number are you using for the food?
new: simp 2 11 14882 "hotpuddings* 2 0 3000
should be
new: simp 2 11 14882 "hotpuddings" 2 0 3000
My TCR Norns |

HavenHerbaven
   
|
11/19/2013 | |
The sprite files are hot_puddings and they contain all my pudding things and a vendor.
and I don't think there is a classifier for the food in my script because I don't know the website for it.
Herb
|

Malkin
     Manager

|
11/19/2013 | |
What order are the puddings and the vendor in your c16? Is the vendor going to be a single image, or will it animate? How many different pudding types do you want?
The game uses the number '2 23' to show that the item is a vendor, and the number after that, the genus, comes from your classifier range. As we're installing the vendor first, the number needs to be 2 23 14882.
We'll need to change the 2 numbers after "hot_puddings" to tell the game which pictures to use in your sprite. 
inst
new: simp 2 23 14882 "hot_puddings" 2 0 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 |
All scripts that belong to the same item have to have the appropriate classifier - so the push script (script 1) starts off with 'scrp 2 23 14882 1'.
Now, we have to count the food items - so we use rnge and esee to let the vendor see the nearby food items that we're going to make (which have their own class number of 2 11 14882).
we're going to have to change the two numbers after 'hot_puddings' here:
new: simp 2 11 14882 "hot_puddings" 2 44 4900
to tell the agent what pictures it needs to use for the puddings. As you want to make a random pudding, you have to put the randomisation code in before you make the pudding. The 10 and 11 need to be changed to account for the amount of puddings you've got.
The anim isn't needed if the vendor isn't going to animate.
**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 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
velo rand -10 10 rand -15 -20
tick 8
emit 8 0.35
endi
endm |
Once we get the 'push' script perfect, all that needs to happen to turn that into a 'pull' script is copying it and changing the script number to 2. 
The hit script is fine. 
Again, because we're looking for the food item, we're going to use esee with 2 11 14882. 
Also, we still need to tweak the randomisation part of the script so that it will work with your sprite file.
**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
velo rand -10 10 rand -15 -20
tick 8
emit 8 0.35
endi
endi
endm |
For the food timer script to be for the food, it needs to have the proper class number:
**Food timer script
scrp 2 11 14882 9
plne 5001
tick 0
endm |
The proper classifier is needed here, and we dealt with the randomisation when we added the food to the world. 
*****Food eat script
scrp 2 11 14882 12
lock
sndc "chwp"
stim writ from 79 1
pose 1
wait 20
kill ownr
endm |
You need to make sure your scripts go to the proper item by using the classifier.
**Pudding Collision Script
scrp 2 11 14882 6
doif wall = down
snde "dr10"
endi
endm |
With this code, we count all the vendors (2 23 14882), then remove them, then count all the food (2 11 14882), and remove them. Then we remove their scripts.
**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 |
My TCR Norns |

Malkin
     Manager

|
11/19/2013 | |
Will you be including a catalogue file with your agent? (the 'agent help' that pops up) That will change your pray file. 
Some twiddling with the agent animation string may be needed once we know what picture will be showing up. 
The remove script has to be exactly the same as the one in your cos file - and remove all the vendors, all the food and all their scripts.
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" |
Now, the 'inline file' part is important, because that includes all the files that you're sending with your agent - like the graphics and the help file, and any new sound files you're going to make.
When you're compiling the agent in monk, you need to make sure that all of the files the game will need are in the same folder as the PRAY file and the cos file before you use monk to compile the agent. 
Please let me know how you get on - the code still needs some adjusting yet! 
My TCR Norns |

HavenHerbaven
   
|
11/20/2013 | |
Yes, I will be including a catalogue file. and I have all the puddings in alphabetical order they include the chomp sprites so like this: Banana whole first bite second bite third bite and so on and so forth. The vendor is at the end of the C16 file and is a single image.
Herb
|

Malkin
     Manager

|
11/20/2013 | |
That sounds great! So each pudding has 4 sprites (full, one-bite, two-bite, empty), and how many puddings will there be, 4? (strawberry, chocolate, lavender and banana)...
so instead of
setv va60 rand 0 10
mulv va60 11
new: simp 2 11 14882 "hot_puddings" 2 va60 4900 |
it will be
setv va60 rand 0 3
mulv va60 4
new: simp 2 11 14882 "hot_puddings" 4 va60 4900 |
Because there are 4 puddings (0-3)
which each have 4 sprites...
You are telling the food item to use 4 sprites, starting at va60. ("hot_puddings" 4 va60)
So if it picks 0, then 0*4 is 0, and it will be the banana pudding.
If it picks 1 then 1*4 is 4, and it will show the full chocolate pudding.
If it picks 2, then 2*4 is 8, and it will show the full lavender pudding.
If it picks 3, then 3*4 is 12, and it will show the full strawberry pudding.
What number is the vendor in the file?
My TCR Norns |

HavenHerbaven
   
|
11/20/2013 | |
vendor number is 12. 
Herb
|

Malkin
     Manager

|
11/20/2013 | |
Hmmm... I think I'm not quite understanding how your sprite file is set up....
instead of
| new: simp 2 23 14882 "hot_puddings" 2 0 3000 |
the installation code for the vendor itself should read:
| new: simp 2 23 14882 "hot_puddings" 1 12 3000 |
as you are using 1 image that is at position 12 in the file. 
My TCR Norns |
|