Yes, you have to put it in the "Script" command, that is the general idea. There are other ways to achieve this but this one is - in my opinion - the most intuitive.
FF1-like escape system help
RPG Maker VXAce SupportWhere would you recommend setting the variable? At the first command in the common event, or a separate common event that autoruns at the start of the game, or what?
If you are talking about the variable to store each character escape chance I recommend doing it as soon as the game starts. If it changes later on you can of course modify its value but setting it up at the beginning of the game is a way to make sure that you do not try to modify something that does not exist later - thus it is safer.
If you want to do something more advanced you could even store a different escape formula for each actor based on that actor stats - for example you could use AGI so the faster the character the higher his/her escape chances. The script call changes a bit but the good point about this is the you do not have to edit the formula multiple times later on. As soon as a certain actor stats increase his/her escape chances increase as well.
If you want to do something more advanced you could even store a different escape formula for each actor based on that actor stats - for example you could use AGI so the faster the character the higher his/her escape chances. The script call changes a bit but the good point about this is the you do not have to edit the formula multiple times later on. As soon as a certain actor stats increase his/her escape chances increase as well.
Thanks, all sorted out. I should mention, for the sake of others trying to do a similar thing, that there was a bug where the random number generated was always 100 with the "rand(100)" command, but I got around it by making another variable, and starting at the start of the battle, every moment it sets the variable to a new random number, and the command changed to
"...$game_variables[(Escape chance variable)] > $game_variables[(random %chance variable))] ..." , but that works, and I will be sure to put both of your RPGMaker Forums usernames in the credits of the game.
"...$game_variables[(Escape chance variable)] > $game_variables[(random %chance variable))] ..." , but that works, and I will be sure to put both of your RPGMaker Forums usernames in the credits of the game.
Did you try doing this?
Code:
r = rand(100)
$game_party.each.with_index do |m, i|
if m.state?(your_escape_state_id)
BattleManager.process_escape if (r < $game_variables[your_var_id][i-1])
end
end
Yes, I couldn't figure it out, but what I have now is awesome, I'm quite happy with it. Also, whenever I need a random number, I can call on that variable.
Original thread: https://forums.rpgmakerweb.com/threads/ff1-like-escape-system-help.106236/