WeAreSuperhero
Sponsor
Could someone have a go at adapting Calderons On-Map regeneration script so that when you move, you lose a certain amount of SP but when you stand still you regenerate, as before in the script? So it's basically the same except that the regeneration only happens when you aren't moving and you lose a certain amount when you do move.
I can't really offer anything in return, but it would be a very nice thing to do and I imagine it wouldn't take that long to do. This would be for everyone in the party, as before.
Code:
#==============================================================================
# On Map Regeneration Script v. 1.07
# by Caldaron (11.09.2006)
#==============================================================================
# DESCRIPTIONS
#==============================================================================
#--------------------------------------------------------------------------
# USE_MAPS: when true: Regeneration is enabled, except for REG_MAPS
# when false: Regeneration is only for REG_MAPS enabled
# REG_MAPS: insert the Map_IDs where Regeneration is enabled/disabled
# HP/SP_WAIT: time to Wait until HP/SP recovers, will be divided by MAXHP/SP
# should be Limit of MAXHP/MAXSP
# HP/SP_REG: the Value of HP/SP Regeneration
# HP/SP_PERCENT: when true: the Value of HP/SP_REG changes to its meant Percentage
# HP/SP_MOD: the Percentage of HP/SP Recovery (1. Value contains 1. Actor's Percentage)
# 0 means no Regeneration
# !!NUMBER OF VALUES MUST BE EQUAL THE NUMBER OF ACTORS!!
# HP/SP_STOP: insert the State IDs which prevent the Actor to recover HP/SP
# insert all State IDs which marked 'Regard as HP 0'
# to prevent the Actor to Raise from Dead
#
# to change the actor's regenerate speed, use:
# $game_system.hp_mod[actor.id-1] = value
#--------------------------------------------------------------------------
#==============================================================================
module Regenerate
USE_MAPS = true
REG_MAPS = []
HP_WAIT = 9999
SP_WAIT = 9999
HP_REG = 0
SP_REG = 5
HP_PERCENT = false
SP_PERCENT = false
HP_STOP = [1]
SP_STOP = [1]
end
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
attr_accessor :hp_mod
attr_accessor :sp_mod
#--------------------------------------------------------------------------
alias system_reg_init initialize
def initialize
@hp_mod = [100, 100, 100, 100, 100, 100, 100, 100]
@sp_mod = [100, 100, 100, 100, 100, 100, 100, 100]
system_reg_init
end
#--------------------------------------------------------------------------
end
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
alias map_reg_init initialize
def initialize
@hp_wait = [0,0,0,0,0,0,0,0] # !!NUMBER OF VALUES MUST BE EQUAL THE NUMBER OF ACTORS!!
@sp_wait = [0,0,0,0,0,0,0,0] # !!NUMBER OF VALUES MUST BE EQUAL THE NUMBER OF ACTORS!!
map_reg_init
end
#--------------------------------------------------------------------------
alias map_reg_update update
def update
for actor in $game_party.actors
i = actor.id
i -= 1
@actor = actor
@hp_wait[i] -= 1
@sp_wait[i] -= 1
if Regenerate::USE_MAPS and not Regenerate::REG_MAPS.include?(@map_id) or
(Regenerate::USE_MAPS == false and Regenerate::REG_MAPS.include?(@map_id))
if @hp_wait[i] < 1
@actor.hp_reg
if Regenerate::HP_PERCENT
@hp_wait[i] = Regenerate::HP_WAIT/(@actor.maxhp * (@actor.maxhp/(Regenerate::HP_REG*100)) * ($game_system.hp_mod[i]/100.00))
else
@hp_wait[i] = Regenerate::HP_WAIT/(@actor.maxhp * Regenerate::HP_REG * ($game_system.hp_mod[i]/100.00))
end
end
if @sp_wait[i] < 1
@actor.sp_reg
if @actor.maxsp != 0
if Regenerate::HP_PERCENT
@sp_wait[i] = Regenerate::SP_WAIT/(@actor.maxsp * (@actor.maxsp/(Regenerate::SP_REG*100)) * ($game_system.sp_mod[i]/100.00))
else
@sp_wait[i] = Regenerate::SP_WAIT/(@actor.maxsp * Regenerate::SP_REG * ($game_system.sp_mod[i]/100.00))
end
end
end
end
end
map_reg_update
end
#--------------------------------------------------------------------------
end
#==============================================================================
class Game_Actor
#--------------------------------------------------------------------------
def stop_reg(type)
case type
when 0
for i in Regenerate::HP_STOP
if self.state?(i)
return true
end
end
when 1
for i in Regenerate::SP_STOP
if self.state?(i)
return true
end
end
end
return false
end
#--------------------------------------------------------------------------
def hp_reg
i = -1 + id
@mod = $game_system.hp_mod[i]
if not self.stop_reg(0) and not (@mod == 0 or @mod == nil)
self.hp += 1
end
self.hp = Integer([self.hp, self.maxhp].min)
end
#--------------------------------------------------------------------------
def sp_reg
i = -1 + id
@mod = $game_system.sp_mod[i]
if not self.stop_reg(1) and not (@mod == 0 or @mod == nil)
self.sp += 1
end
self.sp = Integer([self.sp, self.maxsp].min)
end
#--------------------------------------------------------------------------
end
I can't really offer anything in return, but it would be a very nice thing to do and I imagine it wouldn't take that long to do. This would be for everyone in the party, as before.