-
Notifications
You must be signed in to change notification settings - Fork 3
/
21820_pickleweedplant.cos
504 lines (430 loc) · 7.86 KB
/
21820_pickleweedplant.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
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
**
** Pickleweed plant 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_pickleweed_plant_JESS.agents"
*# DS-Name "GP - Pickleweed Plant (Jesseth)"
*# attach gp_pickleweed_plant_JESS.c16
*# desc = "Some pretty pickleweed."
*# Agent Animation File = "gp_pickleweed_plant_JESS.c16"
*# Agent Sprite First Image = 20
*# Agent Animation Gallery = "gp_pickleweed_plant_JESS"
*
*
*
** Injection script
**
**
** The pickleweed mother
**
*new: comp 2 23 21820 "gp_pickleweed_plant_JESS" 1 0 rand 800 900
*mesg wrt+ targ 1000 game "CreatorX" game "CreatorY" 0
**
** SCRIPTS
**
**
**
**
** Creator
**
scrp 2 23 21820 1000
new: comp 2 23 21820 "gp_pickleweed_plant_JESS" 1 0 rand 800 900
** Attributes: mouseable 2 + activateable 4 + invisible 16 + collide 64 + physics 128 = 214
attr 214
perm 100
accg 1
aero 1
fric 80
elas 20
** bhvr: act1 1 + hit 8 = 9
bhvr 9
** Create the spawning spots
pat: dull 2 "gp_pickleweed_plant_JESS" 1 7 32 1
pat: dull 3 "gp_pickleweed_plant_JESS" 1 20 1 1
pat: dull 4 "gp_pickleweed_plant_JESS" 1 42 16 1
pat: dull 5 "gp_pickleweed_plant_JESS" 1 63 19 1
tick 20
mvsf _p1_ _p2_
targ ownr
kill ownr
endm
**
** Population monitor
**
*
** Pickleweed population control
scrp 1 1 21820 9
tick rand 1500 8000
setv va00 0
esee 2 4 21820
addv va00 1
next
doif va00 le 1
setv va02 posx
setv va03 posy
reps 3
inst
new: simp 2 3 21820 "gp_pickleweed_plant_JESS" 4 10 rand 800 900
** attr: mouseable 2 + collide 64 + physics 128 = 194, bhvr eat 16 + pickup 32 = 48
attr 194
bhvr 48
accg 1
fric 25
elas 30
tick rand 1 500
velo rand -8 8 0
mvsf va02 va03
slow
repe
endi
endm
**
** PICKLEWEED MOTHER
**
*
** hit
scrp 2 23 21820 3
stim writ from 92 1
endm
*
** PUSH SCRIPT
scrp 2 23 21820 1
doif from eq pntr
mesg writ pntr 101
else
stim writ from 90 1
endi
setv va05 posx
setv va06 posy
new: simp 2 3 21820 "gp_pickleweed_plant_JESS" 4 10 rand 2800 2900
** attr: mouseable 2 + collide 64 + physics 128 = 194
attr 194
** Will go through some walls
perm 80
** Physics
accg 0.4
aero 1
fric 25
elas 60
tick rand 700 1400
velo rand -3 3 rand -2 0
mvto va05 va06
endm
*
** TIMER SCRIPT
scrp 2 23 21820 9
doif movs eq 0
** Reset the tick
tick 0
** Grow the flowers and spawn the seed
setv va01 2
reps 4
setv va07 rand 0 3
part va01
** pose ge 9 --> fully grown, drop a seed now
doif pose ge 9
inst
** reset seed lobe
pose 0
** Create and drop a new seed
setv va05 posl
setv va06 post
doif va01 eq 2
addv va05 7
addv va06 32
elif va01 eq 3
addv va05 20
addv va06 1
elif va01 eq 4
addv va05 42
addv va06 16
else
addv va05 63
addv va06 19
endi
new: simp 2 3 21820 "gp_pickleweed_plant_JESS" 4 10 rand 800 900
** attr: mouseable 2 + collide 64 + physics 128 = 194
attr 194
** Will go through some walls
perm 80
** Physics
accg 0.4
aero 1
fric 25
elas 60
tick rand 700 1400
mvsf va05 va06
slow
** pose ge 5 --> grow to full stage
elif pose ge 5
addv va07 9
pose va07
** pose ge 1 --> grow to second stage
elif pose ge 1
addv va07 5
pose va07
endi
addv va01 1
targ ownr
repe
** Check how many seed lobes there are currently growing
setv va00 0
setv va01 2
reps 4
part va01
doif pose ne 0
addv va00 1
endi
addv va01 1
repe
** If there are less than 2 seed lobes growing, there may grow another one.
doif va00 lt 2
setv va03 0
** Make the first checking point random.
setv va01 2
addv va01 rand 0 3
** If the first spot isn't free, try the next one.
reps 4
part va01
doif pose eq 0 and va03 eq 0
addv va03 rand 1 4
pose va03
endi
addv va01 1
doif va01 gt 5
setv va01 2
endi
repe
endi
targ ownr
tick rand 700 1200
endi
endm
** PLANT
*
** plant growing timer
scrp 2 4 21820 9
** Check if the plant is about to start growing: if yes, check if there aren't too many other plants around.
doif tick eq 2
** Check if there's enough space to grow: if not, kill the plant placeholder
inst
setv va00 0
rnge 40
esee 2 4 21820
addv va00 1
next
doif va00 ge 1
kill ownr
stop
endi
setv va00 0
rnge 210
esee 2 4 21820
addv va00 1
next
doif va00 ge 2
kill ownr
stop
endi
** Set the plant growing timer
tick rand 160 300
slow
endi
** Check if the plant is fully grown. If not, grooww
doif pose lt 6
setv va00 pose
addv va00 1
pose va00
** If the plant is fully grown
elif pose eq 6
** check how many times a seed has been dropped: if more than 3 times kill the plant.
doif ov00 gt 3
targ ownr
** Kill it ;u;
lock
part 2
pose 0
part 3
pose 0
targ ownr
part 0
frat 40
anim [4 4 4 2 2 2]
over
kill ownr
stop
unlk
** If less than/equal to 3 times, do the grow subroutines
else
** Make/grow seed
setv va01 2
reps 2
setv va07 rand 0 3
part va01
** seed part pose
doif pose ge 9
inst
pose 0
setv va05 posl
setv va06 post
doif va01 eq 2
addv va05 11
addv va06 0
else
addv va05 33
addv va06 14
endi
addv ov00 1
** Create the seed
new: simp 2 3 21820 "gp_pickleweed_plant_JESS" 4 10 rand 800 900
** attr: mouseable 2 + collide 64 + physics 128 = 194, bhvr pickup 16 + eat 32 = 48
attr 194
bhvr 48
** Will go through some walls
perm 80
** Physics
accg 0.1
aero 1
fric 25
elas 90
tick rand 700 1400
velo rand -2 2 0
mvsf va05 va06
slow
** pose ge 5 --> grow to full stage
elif pose ge 5
addv va07 9
pose va07
** pose ge 1 --> grow to second stage
elif pose ge 1
addv va07 5
pose va07
endi
addv va01 1
targ ownr
repe
** Make the first checking point random.
setv va01 2
addv va01 rand 0 1
** If the first spot isn't free, try the next one.
setv va03 0
reps 2
part va01
doif pose eq 0 and va03 eq 0
addv va03 rand 1 4
pose va03
endi
addv va01 1
doif va01 gt 3
setv va01 2
endi
repe
endi
endi
endm
*
** Seed timer script
*
*
** Seed script
*
*
** EAT
scrp 2 3 21820 12
lock
wait 25
** stim eat plant
doif crea from eq 1
targ from
stim writ from 77 1
chem 98 50
targ ownr
endi
wait 25
kill ownr
unlk
endm
*
** TIMER
scrp 2 3 21820 9
** Get the room type of the seed
setv va00 posl
subv va00 20
setv va01 posb
subv va01 70
setv va02 grap posx posy
setv va03 rtyp va02
** only survive in drained / boggy soil
doif carr eq null
** If submerged, check if the part on top of the plant is not submerged
doif va03 eq 9
setv va20 posb
subv va20 70
setv va21 grap va00 va20
doif va21 ne -1
setv va22 rtyp va21
doif va22 ne 8 and va22 ne 9 and va22 ne -1
** if half in water, set va03 as "boggy soil"
setv va03 6
endi
endi
endi
doif va03 ne 6 and va03 ne 7 and va03 ne 1
kill ownr
stop
endi
endi
** Check if the seed has settled
doif carr eq null and fall eq 0
inst
** Grow plant!
new: comp 2 4 21820 "gp_pickleweed_plant_JESS" 7 15 rand 1000 3000
** attr: invisible 16, bhvr: 0
attr 16
bhvr 0
pat: dull 2 "gp_pickleweed_plant_JESS" 1 11 0 1
pat: dull 3 "gp_pickleweed_plant_JESS" 1 33 14 1
** Set the tick to 2 to trigger the 'do I have enough space to grow' check script
tick 2
** test-move it into the space: if it can't grow there, kill it
doif tmvt va00 va01 eq 0
kill targ
else
** If it can grow here, grow!
mvto va00 va01
endi
slow
targ ownr
kill ownr
endi
endm
*
** Removal script
*
rscr
enum 2 23 21820
kill targ
next
enum 2 3 21820
kill targ
next
enum 2 4 21820
kill targ
next
scrx 2 23 21820 9
scrx 2 23 21820 3
scrx 2 23 21820 1
scrx 2 3 21820 9
scrx 2 3 21820 12
scrx 2 4 21820 9