I'm working on a game, and I want to make it that if the main character dies in combat, you get a game over. The only issue is that I don't know how to go about doing this, and was wondering if I could get some help? I'm using VXAce
VXAce Unit dies triggers game over
RPG Maker VXAce SupportIf by "main character" you mean the leader of the team/party, or protagonist, you will need to define a condition in the final boss battle:
Now, if you're creating an event-based battle and want to define a condition for defeating the boss, but the battle ends with a specific character downed, you'll need to create that in the event:
Now, if you're creating an event-based battle and want to define a condition for defeating the boss, but the battle ends with a specific character downed, you'll need to create that in the event:
My goal isn't to just make it one specific battle, but rather every single encounter, if one specific character dies it's a game over, even if it's just like some random rat you encounter walking around
You'll probably have to create a script that overrides the battle_members function in Game_Party
Maybe this will work for you, since I didn't understand if it's to check the leader or a specific actor, I put both options.
Maybe this will work for you, since I didn't understand if it's to check the leader or a specific actor, I put both options.
Ruby:
module BattleManager
# 0 to check if the party LEADER
# 1 or higher to check a specific ACTOR
SELECT = 0
class << self
alias judge_win_loss_ori judge_win_loss
def judge_win_loss
actor_slt = SELECT > 0 ? $game_actors[SELECT] : $game_party.members[0]
if actor_slt.dead?
process_defeat
else
judge_win_loss_ori
end
end
end
end
Thanks! I'll give that a shot when I next work on it and let you know if it worked out
THIS ONE WORKED
I DIDN'T EVEN REALIZE WHAT YOU MEANT BECAUSE I GOT CONFUSED,THANK YOU SO MUCH!!!But with the script I created, you won't need to create it in every battle.
I have two questions regarding this script:
- Can I borrow it too? If yes, whose name should I credit (both the script and the person)?
- Does the script support a definition like this?
Ruby:
SELECT = $game_variables[n]
That script call WON'T work because $game_variables has not been created until you can see the title scene on screen.
As kyonides said, this check is only done when the game starts.
You can modify it during the game like this:
And with that, you can still use it with Conditional Branch:
You can modify it during the game like this:
@Script: BattleManager::SELECT = 3And with that, you can still use it with Conditional Branch:
That's perfect, thank you.
If you still prefer, I can modify the script to work directly with a game variable, so you can use it on event pages
Well, I didn't intent on having you modify the script since it wasn't created for me originally but I won't say no if you feel like it. If you do modify, add a turn off call too please.
Again, don't feel obligated, I can work around with setting to a debug actor when the effect is not needed and using
Again, don't feel obligated, I can work around with setting to a debug actor when the effect is not needed and using
@> Script: BattleManager::SELECT = nto change the actor being checked depending on the story sequence the player is in.I believe this works. I declared these
Edit: Fixed
module variables with these names to avoid conflicts with other scripts that modify BattleManager.Edit: Fixed
Ruby:
module BattleManager
# Choose an existing variable to modify during the game
# which character falling will cause a Game Over
#
JWL_VAR = 1 # Variable: Value 0=Leader; Value 1 or greater=Actor ID on Database
JWL_SWT = 1 # Switch: To turn the script on and off
class << self
alias judge_win_loss_ori judge_win_loss
def judge_win_loss
var_value = $game_variables[JWL_VAR]
actor_slt = var_value > 0 ? $game_actors[var_value] : $game_party.members[0]
if actor_slt.dead? && $game_switches[JWL_SWT]
process_defeat
else
judge_win_loss_ori
end
end
end
end
This works! I tried multiple database test battles (with changing the value of the switch and variable each time) and it works exactly as intended, even with my other battle scripts. The only issue I had is the "The party lost." message showing up twice but I'm pretty sure it's related to my game over common event.
Edit: The issue doesn't appear in a new project so the script works perfectly.
Edit: The issue doesn't appear in a new project so the script works perfectly.
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
Original thread: https://forums.rpgmakerweb.com/threads/unit-dies-triggers-game-over.181766/