09-06-2005, 01:00 PM
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
No support is given. If you are the owner of the thread, please contact administration.
Does:
Doubles and items, weapons or armors effect for a given character
Allows un-necessary items to be used (potion when hp is max etc...)
Messes with:
Game_Battler
Game_Party
Creds to:
GoldenShadow
Anaxim
Requested by:
Anaxim
script
Code:
#Favorie item, weapon and armor system by jimme reashu
#you may remove all comment except these top ones.
#Credit to: GoldenShadow and Anaxim
#Requested by:Anaxim
#V These are the comments you may remove^-^ V
#Check the
#return[numb,numb]
#lines and change them to the id of the favvo item
#It uses arrays so you can have several favorites of each type
#To show the favorite use:
#favorite=$game_party.favorite(type,actornumber)
# draw_item_name(favorit[0], 92, 32 * 0)
#that would draw the first favorite of the chosen type
#Important! actornumber starts at 1 for the first hero!
#the @increase is the effective % 100 is normal 200 is double etc.
#That's about it
#Note: it does NOT double elemental resistance etc. only atk, pdef, mdef, eva, hp_recov and sp_recov
#Note 2: this script allows you to use for example potions even when not needed.
#just as a small bonus, pm me if you want it removed^-^
class Game_Party
attr_accessor:increase
def favorite(type, actor)
@increase = 200 #change this value to what you want.
case type
when 0
if actor == 1
return [1,3]
elsif actor == 2
return [2,3]
elsif actor = 3
return [4,3]
elsif actor = 4
return [5,3]
end
when 1
if actor == 1
return [1,3]
elsif actor == 2
return [5,3]
elsif actor = 3
return [9,3]
elsif actor = 4
return [13,3]
end
when 2
if actor == 1
return [1,3]
elsif actor == 2
return [1,3]
elsif actor = 3
return [1,3]
elsif actor = 4
return [1,3]
end
end
end
end
class Game_Battler
attr_accessor:actor_id
def item_effect(item)
@increase=$game_party.increase
self.critical = false
if ((item.scope == 3 or item.scope == 4) and self.hp == 0) #or
return false
end
effective = false
effective |= item.common_event_id > 0
hit_result = (rand(100) < item.hit)
effective |= item.hit < 100
if hit_result == true
favo=$game_party.favorite(0,self.actor_id).include?(item.id)
recover_hp = maxhp * item.recover_hp_rate / 100 + item.recover_hp
recover_hp =(recover_hp*@increase)/100 if favo
recover_sp = maxsp * item.recover_sp_rate / 100 + item.recover_sp
recover_sp =(recover_sp*@increase)/100 if favo
if recover_hp < 0
recover_hp += self.pdef * item.pdef_f / 20
recover_hp += self.mdef * item.mdef_f / 20
recover_hp = [recover_hp, 0].min
end
recover_hp *= elements_correct(item.element_set)
recover_hp /= 100
recover_sp *= elements_correct(item.element_set)
recover_sp /= 100
if item.variance > 0 and recover_hp.abs > 0
amp = [recover_hp.abs * item.variance / 100, 1].max
recover_hp += rand(amp+1) + rand(amp+1) - amp
end
if item.variance > 0 and recover_sp.abs > 0
amp = [recover_sp.abs * item.variance / 100, 1].max
recover_sp += rand(amp+1) + rand(amp+1) - amp
end
if recover_hp < 0
if self.guarding?
recover_hp /= 2
end
end
self.damage = -recover_hp
last_hp = self.hp
last_sp = self.sp
self.hp += recover_hp
self.sp += recover_sp
effective |= recover_hp != 0
effective |= recover_sp != 0
@state_changed = false
effective |= item.plus_state_set != []
effective |= item.minus_state_set != []
if item.parameter_type > 0 and item.parameter_points != 0
case item.parameter_type
when 1
@maxhp_plus += item.parameter_points
when 2
@maxsp_plus += item.parameter_points
when 3
@str_plus += item.parameter_points
when 4
@dex_plus += item.parameter_points
when 5
@agi_plus += item.parameter_points
when 6
@int_plus += item.parameter_points
end
effective = true
end
if item.recover_hp_rate == 0 and item.recover_hp == 0
self.damage = ""
if item.recover_sp_rate == 0 and item.recover_sp == 0 and
(item.parameter_type == 0 or item.parameter_points == 0)
unless @state_changed
self.damage = "No Effect"
end
end
end
else
self.damage = "Miss"
end
unless $game_temp.in_battle
self.damage = nil
end
return effective
end
def base_atk
@increase=$game_party.increase
favo=$game_party.favorite(1,self.actor_id).include?(@weapon_id)
weapon = $data_weapons[@weapon_id]
at=weapon.atk if weapon != nil
at =(at*@increase)/100 if favo
return weapon != nil ? at : 0
end
def base_pdef
@increase=$game_party.increase
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
def1 = weapon != nil ? weapon.pdef : 0
def2 = armor1 != nil ? armor1.pdef : 0
def3 = armor2 != nil ? armor2.pdef : 0
def4 = armor3 != nil ? armor3.pdef : 0
def5 = armor4 != nil ? armor4.pdef : 0
favo=$game_party.favorite(1,self.actor_id).include?(@weapon_id)
def1 =(def1*@increase)/100 if favo
favo=$game_party.favorite(1,self.actor_id).include?(@armor1_id)
def2 =(def2*@increase)/100 if favo
favo=$game_party.favorite(1,self.actor_id).include?(@armor2_id)
def3 =(def3*@increase)/100 if favo
favo=$game_party.favorite(1,self.actor_id).include?(@armor3_id)
def4 =(def4*@increase)/100 if favo
favo=$game_party.favorite(1,self.actor_id).include?(@armor4_id)
def5 =(def5*@increase)/100 if favo
return def1 + def2 + def3 + def4 + def5
end
def base_mdef
@increase=$game_party.increase
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
def1 = weapon != nil ? weapon.mdef : 0
def2 = armor1 != nil ? armor1.mdef : 0
def3 = armor2 != nil ? armor2.mdef : 0
def4 = armor3 != nil ? armor3.mdef : 0
def5 = armor4 != nil ? armor4.mdef : 0
favo=$game_party.favorite(1,self.actor_id).include?(@weapon_id)
def1 =(def1*@increase)/100 if favo
favo=$game_party.favorite(1,self.actor_id).include?(@armor1_id)
def2 =(def2*@increase)/100 if favo
favo=$game_party.favorite(1,self.actor_id).include?(@armor2_id)
def3 =(def3*@increase)/100 if favo
favo=$game_party.favorite(1,self.actor_id).include?(@armor3_id)
def4 =(def4*@increase)/100 if favo
favo=$game_party.favorite(1,self.actor_id).include?(@armor4_id)
def5 =(def5*@increase)/100 if favo
return def1 + def2 + def3 + def4 + def5
end
def base_eva
@increase=$game_party.increase
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
eva1 = armor1 != nil ? armor1.eva : 0
eva2 = armor2 != nil ? armor2.eva : 0
eva3 = armor3 != nil ? armor3.eva : 0
eva4 = armor4 != nil ? armor4.eva : 0
favo=$game_party.favorite(1,self.actor_id).include?(@armor1_id)
eva1=(eva1*@increase)/100 if favo
favo=$game_party.favorite(1,self.actor_id).include?(@armor2_id)
eva2 =(eva2*@increase)/100 if favo
favo=$game_party.favorite(1,self.actor_id).include?(@armor3_id)
eva3 =(eva3*@increase)/100 if favo
favo=$game_party.favorite(1,self.actor_id).include?(@armor4_id)
eva4 =(eva4*@increase)/100 if favo
return eva1 + eva2 + eva3 + eva4
end
end
Version 2
Code:
#Favorie item, weapon and armor system by jimme reashu
#you may remove all comment except these top ones.
#Credit to: GoldenShadow and Anaxim
#Requested by:Anaxim
#V These are the comments you may remove^-^ V
#Important! actornumber starts at 1 for the first hero!
#Note: it does NOT double elemental resistance etc. only atk, pdef, mdef, eva, hp_recov and sp_recov
#Note 2: this script allows you to use for example potions even when not needed.
#just as a small bonus, pm me if you want it removed^-^
class Game_Party
attr_accessor:increase
def favorite(type,index,actor)
if @favvo != true
for i in 1..$game_actors.size
for j in 1..1500
@favorite[i][j]=100
end
end
#here you put what favorites/dislikes a character has. for items it's
#@favorite[actor id in database starts at 1][item id in database starts at 1] = effective %#100 is normal, 200 is double etc.
#for weapons
#@favorite[actor id in database starts at 1][weapon id in database starts at 1 +500] = effective %
#for armors
#@favorite[actor id in database starts at 1][armor id in database starts at 1 +1000] = effective %
@favvo=true
end
return @favorite[actor][index]*1.0 / 100
end
end
class Game_Battler
attr_accessor:actor_id
def item_effect(item)
@increase=$game_party.increase
self.critical = false
if ((item.scope == 3 or item.scope == 4) and self.hp == 0) #or
return false
end
effective = false
effective |= item.common_event_id > 0
hit_result = (rand(100) < item.hit)
effective |= item.hit < 100
if hit_result == true
recover_hp = maxhp * item.recover_hp_rate / 100 + item.recover_hp
recover_hp *=@favorite[self.actor_id][item.id])
recover_sp = maxsp * item.recover_sp_rate / 100 + item.recover_sp
recover_sp *=@favorite[self.actor_id][item.id])
if recover_hp < 0
recover_hp += self.pdef * item.pdef_f / 20
recover_hp += self.mdef * item.mdef_f / 20
recover_hp = [recover_hp, 0].min
end
recover_hp *= elements_correct(item.element_set)
recover_hp /= 100
recover_sp *= elements_correct(item.element_set)
recover_sp /= 100
if item.variance > 0 and recover_hp.abs > 0
amp = [recover_hp.abs * item.variance / 100, 1].max
recover_hp += rand(amp+1) + rand(amp+1) - amp
end
if item.variance > 0 and recover_sp.abs > 0
amp = [recover_sp.abs * item.variance / 100, 1].max
recover_sp += rand(amp+1) + rand(amp+1) - amp
end
if recover_hp < 0
if self.guarding?
recover_hp /= 2
end
end
self.damage = -recover_hp
last_hp = self.hp
last_sp = self.sp
self.hp += recover_hp
self.sp += recover_sp
effective |= recover_hp != 0
effective |= recover_sp != 0
@state_changed = false
effective |= item.plus_state_set != []
effective |= item.minus_state_set != []
if item.parameter_type > 0 and item.parameter_points != 0
case item.parameter_type
when 1
@maxhp_plus += item.parameter_points
when 2
@maxsp_plus += item.parameter_points
when 3
@str_plus += item.parameter_points
when 4
@dex_plus += item.parameter_points
when 5
@agi_plus += item.parameter_points
when 6
@int_plus += item.parameter_points
end
effective = true
end
if item.recover_hp_rate == 0 and item.recover_hp == 0
self.damage = ""
if item.recover_sp_rate == 0 and item.recover_sp == 0 and
(item.parameter_type == 0 or item.parameter_points == 0)
unless @state_changed
self.damage = "No Effect"
end
end
end
else
self.damage = "Miss"
end
unless $game_temp.in_battle
self.damage = nil
end
return effective
end
def base_atk
@increase=$game_party.increase
weapon = $data_weapons[@weapon_id]
at=weapon.atk if weapon != nil
at *=@favorite[@actor_id][weapon.id+500])
return weapon != nil ? at : 0
end
def base_pdef
@increase=$game_party.increase
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
def1 = weapon != nil ? weapon.pdef : 0
def2 = armor1 != nil ? armor1.pdef : 0
def3 = armor2 != nil ? armor2.pdef : 0
def4 = armor3 != nil ? armor3.pdef : 0
def5 = armor4 != nil ? armor4.pdef : 0
def1 *=@favorite[self.actor_id][weapon_id+500])
def2 *=@favorite[self.actor_id][armor1_id+1000])
def3 *=@favorite[self.actor_id][armor2_id+1000])
def4 *=@favorite[self.actor_id][armor3_id+1000])
def5 *=@favorite[self.actor_id][armor4_id+1000])
return def1 + def2 + def3 + def4 + def5
end
def base_mdef
@increase=$game_party.increase
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
def1 = weapon != nil ? weapon.mdef : 0
def2 = armor1 != nil ? armor1.mdef : 0
def3 = armor2 != nil ? armor2.mdef : 0
def4 = armor3 != nil ? armor3.mdef : 0
def5 = armor4 != nil ? armor4.mdef : 0
def1 *=@favorite[self.actor_id][weapon_id+500])
def2 *=@favorite[self.actor_id][armor1_id+1000])
def3 *=@favorite[self.actor_id][armor2_id+1000])
def4 *=@favorite[self.actor_id][armor3_id+1000])
def5 *=@favorite[self.actor_id][armor4_id+1000])
return def1 + def2 + def3 + def4 + def5
end
def base_eva
@increase=$game_party.increase
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
eva1 = armor1 != nil ? armor1.eva : 0
eva2 = armor2 != nil ? armor2.eva : 0
eva3 = armor3 != nil ? armor3.eva : 0
eva4 = armor4 != nil ? armor4.eva : 0
eva1 *=@favorite[self.actor_id][armor1_id+1000])
eva2 *=@favorite[self.actor_id][armor2_id+1000])
eva3 *=@favorite[self.actor_id][armor3_id+1000])
eva4 *=@favorite[self.actor_id][armor4_id+1000])
return eva1 + eva2 + eva3 + eva4
end
end
have fun