Simple Escape penalty script (Throw money to run away)

Watulio

Villager
Member
Joined
Dec 10, 2015
Messages
10
Reaction score
0
First Language
Spanish
Primarily Uses
Here's a simple script to get penalized money for escaping. The amount of money is equals to the addition of all the EXP given by each monster in a troop. 

To change it

#==============================================================================# # Simple Penalty for escape Script. (EXP for money)# #==============================================================================#==============================================================================# ■ Sprite_Battler#==============================================================================class Game_Unit #-------------------------------------------------------------------------- # * Calculate EXP #-------------------------------------------------------------------------- def exp return 1 if members.size == 0 members.inject(0) {|r, member| r += member.exp } endendmodule BattleManager #-------------------------------------------------------------------------- # * Create Escape Success Probability #-------------------------------------------------------------------------- def self.make_escape_ratio enemies_agi = $game_troop.exp @escape_ratio = enemies_agi end #-------------------------------------------------------------------------- # * Escape Processing #-------------------------------------------------------------------------- def self.process_escape $game_message.add(sprintf(Vocab::EscapeStart, $game_party.name)) if @preemptive success = true text = "But then you remember you weren't seen by the enemy!" $game_message.add('\.' + text) text = "So you flee!" $game_message.add('\.' + text) else if $game_party.gold >= @escape_ratio text = "You throw " + @escape_ratio.to_s + " gold and flee." $game_message.add('\.' + text) $game_party.lose_gold(@escape_ratio) success = true else text = "But you don't have enough gold to distract the enemy." $game_message.add('\.' + text) end end if success Sound.play_escape wait_for_message process_abort else @escape_ratio *= 0.9 $game_party.clear_actions end return success endendescapepenaltyscript.png
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
3,040
Reaction score
679
First Language
English
Primarily Uses
RMVXA
Tested and working. I can only assume that it is ok to use for commercial projects.

#==============================================================================#
# Simple Penalty for escape Script. (EXP for money)
#
#==============================================================================
#==============================================================================
#
Sprite_Battler
#==============================================================================
class Game_Unit
#--------------------------------------------------------------------------
# * Calculate EXP
#--------------------------------------------------------------------------
def exp
return 1 if members.size == 0
members.inject(0) {|r, member| r += member.exp }
end
end
module BattleManager
#--------------------------------------------------------------------------
# * Create Escape Success Probability
#--------------------------------------------------------------------------
def self.make_escape_ratio
enemies_agi = $game_troop.exp
@escape_ratio = enemies_agi
end
#--------------------------------------------------------------------------
# * Escape Processing
#--------------------------------------------------------------------------
def self.process_escape
$game_message.add(sprintf(Vocab::EscapeStart, $game_party.name))
if @preemptive
success = true
text = "But then you remember you weren't seen by the enemy!"
$game_message.add('\.' + text)
text = "So you flee!"
$game_message.add('\.' + text)
else
if $game_party.gold >= @escape_ratio
text = "You throw " + @escape_ratio.to_s + " gold and flee."
$game_message.add('\.' + text)
$game_party.lose_gold(@escape_ratio)
success = true
else
text = "But you don't have enough gold to distract the enemy."
$game_message.add('\.' + text)
end
end
if success
Sound.play_escape
wait_for_message
process_abort
else
@escape_ratio *= 0.9
$game_party.clear_actions
end
return success
end
end



Thanks
 

Latest Threads

Latest Posts

Latest Profile Posts

If you're a RM plugin developer, and you're reading this...

Thank you. You're awesome. Even if I haven't used your plugin, your work is appreciated.
Ami
tomorrow is the finale of my Endurance
2dfloor.png
What a fun tileset I've got here so far!
Minecraft Tiles, Maid Day, Custom Menu, Retry at GameOver, Save in Appdata | RPG Maker News #36

Forum statistics

Threads
111,264
Messages
1,059,684
Members
144,549
Latest member
Gladdie
Top