Before you read any further, I am not looking for how to use switches or Self Switches. This is different.
Hi. For ages I've been developing the ABS for my game. It's all evented, and works perfectly, but I have one problem. A problem that I think can be solved pretty easily with scripts. All of my enemy events are set up so as to read where the actor is in realation to the enemy event through variables. Then when the player fires a gun (it's a shooting game) the enemy will react differently depending on which gun. That all works. Then it checks the enemies health, and if it is bellow a certain variable, the enemy dies. Now here's my problem. This works really well, but it means each enemy must have a unique set of variables for each, so that all the enemies don't die at once. Are you with me so far? Ok.
What I want to know is is there a way with the script part of Conditional Branch to make the same variable store different numbers depending on the event it is being used in? I've tried, and this is what I've come up with, but it doesn't work:
A script entry at the top of the event page says
Name_Of_Event =
$game_map.events[@event_id].event.name
Then the eventing I have already done follows where it checks for what gun is equiped and how far away the player is, ect. Then when the player is in range and fire the gun, I tried the script input
$game_variables[14+Name_Of_Event.to_i] =
$game_variables[14+Name_Of_Event.to_i]
-7
Variable 14 is the enemies health. Then underneath that in the event page it says
Conditional Branch Script
$game_variables[14+Name_Of_Event] <= 20
The enemies event vanishes after there is a falling animation and it flashes. Basically.
So, what am I doing wrong? Can it even be done? Please help.
Thanks,
Fox
Hi. For ages I've been developing the ABS for my game. It's all evented, and works perfectly, but I have one problem. A problem that I think can be solved pretty easily with scripts. All of my enemy events are set up so as to read where the actor is in realation to the enemy event through variables. Then when the player fires a gun (it's a shooting game) the enemy will react differently depending on which gun. That all works. Then it checks the enemies health, and if it is bellow a certain variable, the enemy dies. Now here's my problem. This works really well, but it means each enemy must have a unique set of variables for each, so that all the enemies don't die at once. Are you with me so far? Ok.
What I want to know is is there a way with the script part of Conditional Branch to make the same variable store different numbers depending on the event it is being used in? I've tried, and this is what I've come up with, but it doesn't work:
A script entry at the top of the event page says
Name_Of_Event =
$game_map.events[@event_id].event.name
Then the eventing I have already done follows where it checks for what gun is equiped and how far away the player is, ect. Then when the player is in range and fire the gun, I tried the script input
$game_variables[14+Name_Of_Event.to_i] =
$game_variables[14+Name_Of_Event.to_i]
-7
Variable 14 is the enemies health. Then underneath that in the event page it says
Conditional Branch Script
$game_variables[14+Name_Of_Event] <= 20
The enemies event vanishes after there is a falling animation and it flashes. Basically.
So, what am I doing wrong? Can it even be done? Please help.
Thanks,
Fox