On-Map Enemies who retain their status?

oldbone

Veteran
Veteran
Joined
May 10, 2012
Messages
101
Reaction score
5
First Language
English
Primarily Uses
- 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!
 
Last edited by a moderator:

EternalShadow

Veteran
Veteran
Joined
Sep 16, 2012
Messages
5,781
Reaction score
1,041
First Language
English
Primarily Uses
Deletion of the event: 'end event' command.


How do you mean that the player can lose some battles? What is meant to happen?
 

oldbone

Veteran
Veteran
Joined
May 10, 2012
Messages
101
Reaction score
5
First Language
English
Primarily Uses
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). 
 

EternalShadow

Veteran
Veteran
Joined
Sep 16, 2012
Messages
5,781
Reaction score
1,041
First Language
English
Primarily Uses
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?
 

oldbone

Veteran
Veteran
Joined
May 10, 2012
Messages
101
Reaction score
5
First Language
English
Primarily Uses
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)
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
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.
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,359
Reaction score
7,672
First Language
German
Primarily Uses
RMMV
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.
 

oldbone

Veteran
Veteran
Joined
May 10, 2012
Messages
101
Reaction score
5
First Language
English
Primarily Uses
Awesome - thanks for the assistance. This gets me going in the right directions.

This thread can be closed!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c

Forum statistics

Threads
105,857
Messages
1,017,018
Members
137,563
Latest member
MinyakaAeon
Top