Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
SpyGuy.inc.c
Go to the documentation of this file.
1#include "SpyGuy.h"
2
4
5API_CALLABLE(N(SetSpyGuyInstigatorValue)) {
6 script->owner1.enemy->instigatorValue = 3;
7 return ApiStatus_DONE2;
8}
9
11
12EvtScript N(EVS_NpcDefeat_SpyGuyRock) = {
16 Call(SetSelfVar, 0, 5)
25 Return
26 End
27};
28
29MobileAISettings N(AISettings_SpyGuy) = {
30 .moveSpeed = 1.5f,
31 .moveTime = 60,
32 .waitTime = 15,
33 .alertRadius = 90.0f,
34 .alertOffsetDist = 50.0f,
35 .playerSearchInterval = 3,
36 .chaseSpeed = 3.8f,
37 .chaseTurnRate = 8,
38 .chaseUpdateInterval = 1,
39 .chaseRadius = 140.0f,
40 .chaseOffsetDist = 60.0f,
41 .unk_AI_2C = 1,
42};
43
44EvtScript N(EVS_NpcAI_SpyGuy) = {
45 Call(N(SetSpyGuyInstigatorValue))
46 Call(SetSelfVar, 0, 0)
47 Call(SetSelfVar, 1, 12)
48 Call(SetSelfVar, 2, 5)
49 Call(SetSelfVar, 3, 2)
50 Call(N(RangedAttackAI_Main), Ref(N(AISettings_SpyGuy)))
51 Return
52 End
53};
54
55NpcSettings N(NpcSettings_SpyGuy) = {
56 .height = 24,
57 .radius = 22,
58 .level = ACTOR_LEVEL_SPY_GUY,
59 .ai = &N(EVS_NpcAI_SpyGuy),
60 .onHit = &EnemyNpcHit,
61 .onDefeat = &EnemyNpcDefeat,
62};
63
64MobileAISettings N(AISettings_SpyGuyRock) = {
65 .moveSpeed = 8.0f,
66 .alertRadius = 4.0f,
67 .alertOffsetDist = 0.5f,
68 .playerSearchInterval = -1,
69};
70
71EvtScript N(EVS_NpcAI_SpyGuyRock_Projectile) = {
72 Call(SetSelfVar, 0, 0)
73 Call(SetSelfVar, 1, 0)
74 Call(SetSelfVar, 2, 12)
75 Call(SetSelfVar, 3, 13)
76 Call(N(ProjectileAI_Main), Ref(N(AISettings_SpyGuyRock)))
77 Return
78 End
79};
80
81EvtScript N(EVS_NpcAI_SpyGuyRock_Projectile_None) = {
82 Return
83 End
84};
85
86EvtScript N(EVS_NpcHit_SpyGuyRock) = {
87 Call(N(GetEncounterEnemyIsOwner))
88 IfEq(LVar0, 0)
89 Return
90 EndIf
91 Call(BindNpcAI, NPC_SELF, Ref(N(EVS_NpcAI_SpyGuyRock_Projectile_None)))
96 Call(SetSelfVar, 0, 3)
97 Call(N(ProjectileAI_Reflect))
98 IfEq(LVar0, 0)
99 Return
100 EndIf
104 Call(SetSelfVar, 0, 4)
106 PlayEffect(EFFECT_WALKING_DUST, 2, LVar0, LVar1, LVar2, 0, 0)
108 Call(SetSelfVar, 0, 0)
114 Call(BindNpcAI, NPC_SELF, Ref(N(EVS_NpcAI_SpyGuyRock_Projectile)))
115 Return
116 End
117};
118
119NpcSettings N(NpcSettings_SpyGuyRock) = {
120 .height = 7,
121 .radius = 7,
122 .ai = &N(EVS_NpcAI_SpyGuyRock_Projectile),
123 .onHit = &N(EVS_NpcHit_SpyGuyRock),
124 .onDefeat = &N(EVS_NpcDefeat_SpyGuyRock),
125 .actionFlags = AI_ACTION_08,
126};
Bytecode EvtScript[]
@ ENCOUNTER_TRIGGER_JUMP
Definition enums.h:269
@ ENCOUNTER_TRIGGER_HAMMER
Definition enums.h:271
@ ENCOUNTER_TRIGGER_PARTNER
Definition enums.h:273
@ ENCOUNTER_TRIGGER_SPIN
Definition enums.h:270
@ ENEMY_FLAG_FLED
Definition enums.h:4525
@ NPC_SELF
Definition enums.h:2526
@ OUTCOME_ENEMY_FLED
Definition enums.h:1905
@ OUTCOME_PLAYER_WON
Definition enums.h:1902
@ OUTCOME_PLAYER_FLED
Definition enums.h:1904
@ AI_ACTION_08
Definition enums.h:4615
#define ApiStatus_DONE2
Definition evt.h:118
s16 height
Definition npc.h:145
f32 moveSpeed
Definition npc.h:93
ApiStatus GetNpcPos(Evt *script, b32 isInitialCall)
EvtScript EnemyNpcDefeat
Definition encounter.c:158
ApiStatus SetEnemyFlagBits(Evt *script, b32 isInitialCall)
ApiStatus BindNpcAI(Evt *script, b32 isInitialCall)
EvtScript EnemyNpcHit
Definition encounter.c:131
ApiStatus RemoveNpc(Evt *script, b32 isInitialCall)
ApiStatus SetNpcPos(Evt *script, b32 isInitialCall)
ApiStatus GetOwnerEncounterTrigger(Evt *script, b32 isInitialCall)
ApiStatus OnPlayerFled(Evt *script, b32 isInitialCall)
ApiStatus SetBattleAsScripted(Evt *script, b32 isInitialCall)
ApiStatus SetSelfVar(Evt *script, b32 isInitialCall)
ApiStatus GetBattleOutcome(Evt *script, b32 isInitialCall)
#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 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 End
Signals the end of EVT script data. A script missing this will likely crash on load.
Definition macros.h:213
#define EndCaseGroup
Marks the end of a switch case group (CaseOrEq and/or CaseAndEq), stopping fallthrough.
Definition macros.h:352
#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 CaseDefault
Marks the start of a switch case that executes unconditionally. It also marks the end of any previous...
Definition macros.h:337
#define LVar2
Definition macros.h:150
#define LVar1
Definition macros.h:149
#define NPC_DISPOSE_LOCATION
Definition macros.h:158
#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 LVar0
Definition macros.h:148
#define Return
Kills the current EVT thread.
Definition macros.h:217