Updated follower script.

This commit is contained in:
Ariel Antonitis 2020-06-18 23:24:21 -04:00
parent b7a027dab6
commit 68ba615ab2
2 changed files with 30 additions and 11 deletions

View File

@ -13,6 +13,9 @@ gText_FollowerHasWetFeet::
gText_FollowerSplashesAround::
.string "{STR_VAR_1} splashes around happily!$"
gText_WantsToFly::
.string "{STR_VAR_1} looks adventurous.\nWould you like to use FLY?$"
.macro playfirstmoncry
callfunc ScrFunc_playfirstmoncry
.endm
@ -27,7 +30,18 @@ EventScript_Follower::
lock
faceplayer
callfunc ScrFunc_getfolloweraction
msgbox gText_FollowerDefault, MSGBOX_DEFAULT
checkpartymove MOVE_FLY
compare VAR_RESULT 6
goto_if_eq EventScript_FollowerEnd
bufferlivemonspeciesname 0
msgbox gText_WantsToFly, MSGBOX_YESNO
switch VAR_RESULT
case NO, EventScript_FollowerEnd
case YES, EventScript_FollowerFly
case MULTI_B_PRESSED, EventScript_FollowerEnd
EventScript_FollowerFly::
callfunc ScrFunc_followerfly
EventScript_FollowerEnd::
release
end
@ -36,8 +50,7 @@ EventScript_FollowerHasWetFeet::
playfirstmoncry
msgbox gText_FollowerHasWetFeet, MSGBOX_DEFAULT
waitmoncry
release
end
return
EventScript_FollowerSplashesAbout::
bufferlivemonspeciesname 0
@ -45,8 +58,7 @@ EventScript_FollowerSplashesAbout::
applymovement 0xFE FollowerSplashMovement
waitmovement 0xFE
msgbox gText_FollowerSplashesAround, MSGBOX_DEFAULT
release
end
return
EnterPokeballMovement::
.byte 0x9F @ EnterPokeball
@ -65,5 +77,4 @@ EventScript_FollowerLovesYou::
waitmoncry
bufferlivemonspeciesname 0
msgbox gText_FollowerLovesYou, MSGBOX_DEFAULT
release
end
return

View File

@ -21,6 +21,7 @@
#include "palette.h"
#include "pokemon.h"
#include "random.h"
#include "region_map.h"
#include "script.h"
#include "sprite.h"
#include "task.h"
@ -1679,23 +1680,30 @@ bool8 ScrFunc_getfolloweraction(struct ScriptContext *ctx) // Essentially a big
struct ObjectEvent *objEvent = &gObjectEvents[GetObjectEventIdByLocalIdAndMap(OBJ_EVENT_ID_FOLLOWER, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup)];
struct Pokemon *follower = GetFirstLiveMon();
if (follower == NULL) {
ScriptCall(ctx, EventScript_FollowerLovesYou);
return FALSE;
}
behavior = MapGridGetMetatileBehaviorAt(objEvent->currentCoords.x, objEvent->currentCoords.y);
species = GetMonData(follower, MON_DATA_SPECIES);
if (MetatileBehavior_IsPuddle(behavior) || MetatileBehavior_IsShallowFlowingWater(behavior)) {
if (gBaseStats[species].type1 == TYPE_FIRE || gBaseStats[species].type2 == TYPE_FIRE) {
ScriptJump(ctx, EventScript_FollowerHasWetFeet);
ScriptCall(ctx, EventScript_FollowerHasWetFeet);
return FALSE;
} else if (GetObjectEventGraphicsInfo(objEvent->graphicsId)->tracks) { // if follower leaves tracks
ScriptJump(ctx, EventScript_FollowerSplashesAbout);
ScriptCall(ctx, EventScript_FollowerSplashesAbout);
return FALSE;
}
}
if (GetCurrentWeather() == WEATHER_RAIN || GetCurrentWeather() == WEATHER_RAIN_THUNDERSTORM) {
ScriptJump(ctx, EventScript_FollowerLovesYou);
ScriptCall(ctx, EventScript_FollowerLovesYou);
}
ScriptJump(ctx, EventScript_FollowerLovesYou);
// SetMainCallback2(CB2_OpenFlyMap);
ScriptCall(ctx, EventScript_FollowerLovesYou);
return FALSE;
}
bool8 ScrFunc_followerfly(struct ScriptContext *ctx) {
SetMainCallback2(CB2_OpenFlyMap);
return FALSE;
}