Short form: I'm using Yanfly Event spawn code and need to attach a number to an event, as well as save 2 variables based on the assigned number attached to the event.
Long Form:
At the moment, my big project is a strategy game that takes place on the world maps. Each unit is handled as an even on the map and the "player" is the cursor. Unit types are stored on a seperate map and copied to the map using the Yanfly Event Spawn code.
When an attack command is ordered on an enemy unit, the attacking unit is added to the player party and the enemy unit is treated as the monster for combat, so health and mp for the unit needs to stored as a variable so that it can carry over between fights and between player 1 and 2 changing as the current active player.
So my two questions are:
Is there a way I can store a variable directly on the event so that the first unit built will be 1, the second will be 2, etc or is there some trick my tired brain has overlooked? If units were pre-made, I could just assign each unit a static number, but because units can be built, I'm not sure how to "stick" a number to a unit.
Can I use that ID number to determine which Variable slots will be used to store the HP and MP of the unit, eg. the unit with ID 32 will save its HP to slot 64 and MP to slot 65? Right now, it seems like If I wanted to do that, I'd have to generate potentially 100 branched statements (due to 50 pop cap and each unit storing 2 values) which is a little more event coding then I'd like.
I hope this is enough information, its a bit of a complex system I'm trying to implement and writing up a breakdown of how the whole thing will work would be kind of intense. If more info or screenshots are needed, just ask and I'll provide and thank you in advance for the help.
Long Form:
At the moment, my big project is a strategy game that takes place on the world maps. Each unit is handled as an even on the map and the "player" is the cursor. Unit types are stored on a seperate map and copied to the map using the Yanfly Event Spawn code.
When an attack command is ordered on an enemy unit, the attacking unit is added to the player party and the enemy unit is treated as the monster for combat, so health and mp for the unit needs to stored as a variable so that it can carry over between fights and between player 1 and 2 changing as the current active player.
So my two questions are:
Is there a way I can store a variable directly on the event so that the first unit built will be 1, the second will be 2, etc or is there some trick my tired brain has overlooked? If units were pre-made, I could just assign each unit a static number, but because units can be built, I'm not sure how to "stick" a number to a unit.
Can I use that ID number to determine which Variable slots will be used to store the HP and MP of the unit, eg. the unit with ID 32 will save its HP to slot 64 and MP to slot 65? Right now, it seems like If I wanted to do that, I'd have to generate potentially 100 branched statements (due to 50 pop cap and each unit storing 2 values) which is a little more event coding then I'd like.
I hope this is enough information, its a bit of a complex system I'm trying to implement and writing up a breakdown of how the whole thing will work would be kind of intense. If more info or screenshots are needed, just ask and I'll provide and thank you in advance for the help.