- Events are on the map, moving around
- These events can trigger a battle
- The player can lose some of these battles
My question:
- How can I script those events to "retain" the enemy troop status? (dead troop members, HP/MP levels, etc)? (is it even possible? far too complicated to even consider?)
Follow-up:
- Easy way to script the deletion of the event as well if the player wins the fight?
Thanks in advance!
On-Map Enemies who retain their status?
● ARCHIVED · READ-ONLY
-
-
Deletion of the event: 'end event' command.
How do you mean that the player can lose some battles? What is meant to happen? -
There are several "parties" on the map... and any of them can encounter a troop and lose to that troop... but I'd like the troop to retain its "status" (dead members, HP/MP levels, etc).
-
So you want the party to game over or return to a checkpoint, and when they get back to that point, for the troop's old stats to show?There are several "parties" on the map... and any of them can encounter a troop and lose to that troop... but I'd like the troop to retain its "status" (dead members, HP/MP levels, etc).
-
I can handle all the party management (no gameover, checkpoint, etc)
The thing I cannot handle is keeping the enemy troop status as it was when the party previously encountered that troop. (dead troop members, hp/mp/etc) -
When a battle is started, the battlemanager module calls $game_troops.setup, which clears out the array of enemies (under the Game_Troop script in the default scripts) it calls Game_enemy.new, which if you go under Game_Enemy and look at the initialize command, it sets the HP and MP to be equal to the maximum.
I think to override that you will need a way to store the current HP and MP of each enemy battler (include those that are zero as well, that should take care of the dead reviving problem), then override the Game_Enemy initialize command to use those variables under a certain condition (switch on, variable set to x, dunno but something it can check to override the default behavior).
This might get complicated, as I can see issues that may arise if the player saves their game after one battle they lost and tries again, as you will need a way to save this information also. Maybe one of our experienced scripters can tell you more, but just skimming how battles are initialized, that is what I see at least. -
Look for PK8's Self Data Suite. That script contains options to give self-variables to events, to troops and to enemies.
Since your troops are used multiple times, you'll have to define self-variables on events to store the current troop status.
Then before the battle processing command, you transfer those values into the troop variables (overwriting the values from last battles there)
As third step you'll need a troop event executed on turn 0 that checks the variables and changes the current enemies inside the battle according to those values.
The last part - saving the troop data after the battle - is even more tricky, as you'll need an event that is executed after the battle - you either need to trick the engine with a temporary immortal state or use a script that adds an "after battle" trigger.
It won't be easy to get all those self-variables working together, but it should be possible this way. -
Awesome - thanks for the assistance. This gets me going in the right directions.
This thread can be closed!