-
Notifications
You must be signed in to change notification settings - Fork 3
/
21829_fernshroomplanter_agent.cos
354 lines (312 loc) · 5.54 KB
/
21829_fernshroomplanter_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
345
346
347
348
349
350
351
352
353
354
**
** Fern-shroom 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_fernshroom_planter_JESS.agents"
*# DS-Name "GP - Planter (fernshroom)"
*# attach gp_fernshroom_planter_JESS.c16 GrenP_FernShroomPlanter.catalogue
*# desc = "A planter with ferns and tiny button mushrooms.by Jesseth"
*# Agent Animation File = "gp_fernshroom_planter_JESS.c16"
*# Agent Sprite First Image = 20
*# Agent Animation Gallery = "gp_fernshroom_planter_JESS"
*
*
*
** Injection script
**
**
** The planter
**
new: simp 1 1 21829 "gp_fernshroom_planter_JESS" 1 0 rand 800 900
mesg wrt+ targ 1000 game "CreatorX" game "CreatorY" 0
**
** SCRIPTS
**
**
** PLANTER CREATOR SCRIPT
**
scrp 1 1 21829 1000
inst
new: comp 2 23 21829 "gp_fernshroom_planter_JESS" 1 0 rand 800 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
** Create the idle seeding animation
pat: dull 2 "gp_fernshroom_planter_JESS" 1 0 4 1
** The fern spawning spots
pat: dull 3 "gp_fernshroom_planter_JESS" 6 3 13 1
pat: dull 4 "gp_fernshroom_planter_JESS" 6 20 29 1
pat: dull 5 "gp_fernshroom_planter_JESS" 6 24 42 1
** The mushroom spawning spots
pat: dull 6 "gp_fernshroom_planter_JESS" 11 16 16 1
pat: dull 7 "gp_fernshroom_planter_JESS" 11 24 17 1
pat: dull 8 "gp_fernshroom_planter_JESS" 11 33 12 1
part 2
frat 40
anim [ 0 1 2 3 4 255 ]
tick 20
mvsf _p1_ _p2_
slow
targ ownr
kill targ
endm
**
** PLANTER PUSH SCRIPT
**
scrp 2 23 21829 1
mesg writ pntr 101
setv va05 posx
setv va06 posy
** Vend a mushroom
new: simp 2 11 21829 "gp_fernshroom_planter_JESS" 1 15 rand 1200 1900
** 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
** bhvr: pickup 16 + eat 32 = 48
bhvr 48
tick 1800
velo rand -3 3 0
mvsf va05 va06
endm
**
** PLANTER TIMER SCRIPT
**
scrp 2 23 21829 9
doif carr eq null
tick rand 160 260
lock
** Grow the flowers and spawn the seed
setv va01 3
reps 6
part va01
** Fern 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
** Mushroom subroutine
else
doif pose ge 1 and pose lt 4
setv va10 pose
addv va10 1
pose va10
elif pose eq 4
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 2 seed lobes growing, there may grow another one.
doif va00 lt 2 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 mushrooms 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 mushrooms 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
** Fern 3 4 5
doif va01 eq 3
addv va05 2
addv va06 16
elif va01 eq 4
addv va05 19
addv va06 32
elif va01 eq 5
addv va05 23
addv va06 45
endi
new: simp 2 3 21829 "gp_fernshroom_planter_JESS" 1 10 rand 1200 1900
else
** mushrooms 6 7 8
doif va01 eq 6
addv va05 16
addv va06 21
elif va01 eq 7
addv va05 24
addv va06 22
elif va01 eq 8
addv va05 33
addv va06 17
endi
new: simp 2 11 21829 "gp_fernshroom_planter_JESS" 1 15 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 50
elas 30
tick rand 1200 2000
mvsf va05 va06
slow
retn
endm
**
** FERN SEED TIMER
**
**
** MUSHROOM TIMER
**
**
** FERN SEED EAT
**
scrp 2 3 21829 12
lock
wait 10
** stim eat plant
stim writ from 77 1
wait 10
kill ownr
unlk
endm
**
** MUSHROOM EAT
**
scrp 2 11 21829 12
lock
wait 10
** stim eat food
stim writ from 79 1
wait 10
kill ownr
unlk
endm
**
** FERN SEED TIMER
**
scrp 2 3 21829 9
doif carr eq null
kill ownr
endi
endm
**
** MUSHROOM TIMER
**
scrp 2 11 21829 9
doif carr eq null
kill ownr
endi
endm
*
** Removal script
*
rscr
enum 1 1 21829
kill targ
next
enum 2 23 21829
kill targ
next
enum 2 3 21829
kill targ
next
enum 2 11 21829
kill targ
next
scrx 1 1 21829 1000
scrx 2 23 21829 1
scrx 2 23 21829 9
scrx 2 3 21829 9
scrx 2 3 21829 12
scrx 2 11 21829 9
scrx 2 11 21829 12