-
Notifications
You must be signed in to change notification settings - Fork 3
/
21830_cranberrystoneworthplanter_agent.cos
344 lines (304 loc) · 5.41 KB
/
21830_cranberrystoneworthplanter_agent.cos
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
**
** Cranberry Stoneworth planter script
**
** Sprites by Jesseth, coding by Pilla.
**
**
** Feel free to use this code however you want.
**
**
**
** Caos2pray chunk
**
** Compiles the agent.
**
* CAOS2PRAY CHUNK
*# Pray-File "gp_cranstone_planter_JESS.agents"
*# DS-Name "GP - Planter (CranStone)"
*# attach gp_cranstone_planter_JESS.c16 GrenP_Cranberrystoneworth.catalogue
*# desc = "A planter containing cranberry and stoneworth plants.by Jesseth"
*# Agent Animation File = "gp_cranstone_planter_JESS.c16"
*# Agent Sprite First Image = 0
*# Agent Animation Gallery = "gp_cranstone_planter_JESS"
*
*
*
** Injection script
**
**
** The planter
**
new: simp 1 1 21830 "gp_cranstone_planter_JESS" 1 0 rand 700 900
mesg wrt+ targ 1000 Game "CreatorX" Game "CreatorY" 0
**
** SCRIPTS
**
**
** PLANTER CREATOR SCRIPT
**
scrp 1 1 21830 1000
inst
new: comp 2 23 21830 "gp_cranstone_planter_JESS" 1 0 rand 700 900
** Attributes: mouseable 2 + activateable 4 + invisible 16 + collide 64 + physics 128 = 214
attr 214
perm 100
accg 0
elas 0
fric 100
aero 100
perm 100
bhvr 0
** The stoneworth spawning spots
pat: dull 3 "gp_cranstone_planter_JESS" 1 19 39 1
pat: dull 4 "gp_cranstone_planter_JESS" 1 31 32 1
pat: dull 5 "gp_cranstone_planter_JESS" 1 40 44 1
** The cranberry spawning spots
pat: dull 6 "gp_cranstone_planter_JESS" 6 3 29 1
pat: dull 7 "gp_cranstone_planter_JESS" 6 5 14 1
pat: dull 8 "gp_cranstone_planter_JESS" 6 12 17 1
tick 20
mvsf _p1_ _p2_
slow
targ ownr
kill targ
endm
**
** PLANTER PUSH SCRIPT
**
scrp 2 23 21830 1
mesg writ pntr 101
setv va05 posx
setv va06 posy
** Vend a cranberry
new: simp 2 8 21830 "gp_cranstone_planter_JESS" 1 10 rand 1800 1900
** attr: mouseable 2 + collide 64 + physics 128 = 194
attr 194
** Will go through some walls
perm 80
** Physics
accg 0.7
aero 1
fric 60
elas 40
** bhvr: pickup 16 + eat 32 = 48
bhvr 48
tick 1800
velo rand -1 1 -1
mvsf va05 va06
endm
**
** PLANTER TIMER SCRIPT
**
scrp 2 23 21830 9
doif carr eq null
tick rand 160 260
lock
** Grow the flowers and spawn the seed
setv va01 3
reps 6
part va01
** stoneworth subroutine
doif va01 lt 6
** pose ge 1 --> grow to next stage
doif pose ge 1 and pose lt 3
setv va10 pose
addv va10 1
pose va10
** pose eq 3 --> reset lobe and drop seed
elif pose eq 3
** Create and drop a new seed
gsub dropedible
** reset seed lobe
targ ownr
part va01
pose 0
endi
** cranberry subroutine
else
doif pose ge 1 and pose lt 3
setv va10 pose
addv va10 1
pose va10
elif pose eq 3
gsub dropedible
** reset seed lobe
targ ownr
part va01
pose 0
endi
endi
addv va01 1
targ ownr
repe
** Check how many seed lobes there are currently growing
setv va00 0
setv va01 3
reps 3
part va01
doif pose ne 0
addv va00 1
endi
addv va01 1
repe
** If there are less than 3 seed lobes growing, there may grow another one.
doif va00 lt 3 and rand 0 2 eq 0
** Make the first checking point random.
setv va01 3
addv va01 rand 0 2
setv va12 0
** If the first spot isn't free, try the next one.
reps 3
part va01
doif pose eq 0 and va12 eq 0
pose 1
addv va12 1
endi
addv va01 1
doif va01 gt 5
setv va01 3
endi
repe
endi
** Check how many cranberrys there are currently growing
setv va02 0
setv va03 6
reps 3
part va03
doif pose ne 0
addv va02 1
endi
addv va03 1
repe
** If there are less than 3 cranberrys growing, there may grow another one.
doif va00 lt 3 and rand 0 2 eq 0
setv va13 0
** Make the first checking point random.
setv va01 6
addv va01 rand 0 2
** If the first spot isn't free, try the next one.
reps 3
part va01
doif pose eq 0 and va13 eq 0
pose 1
addv va13 1
endi
addv va01 1
doif va01 gt 8
setv va01 6
endi
repe
endi
endi
subr dropedible
inst
setv va05 posl
setv va06 post
doif va01 lt 6
** stoneworth 3 4 5
doif va01 eq 3
addv va05 19
addv va06 39
elif va01 eq 4
addv va05 31
addv va06 32
elif va01 eq 5
addv va05 40
addv va06 44
endi
new: simp 2 3 21830 "gp_cranstone_planter_JESS" 1 5 rand 1200 1900
else
** cranberrys 6 7 8
doif va01 eq 6
addv va05 3
addv va06 29
elif va01 eq 7
addv va05 5
addv va06 14
elif va01 eq 8
addv va05 12
addv va06 17
endi
new: simp 2 8 21830 "gp_cranstone_planter_JESS" 1 10 rand 1200 1900
endi
** attr: mouseable 2 + collide 64 + physics 128 = 194
** bhvr: eat 16 + pickup 32 = 48
attr 194
bhvr 48
** Will go through some walls
perm 80
** Physics
accg 0.7
aero 1
fric 60
elas 40
tick rand 800 1400
velo rand -1 1 0
mvsf va05 va06
slow
retn
endm
**
** stoneworth SEED TIMER
**
**
** cranberry TIMER
**
**
** stoneworth SEED EAT
**
scrp 2 3 21830 12
lock
wait 10
** stim eat plant
stim writ from 77 1
wait 10
kill ownr
unlk
endm
**
** cranberry EAT
**
scrp 2 8 21830 12
lock
wait 10
** stim eat fruit
stim writ from 78 1
wait 10
kill ownr
unlk
endm
**
** stoneworth SEED TIMER
**
scrp 2 3 21830 9
doif carr eq null
kill ownr
endi
endm
**
** cranberry TIMER
**
scrp 2 8 21830 9
doif carr eq null
kill ownr
endi
endm
*
** Removal script
*
rscr
enum 2 23 21830
kill targ
next
enum 2 3 21830
kill targ
next
enum 2 8 21830
kill targ
next
scrx 2 23 21830 1
scrx 2 23 21830 9
scrx 2 3 21830 9
scrx 2 3 21830 12
scrx 2 8 21830 9
scrx 2 8 21830 12