Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
koopa_troopa.inc.c
Go to the documentation of this file.
1#include "common.h"
2#include "effects.h"
3#include "battle/battle.h"
4#include "script_api/battle.h"
5#include "sprite/npc/KoopaTroopa.h"
6
7#define NAMESPACE A(koopa_troopa)
8
9extern s32 N(DefaultAnims)[];
10extern EvtScript N(EVS_Init);
11extern EvtScript N(EVS_Idle);
12extern EvtScript N(EVS_TakeTurn);
13extern EvtScript N(EVS_HandleEvent);
14
15enum N(ActorPartIDs) {
16 PRT_MAIN = 1,
17};
18
19enum N(ActorVars) {
20 AVAR_IsFlipped = 8,
21 AVAR_FlippedTurns = 9,
22};
23
24enum N(ActorParams) {
25 DMG_SHELL_TOSS = 1,
26};
27
28s32 N(NormalDefense)[] = {
31 ELEMENT_JUMP, 1,
35};
36
37s32 N(FlippedDefense)[] = {
40};
41
42s32 N(StatusTable)[] = {
53 STATUS_KEY_STOP, 100,
65};
66
67ActorPartBlueprint N(ActorParts)[] = {
68 {
70 .index = PRT_MAIN,
71 .posOffset = { 0, 0, 0 },
72 .targetOffset = { -2, 36 },
73 .opacity = 255,
74 .idleAnimations = N(DefaultAnims),
75 .defenseTable = N(NormalDefense),
76 .eventFlags = ACTOR_EVENT_FLAG_FLIPABLE,
77 .elementImmunityFlags = 0,
78 .projectileTargetOffset = { 0, -7 },
79 },
80};
81
82ActorBlueprint NAMESPACE = {
83 .flags = 0,
84 .type = ACTOR_TYPE_KOOPA_TROOPA,
85 .level = ACTOR_LEVEL_KOOPA_TROOPA,
86 .maxHP = 4,
87 .partCount = ARRAY_COUNT(N(ActorParts)),
88 .partsData = N(ActorParts),
89 .initScript = &N(EVS_Init),
90 .statusTable = N(StatusTable),
91 .escapeChance = 70,
92 .airLiftChance = 90,
93 .hurricaneChance = 90,
94 .spookChance = 90,
95 .upAndAwayChance = 95,
96 .spinSmashReq = 0,
97 .powerBounceChance = 100,
98 .coinReward = 1,
99 .size = { 28, 36 },
100 .healthBarOffset = { 0, 0 },
101 .statusIconOffset = { -15, 32 },
102 .statusTextOffset = { 5, 32 },
103};
104
105s32 N(DefaultAnims)[] = {
106 STATUS_KEY_NORMAL, ANIM_KoopaTroopa_Idle,
107 STATUS_KEY_STONE, ANIM_KoopaTroopa_Still,
108 STATUS_KEY_SLEEP, ANIM_KoopaTroopa_Sleep,
109 STATUS_KEY_POISON, ANIM_KoopaTroopa_Idle,
110 STATUS_KEY_STOP, ANIM_KoopaTroopa_Still,
111 STATUS_KEY_STATIC, ANIM_KoopaTroopa_Idle,
112 STATUS_KEY_PARALYZE, ANIM_KoopaTroopa_Still,
113 STATUS_KEY_DIZZY, ANIM_KoopaTroopa_Stunned,
114 STATUS_KEY_FEAR, ANIM_KoopaTroopa_Stunned,
116};
117
118s32 N(ShuffleAnims)[] = {
119 STATUS_KEY_NORMAL, ANIM_KoopaTroopa_Walk,
120 STATUS_KEY_STONE, ANIM_KoopaTroopa_Still,
121 STATUS_KEY_SLEEP, ANIM_KoopaTroopa_Sleep,
122 STATUS_KEY_POISON, ANIM_KoopaTroopa_Walk,
123 STATUS_KEY_STOP, ANIM_KoopaTroopa_Still,
124 STATUS_KEY_STATIC, ANIM_KoopaTroopa_Walk,
125 STATUS_KEY_PARALYZE, ANIM_KoopaTroopa_Still,
126 STATUS_KEY_DIZZY, ANIM_KoopaTroopa_Stunned,
127 STATUS_KEY_FEAR, ANIM_KoopaTroopa_Stunned,
129};
130
131s32 N(FlippedAnims)[] = {
132 STATUS_KEY_NORMAL, ANIM_KoopaTroopa_ToppleStruggle,
133 STATUS_KEY_STONE, ANIM_KoopaTroopa_ToppleStill,
134 STATUS_KEY_SLEEP, ANIM_KoopaTroopa_ToppleSleep,
135 STATUS_KEY_POISON, ANIM_KoopaTroopa_ToppleStruggle,
136 STATUS_KEY_STOP, ANIM_KoopaTroopa_ToppleStill,
137 STATUS_KEY_STATIC, ANIM_KoopaTroopa_ToppleStruggle,
138 STATUS_KEY_PARALYZE, ANIM_KoopaTroopa_ToppleStill,
139 STATUS_KEY_DIZZY, ANIM_KoopaTroopa_ToppleStunned,
140 STATUS_KEY_FEAR, ANIM_KoopaTroopa_ToppleStunned,
142};
143
144EvtScript N(EVS_Init) = {
145 Call(BindTakeTurn, ACTOR_SELF, Ref(N(EVS_TakeTurn)))
146 Call(BindIdle, ACTOR_SELF, Ref(N(EVS_Idle)))
147 Call(BindHandleEvent, ACTOR_SELF, Ref(N(EVS_HandleEvent)))
148 Call(SetActorVar, ACTOR_SELF, AVAR_IsFlipped, FALSE)
149 Return
150 End
151};
152
154
155EvtScript N(EVS_UpdateTargetOffsets) = {
157 CaseEq(0)
159 Call(SetTargetOffset, ACTOR_SELF, PRT_MAIN, -5, 15)
160 Call(SetProjectileTargetOffset, ACTOR_SELF, PRT_MAIN, 0, 0)
161 Call(N(SetAbsoluteStatusOffsets), -10, 20, 10, 20)
162 Else
163 Call(SetTargetOffset, ACTOR_SELF, PRT_MAIN, -4, 32)
164 Call(SetProjectileTargetOffset, ACTOR_SELF, PRT_MAIN, -1, -4)
165 Call(N(SetAbsoluteStatusOffsets), -15, 32, 5, 32)
166 EndIf
167 CaseEq(1)
168 Call(SetTargetOffset, ACTOR_SELF, PRT_MAIN, -5, 15)
169 Call(SetProjectileTargetOffset, ACTOR_SELF, PRT_MAIN, 0, 0)
170 Call(N(SetAbsoluteStatusOffsets), -10, 20, 10, 20)
172 Return
173 End
174};
175
176EvtScript N(EVS_Idle) = {
177 Label(0)
178 Call(RandInt, 80, LVarA)
179 Add(LVarA, 80)
180 Loop(LVarA)
181 Label(1)
182 Call(GetActorVar, ACTOR_SELF, AVAR_IsFlipped, LVar0)
183 Call(GetStatusFlags, ACTOR_SELF, LVar1)
184 ExecWait(N(EVS_UpdateTargetOffsets))
185 IfEq(LVar0, 1)
186 Wait(1)
187 Goto(1)
188 EndIf
190 Wait(1)
191 Goto(1)
192 EndIf
193 Wait(1)
194 EndLoop
195 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
196 Add(LVar0, 5)
197 Call(SetActorIdleSpeed, ACTOR_SELF, Float(1.0))
198 Call(SetIdleAnimations, ACTOR_SELF, PRT_MAIN, Ref(N(ShuffleAnims)))
199 Call(SetIdleGoal, ACTOR_SELF, LVar0, LVar1, LVar2)
200 Call(IdleRunToGoal, ACTOR_SELF, 0)
201 Call(GetActorVar, ACTOR_SELF, AVAR_IsFlipped, LVar0)
203 CaseEq(0)
204 Call(SetIdleAnimations, ACTOR_SELF, PRT_MAIN, Ref(N(DefaultAnims)))
205 CaseEq(1)
206 Call(SetIdleAnimations, ACTOR_SELF, PRT_MAIN, Ref(N(FlippedAnims)))
208 Loop(20)
209 Label(2)
210 Call(GetActorVar, ACTOR_SELF, AVAR_IsFlipped, LVar0)
211 Call(GetStatusFlags, ACTOR_SELF, LVar1)
212 ExecWait(N(EVS_UpdateTargetOffsets))
213 IfEq(LVar0, 1)
214 Wait(1)
215 Goto(2)
216 EndIf
218 Wait(1)
219 Goto(2)
220 EndIf
221 Wait(1)
222 EndLoop
223 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
224 Sub(LVar0, 5)
225 Call(SetActorIdleSpeed, ACTOR_SELF, Float(1.0))
226 Call(SetIdleAnimations, ACTOR_SELF, PRT_MAIN, Ref(N(ShuffleAnims)))
227 Call(SetIdleGoal, ACTOR_SELF, LVar0, LVar1, LVar2)
228 Call(IdleRunToGoal, ACTOR_SELF, 0)
229 Call(GetActorVar, ACTOR_SELF, AVAR_IsFlipped, LVar0)
231 CaseEq(0)
232 Call(SetIdleAnimations, ACTOR_SELF, PRT_MAIN, Ref(N(DefaultAnims)))
233 CaseEq(1)
234 Call(SetIdleAnimations, ACTOR_SELF, PRT_MAIN, Ref(N(FlippedAnims)))
236 Loop(80)
237 Label(3)
238 Call(GetActorVar, ACTOR_SELF, AVAR_IsFlipped, LVar0)
239 Call(GetStatusFlags, ACTOR_SELF, LVar1)
240 ExecWait(N(EVS_UpdateTargetOffsets))
241 IfEq(LVar0, 1)
242 Wait(1)
243 Goto(3)
244 EndIf
246 Wait(1)
247 Goto(3)
248 EndIf
249 Wait(1)
250 EndLoop
251 Goto(0)
252 Return
253 End
254};
255
256s32 N(FlipPosOffsets)[] = { 9, 16, 22, 26, 30, 32, 33, 32, 30, 26, 22, 16, 9, 0, 4, 6, 7, 6, 4, 0, 2, 0 };
257
258EvtScript N(EVS_HandleEvent) = {
259 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
260 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
261 Call(SetActorYaw, ACTOR_SELF, 0)
262 Call(GetLastEvent, ACTOR_SELF, LVar0)
266 SetConst(LVar0, PRT_MAIN)
267 SetConst(LVar1, ANIM_KoopaTroopa_Hurt)
271 SetConst(LVar0, PRT_MAIN)
272 SetConst(LVar1, ANIM_KoopaTroopa_BurnHurt)
273 SetConst(LVar2, ANIM_KoopaTroopa_BurnStill)
276 SetConst(LVar0, PRT_MAIN)
277 SetConst(LVar1, ANIM_KoopaTroopa_BurnHurt)
278 SetConst(LVar2, ANIM_KoopaTroopa_BurnStill)
280 SetConst(LVar0, PRT_MAIN)
281 SetConst(LVar1, ANIM_KoopaTroopa_BurnStill)
283 Return
285 SetConst(LVar0, PRT_MAIN)
286 SetConst(LVar1, ANIM_KoopaTroopa_Hurt)
289 SetConst(LVar0, PRT_MAIN)
290 SetConst(LVar1, ANIM_KoopaTroopa_Hurt)
292 SetConst(LVar0, PRT_MAIN)
293 SetConst(LVar1, ANIM_KoopaTroopa_Hurt)
295 Return
297 Call(SetActorVar, ACTOR_SELF, AVAR_IsFlipped, TRUE)
298 Call(SetActorVar, ACTOR_SELF, AVAR_FlippedTurns, 2)
299 Call(SetDefenseTable, ACTOR_SELF, PRT_MAIN, Ref(N(FlippedDefense)))
300 Call(SetIdleAnimations, ACTOR_SELF, PRT_MAIN, Ref(N(FlippedAnims)))
301 Call(SetTargetOffset, ACTOR_SELF, PRT_MAIN, -5, 15)
302 Call(SetProjectileTargetOffset, ACTOR_SELF, PRT_MAIN, 0, 0)
303 Call(SetActorFlagBits, ACTOR_SELF, ACTOR_FLAG_FLIPPED, TRUE)
304 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_KoopaTroopa_Hurt)
305 Call(GetStatusFlags, ACTOR_SELF, LVarA)
306 Call(SetActorRotationOffset, ACTOR_SELF, 0, 12, 0)
308 Wait(4)
309 Call(SetActorRotation, ACTOR_SELF, 0, 0, 30)
310 Wait(1)
311 Call(SetActorRotation, ACTOR_SELF, 0, 0, 0)
312 Wait(1)
313 Call(SetActorRotation, ACTOR_SELF, 0, 0, -30)
314 Wait(1)
315 Call(SetActorRotation, ACTOR_SELF, 0, 0, -60)
316 Wait(1)
317 Call(SetActorRotation, ACTOR_SELF, 0, 0, -75)
318 Wait(1)
320 UseBuf(Ref(N(FlipPosOffsets)))
321 Loop(ARRAY_COUNT(N(FlipPosOffsets)))
323 Call(SetActorDispOffset, ACTOR_SELF, 0, LVar0, 0)
324 Wait(1)
325 EndLoop
326 Call(SetActorRotationOffset, ACTOR_SELF, 0, 0, 0)
327 Call(SetActorRotation, ACTOR_SELF, 0, 0, 0)
328 Call(SetActorDispOffset, ACTOR_SELF, 0, 0, 0)
329 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_KoopaTroopa_ToppleStruggle)
331 SetConst(LVar0, PRT_MAIN)
332 SetConst(LVar1, ANIM_KoopaTroopa_Hurt)
334 SetConst(LVar0, PRT_MAIN)
335 SetConst(LVar1, ANIM_KoopaTroopa_Hurt)
337 Call(JumpToGoal, ACTOR_SELF, 5, FALSE, TRUE, FALSE)
338 SetConst(LVar0, PRT_MAIN)
339 SetConst(LVar1, ANIM_KoopaTroopa_Run)
341 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.6))
342 Call(JumpToGoal, ACTOR_SELF, 5, FALSE, TRUE, FALSE)
344 SetConst(LVar0, PRT_MAIN)
345 SetConst(LVar1, ANIM_KoopaTroopa_Hurt)
347 SetConst(LVar0, PRT_MAIN)
348 SetConst(LVar1, ANIM_KoopaTroopa_Hurt)
350 Return
353 Call(GetActorVar, ACTOR_SELF, AVAR_IsFlipped, LVar0)
354 IfEq(LVar0, 0)
355 SetConst(LVar0, PRT_MAIN)
356 SetConst(LVar1, ANIM_KoopaTroopa_ShellEnter)
358 Call(GetStatusFlags, ACTOR_SELF, LVar0)
360 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_KoopaTroopa_ShellExit)
361 Wait(10)
362 EndIf
363 Else
364 SetConst(LVar0, PRT_MAIN)
365 SetConst(LVar1, ANIM_KoopaTroopa_ToppleStruggle)
367 EndIf
370 SetConst(LVar0, PRT_MAIN)
371 SetConst(LVar1, ANIM_KoopaTroopa_Hurt)
373 Wait(10)
374 SetConst(LVar0, PRT_MAIN)
375 SetConst(LVar1, ANIM_KoopaTroopa_Hurt)
377 Return
379 Call(GetActorVar, ACTOR_SELF, AVAR_IsFlipped, LVar0)
380 IfEq(LVar0, 0)
381 SetConst(LVar0, PRT_MAIN)
382 SetConst(LVar1, ANIM_KoopaTroopa_Run)
384 EndIf
385 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
386 Call(SetHomePos, ACTOR_SELF, LVar0, LVar1, LVar2)
387 Call(HPBarToHome, ACTOR_SELF)
389 Call(GetActorVar, ACTOR_SELF, AVAR_IsFlipped, LVar0)
390 IfEq(LVar0, 0)
391 SetConst(LVar0, PRT_MAIN)
392 SetConst(LVar1, ANIM_KoopaTroopa_Idle)
394 Else
395 SetConst(LVar0, PRT_MAIN)
396 SetConst(LVar1, ANIM_KoopaTroopa_ToppleStruggle)
398 EndIf
400 Call(GetActorVar, ACTOR_SELF, AVAR_IsFlipped, LVar0)
401 IfEq(LVar0, 0)
402 SetConst(LVar0, PRT_MAIN)
403 SetConst(LVar1, ANIM_KoopaTroopa_Run)
404 SetConst(LVar2, ANIM_KoopaTroopa_Hurt)
406 Return
407 Else
408 SetConst(LVar0, PRT_MAIN)
409 SetConst(LVar1, ANIM_KoopaTroopa_ToppleStruggle)
411 EndIf
413 Call(GetActorVar, ACTOR_SELF, AVAR_IsFlipped, LVar0)
414 IfEq(LVar0, 0)
415 SetConst(LVar0, PRT_MAIN)
416 SetConst(LVar1, ANIM_KoopaTroopa_Panic)
417 Else
418 SetConst(LVar0, PRT_MAIN)
419 SetConst(LVar1, ANIM_KoopaTroopa_ToppleStruggle)
420 EndIf
423 Call(GetActorVar, ACTOR_SELF, AVAR_IsFlipped, LVar0)
424 IfEq(LVar0, 0)
425 SetConst(LVar0, PRT_MAIN)
426 SetConst(LVar1, ANIM_KoopaTroopa_Panic)
427 Else
428 SetConst(LVar0, PRT_MAIN)
429 SetConst(LVar1, ANIM_KoopaTroopa_ToppleStruggle)
430 EndIf
432 Return
434 Call(GetActorVar, ACTOR_SELF, AVAR_IsFlipped, LVar0)
435 IfEq(LVar0, 0)
436 SetConst(LVar0, PRT_MAIN)
437 SetConst(LVar1, ANIM_KoopaTroopa_Idle)
439 Else
440 SetConst(LVar0, PRT_MAIN)
441 SetConst(LVar1, ANIM_KoopaTroopa_ToppleStruggle)
443 EndIf
445 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_RESTART)
446 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
447 Return
448 End
449};
450
451EvtScript N(EVS_TakeTurn) = {
452 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
453 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
454 Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER)
455 Call(GetBattlePhase, LVar0)
457 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_KoopaTroopa_ShellSpin)
458 Else
459 Call(GetActorVar, ACTOR_SELF, AVAR_IsFlipped, LVar0)
460 IfEq(LVar0, 1)
461 Call(GetActorVar, ACTOR_SELF, AVAR_FlippedTurns, LVar0)
462 Sub(LVar0, 1)
463 IfGt(LVar0, 0)
464 Call(SetActorVar, ACTOR_SELF, AVAR_FlippedTurns, LVar0)
465 Call(AddActorDecoration, ACTOR_SELF, PRT_MAIN, 0, ACTOR_DECORATION_SWEAT)
466 Call(SetAnimationRate, ACTOR_SELF, PRT_MAIN, Float(3.0))
467 Wait(30)
468 Call(SetAnimationRate, ACTOR_SELF, PRT_MAIN, Float(1.0))
469 Call(RemoveActorDecoration, ACTOR_SELF, PRT_MAIN, 0)
470 Else
471 Call(AddActorDecoration, ACTOR_SELF, PRT_MAIN, 0, ACTOR_DECORATION_SWEAT)
472 Call(SetAnimationRate, ACTOR_SELF, PRT_MAIN, Float(3.0))
473 Wait(20)
474 Call(SetAnimationRate, ACTOR_SELF, PRT_MAIN, Float(1.0))
475 Call(RemoveActorDecoration, ACTOR_SELF, PRT_MAIN, 0)
476 Call(SetActorSounds, ACTOR_SELF, ACTOR_SOUND_JUMP, SOUND_NONE, 0)
477 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_ACTOR_JUMP)
478 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_KoopaTroopa_ToppleStruggle)
479 Set(LVar0, 0)
480 Call(SetActorRotationOffset, ACTOR_SELF, 0, 12, 0)
482 Loop(5)
483 Add(LVar0, 15)
484 Call(SetActorRotation, ACTOR_SELF, 0, 0, LVar0)
485 Wait(1)
486 EndLoop
488 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
489 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
490 Call(SetActorJumpGravity, ACTOR_SELF, Float(3.0))
491 Call(JumpToGoal, ACTOR_SELF, 8, FALSE, TRUE, FALSE)
492 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_ACTOR_STEP_A)
493 Call(SetActorRotationOffset, ACTOR_SELF, 0, 0, 0)
494 Call(SetActorRotation, ACTOR_SELF, 0, 0, 0)
495 Call(SetActorDispOffset, ACTOR_SELF, 0, 0, 0)
496 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_KoopaTroopa_Idle)
497 Call(SetActorVar, ACTOR_SELF, AVAR_IsFlipped, FALSE)
498 Call(SetIdleAnimations, ACTOR_SELF, PRT_MAIN, Ref(N(DefaultAnims)))
499 Call(SetDefenseTable, ACTOR_SELF, PRT_MAIN, Ref(N(NormalDefense)))
500 Call(SetTargetOffset, ACTOR_SELF, PRT_MAIN, -4, 32)
501 Call(SetProjectileTargetOffset, ACTOR_SELF, PRT_MAIN, -1, -4)
502 Call(SetActorFlagBits, ACTOR_SELF, ACTOR_FLAG_FLIPPED, FALSE)
503 Call(ResetActorSounds, ACTOR_SELF, ACTOR_SOUND_JUMP)
504 EndIf
505 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
506 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
507 Return
508 EndIf
509 Call(UseBattleCamPreset, BTL_CAM_ENEMY_APPROACH)
510 Call(BattleCamTargetActor, ACTOR_SELF)
511 Wait(10)
512 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_KoopaTroopa_ShellEnter)
513 Wait(10)
515 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
516 Add(LVar1, 4)
517 PlayEffect(EFFECT_SMOKE_IMPACT, 1, LVar0, LVar1, LVar2, 32, 4, 0, 10, 0)
518 Wait(3)
519 PlayEffect(EFFECT_SMOKE_IMPACT, 1, LVar0, LVar1, LVar2, 32, 4, 0, 10, 0)
520 Wait(2)
521 PlayEffect(EFFECT_SMOKE_IMPACT, 1, LVar0, LVar1, LVar2, 32, 4, 0, 10, 0)
523 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_SHELL_SPIN)
524 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_KoopaTroopa_ShellSpin)
525 Wait(10)
526 Call(SetBattleCamTargetingModes, BTL_CAM_YADJ_TARGET, BTL_CAM_XADJ_AVG, FALSE)
527 EndIf
528 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_SHELL_TOSS)
530 Call(EnemyTestTarget, ACTOR_SELF, LVar0, 0, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS)
534 Set(LVarA, LVar0)
535 Call(SetGoalToTarget, ACTOR_SELF)
536 Call(AddGoalPos, ACTOR_SELF, -40, 0, 0)
537 Call(SetActorSpeed, ACTOR_SELF, Float(16.0))
538 Call(RunToGoal, ACTOR_SELF, 0, FALSE)
539 Call(GetBattlePhase, LVar0)
541 Call(UseBattleCamPreset, BTL_CAM_ACTOR_TARGET_MIDPOINT)
542 Call(SetBattleCamDist, 300)
543 Call(SetBattleCamOffsetY, 20)
544 Call(MoveBattleCamOver, 10)
545 Call(SetBattleCamTargetingModes, BTL_CAM_YADJ_TARGET, BTL_CAM_XADJ_AVG, FALSE)
546 EndIf
547 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_KoopaTroopa_ShellExit)
548 Wait(8)
549 Call(ResetAllActorSounds, ACTOR_SELF)
550 Call(SetActorYaw, ACTOR_SELF, 180)
551 Wait(4)
553 Call(EnemyTestTarget, ACTOR_SELF, LVar0, DAMAGE_TYPE_TRIGGER_LUCKY, 0, 0, 0)
554 EndIf
555 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_KoopaTroopa_BeginPanic1)
556 Wait(1)
557 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_KoopaTroopa_BeginPanic2)
558 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
559 Add(LVar1, 20)
560 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
561 Call(SetActorJumpGravity, ACTOR_SELF, Float(2.0))
562 Call(JumpToGoal, ACTOR_SELF, 5, FALSE, TRUE, FALSE)
563 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_KoopaTroopa_Panic)
564 Wait(6)
565 Sub(LVar1, 20)
566 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
567 Call(JumpToGoal, ACTOR_SELF, 5, FALSE, TRUE, FALSE)
568 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
569 Call(YieldTurn)
570 Call(SetActorYaw, ACTOR_SELF, 180)
571 Call(AddActorDecoration, ACTOR_SELF, PRT_MAIN, 0, ACTOR_DECORATION_SWEAT)
572 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_KoopaTroopa_Panic)
573 Call(SetGoalToHome, ACTOR_SELF)
574 Call(SetActorSpeed, ACTOR_SELF, Float(8.0))
575 Call(RunToGoal, ACTOR_SELF, 0, FALSE)
576 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_KoopaTroopa_Idle)
577 Call(RemoveActorDecoration, ACTOR_SELF, PRT_MAIN, 0)
578 Call(SetPartYaw, ACTOR_SELF, PRT_MAIN, 0)
579 Call(SetActorYaw, ACTOR_SELF, 0)
580 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
581 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
582 Return
585 Call(SetGoalToTarget, ACTOR_SELF)
586 Call(SetActorSpeed, ACTOR_SELF, Float(16.0))
587 Call(RunToGoal, ACTOR_SELF, 0, FALSE)
588 Call(ResetAllActorSounds, ACTOR_SELF)
589 Wait(2)
590 Call(EnemyDamageTarget, ACTOR_SELF, LVar0, 0, SUPPRESS_EVENT_ALL, 0, DMG_SHELL_TOSS, BS_FLAGS1_TRIGGER_EVENTS)
594 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
595 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
596 Add(LVar0, 40)
597 Set(LVar1, 0)
598 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.8))
599 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
600 Call(JumpToGoal, ACTOR_SELF, 10, FALSE, TRUE, FALSE)
601 Add(LVar0, 30)
602 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
603 Call(JumpToGoal, ACTOR_SELF, 8, FALSE, TRUE, FALSE)
604 Add(LVar0, 20)
605 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
606 Call(JumpToGoal, ACTOR_SELF, 6, FALSE, TRUE, FALSE)
607 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_KoopaTroopa_ShellExit)
608 Wait(8)
609 Call(YieldTurn)
610 SetConst(LVar0, PRT_MAIN)
611 SetConst(LVar1, ANIM_KoopaTroopa_Run)
613 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_KoopaTroopa_Idle)
616 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
617 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
618 Return
619 End
620};
Bytecode EvtScript[]
#define STATUS_FLAGS_IMMOBILIZED
Definition enums.h:2834
@ BTL_CAM_XADJ_AVG
Definition enums.h:4900
@ ACTOR_SOUND_WALK
Definition enums.h:2034
@ ACTOR_SOUND_JUMP
Definition enums.h:2036
@ BS_FLAGS1_TRIGGER_EVENTS
Definition enums.h:3575
@ BS_FLAGS1_INCLUDE_POWER_UPS
Definition enums.h:3571
@ ELEMENT_JUMP
Definition enums.h:2122
@ ELEMENT_END
Definition enums.h:2114
@ ELEMENT_BLAST
Definition enums.h:2124
@ ELEMENT_SMASH
Definition enums.h:2121
@ ELEMENT_WATER
Definition enums.h:2117
@ ELEMENT_NORMAL
Definition enums.h:2115
@ ACTOR_EVENT_FLAG_FLIPABLE
Actor can be flipped; triggered by jump and quake attacks.
Definition enums.h:3380
@ ACTOR_DECORATION_SWEAT
Definition enums.h:2045
@ PHASE_FIRST_STRIKE
Definition enums.h:2059
@ STATUS_KEY_PARALYZE
Definition enums.h:2201
@ STATUS_TURN_MOD_DEFAULT
Definition enums.h:2227
@ STATUS_TURN_MOD_PARALYZE
Definition enums.h:2234
@ STATUS_KEY_FROZEN
Definition enums.h:2203
@ STATUS_TURN_MOD_SLEEP
Definition enums.h:2228
@ STATUS_TURN_MOD_DIZZY
Definition enums.h:2232
@ STATUS_KEY_STATIC
Definition enums.h:2207
@ STATUS_END
Definition enums.h:2196
@ STATUS_TURN_MOD_POISON
Definition enums.h:2233
@ STATUS_KEY_FEAR
Definition enums.h:2199
@ STATUS_TURN_MOD_STOP
Definition enums.h:2237
@ STATUS_KEY_SLEEP
Definition enums.h:2202
@ STATUS_KEY_STONE
Definition enums.h:2208
@ STATUS_KEY_STOP
Definition enums.h:2204
@ STATUS_TURN_MOD_FROZEN
Definition enums.h:2230
@ STATUS_KEY_SHRINK
Definition enums.h:2206
@ STATUS_KEY_DIZZY
Definition enums.h:2200
@ STATUS_KEY_POISON
Definition enums.h:2205
@ STATUS_TURN_MOD_STATIC
Definition enums.h:2229
@ STATUS_TURN_MOD_FEAR
Definition enums.h:2231
@ STATUS_KEY_NORMAL
Definition enums.h:2197
@ STATUS_TURN_MOD_SHRINK
Definition enums.h:2235
@ STATUS_KEY_DEFAULT
Definition enums.h:2198
@ HIT_RESULT_NO_DAMAGE
Definition enums.h:1952
@ HIT_RESULT_HIT
Definition enums.h:1950
@ HIT_RESULT_LUCKY
Definition enums.h:1955
@ HIT_RESULT_MISS
Definition enums.h:1956
@ BTL_CAM_ACTOR_TARGET_MIDPOINT
Definition enums.h:4827
@ BTL_CAM_DEFAULT
Definition enums.h:4824
@ BTL_CAM_ENEMY_APPROACH
Definition enums.h:4885
@ SUPPRESS_EVENT_ALL
Definition enums.h:2907
@ IDLE_SCRIPT_RESTART
Definition enums.h:6409
@ IDLE_SCRIPT_ENABLE
Definition enums.h:6408
@ IDLE_SCRIPT_DISABLE
Definition enums.h:6407
@ STATUS_FLAG_DIZZY
Definition enums.h:2818
@ STATUS_FLAG_SLEEP
Definition enums.h:2812
@ SOUND_NONE
Definition enums.h:547
@ SOUND_ACTOR_STEP_A
Definition enums.h:1474
@ SOUND_SHELL_SPIN
Definition enums.h:1342
@ SOUND_SHELL_TOSS
Definition enums.h:1497
@ SOUND_ACTOR_JUMP
Definition enums.h:1290
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_SELF
Definition enums.h:2084
@ ACTOR_FLAG_FLIPPED
Actor has been flipped over.
Definition enums.h:3330
@ BTL_CAM_YADJ_TARGET
Definition enums.h:4905
@ EVENT_HIT
Definition enums.h:2132
@ EVENT_SCARE_AWAY
Definition enums.h:2174
@ EVENT_BURN_HIT
Definition enums.h:2136
@ EVENT_END_FIRST_STRIKE
Definition enums.h:2171
@ EVENT_IMMUNE
Definition enums.h:2146
@ EVENT_BURN_DEATH
Definition enums.h:2157
@ EVENT_ZERO_DAMAGE
Definition enums.h:2144
@ EVENT_SHOCK_DEATH
Definition enums.h:2159
@ EVENT_SPIN_SMASH_HIT
Definition enums.h:2133
@ EVENT_SPIN_SMASH_DEATH
Definition enums.h:2154
@ EVENT_HIT_COMBO
Definition enums.h:2131
@ EVENT_AIR_LIFT_FAILED
Definition enums.h:2152
@ EVENT_BEGIN_AIR_LIFT
Definition enums.h:2175
@ EVENT_DEATH
Definition enums.h:2153
@ EVENT_FLIP_TRIGGER
Definition enums.h:2135
@ EVENT_SHOCK_HIT
Definition enums.h:2165
@ EVENT_RECOVER_STATUS
Definition enums.h:2167
@ EVENT_BLOW_AWAY
Definition enums.h:2143
@ ACTOR_PART_FLAG_PRIMARY_TARGET
Definition enums.h:3362
@ DAMAGE_TYPE_TRIGGER_LUCKY
Definition enums.h:2881
EvtScript EVS_Enemy_ReturnHome
EvtScript EVS_Enemy_Knockback
EvtScript EVS_Enemy_ScareAway
EvtScript EVS_Enemy_Hit
EvtScript EVS_Enemy_Death
EvtScript EVS_Enemy_SpinSmashHit
EvtScript EVS_Enemy_ShockHit
EvtScript EVS_Enemy_AirLift
EvtScript EVS_Enemy_BlowAway
EvtScript EVS_Enemy_Recover
EvtScript EVS_Enemy_BurnHit
EvtScript EVS_Enemy_NoDamageHit
ApiStatus RandInt(Evt *script, b32 isInitialCall)
#define Else
Marks the end of an if statement and the start of the else block.
Definition macros.h:295
#define Switch(LVAR)
Marks the start of a switch statement.
Definition macros.h:311
#define Ref(sym)
Address/pointer constant.
Definition macros.h:60
#define Set(VAR, INT_VALUE)
Sets the given variable to a given value casted to an integer.
Definition macros.h:365
#define CaseEq(RVAR)
Marks the start of a switch case that executes only if LVAR == RVAR. It also marks the end of any pre...
Definition macros.h:319
#define EndChildThread
Marks the end of a child thread block.
Definition macros.h:563
#define Sub(VAR, INT_VALUE)
Definition macros.h:377
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
Definition macros.h:213
#define UseBuf(INT_PTR)
Loads a s32 pointer for use with subsequent EVT_BUF_READ commands.
Definition macros.h:389
#define Add(VAR, INT_VALUE)
Definition macros.h:376
#define EndLoop
Marks the end of a loop.
Definition macros.h:248
#define EndCaseGroup
Marks the end of a switch case group (CaseOrEq and/or CaseAndEq), stopping fallthrough.
Definition macros.h:352
#define Goto(LABEL_ID)
Moves execution to the given label.
Definition macros.h:232
#define ARRAY_COUNT(arr)
Definition macros.h:40
#define BufRead1(VAR)
Consumes the next s32 from the buffer and stores it in the given variable.
Definition macros.h:392
#define IfGt(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR <= RVAR.
Definition macros.h:278
#define Float(DOUBLE)
Definition macros.h:51
#define Label(LABEL_ID)
Marks this point in the script as a Goto target.
Definition macros.h:227
#define CaseOrEq(RVAR)
Marks the start of a switch case that executes only if LVAR == RVAR.
Definition macros.h:341
#define EndIf
Marks the end of an if statement or an else block.
Definition macros.h:298
#define ExecWait(EVT_SOURCE)
Launches a new child thread.
Definition macros.h:475
#define IfFlag(LVAR, RVAR)
Marks the beginning of an if statement that only executes if the RVAR flag is set on LVAR,...
Definition macros.h:288
#define LVar2
Definition macros.h:150
#define LVar1
Definition macros.h:149
#define LVarA
Definition macros.h:158
#define IfNotFlag(LVAR, RVAR)
Marks the beginning of an if statement that only executes if the RVAR flag is unset on LVAR,...
Definition macros.h:292
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:254
#define PlayEffect(args...)
Definition macros.h:807
#define EndSwitch
Marks the end of a switch statement and any case.
Definition macros.h:362
#define IfEq(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR == RVAR.
Definition macros.h:269
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
Definition macros.h:576
#define ChildThread
Marks the start of a child thread block.
Definition macros.h:560
#define Loop(TIMES)
Marks the beginning of a loop.
Definition macros.h:245
#define LVar0
Definition macros.h:148
#define SetConst(VAR, CONST)
Sets the given variable to a given value, skipping the evt_get_variable call.
Definition macros.h:370
#define Return
Kills the current EVT thread.
Definition macros.h:217