03-15-2009, 01:21 PM
I highlighted the changes in red, maybe you made some error replacing the old code with the new one.
Are you getting an error? When?
You need a different script, this one can't do it (now) :D
Just out of curiosity, why do you need something like this?
CODE
def gain_weapon(weapon_id, n, slots=nil)
#print("gain weapon("+weapon_id.to_s+","+n.to_s+")")
# arma e non nessun arma
if weapon_id > 0
# l'arma appartiene al database
if weapon_id < @max_database_weapon_id + 1
# l'arma è di tipo enhanceable
if $data_weapons[weapon_id].element_set.include?($ew_element_id)
if n>0
for i in 1..n
new_weapon=Enhanced_Weapon.new(weapon_id)
if slots!=nil
for i in 0...[new_weapon.slots,slots.length].min
new_weapon.add_accessory(i,$data_weapons[slots[i]])
end
end
@enhanced_weapons[new_weapon.id]=new_weapon
$data_weapons[new_weapon.id]=new_weapon
@weapons[new_weapon.id] = 1
# Patch for GUILLAUME777's Multi-Slot
if MULTI_SLOT_PATCH
RPG.initialized_item_types=false
RPG.set_new_item_types
end
end
return
else
# print("non si può togliere un'arma enhanced perchè non se ne entra mai in possesso")
return
end
end
# l'arma è di tipo enhanced
else
@weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min
return
end
end
ew_gain_weapon(weapon_id, n)
end
#print("gain weapon("+weapon_id.to_s+","+n.to_s+")")
# arma e non nessun arma
if weapon_id > 0
# l'arma appartiene al database
if weapon_id < @max_database_weapon_id + 1
# l'arma è di tipo enhanceable
if $data_weapons[weapon_id].element_set.include?($ew_element_id)
if n>0
for i in 1..n
new_weapon=Enhanced_Weapon.new(weapon_id)
if slots!=nil
for i in 0...[new_weapon.slots,slots.length].min
new_weapon.add_accessory(i,$data_weapons[slots[i]])
end
end
@enhanced_weapons[new_weapon.id]=new_weapon
$data_weapons[new_weapon.id]=new_weapon
@weapons[new_weapon.id] = 1
# Patch for GUILLAUME777's Multi-Slot
if MULTI_SLOT_PATCH
RPG.initialized_item_types=false
RPG.set_new_item_types
end
end
return
else
# print("non si può togliere un'arma enhanced perchè non se ne entra mai in possesso")
return
end
end
# l'arma è di tipo enhanced
else
@weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min
return
end
end
ew_gain_weapon(weapon_id, n)
end
Are you getting an error? When?
Quote:How do I make it so that when the enhancement is removed, it is gone forever + a confirmation window for it?
You need a different script, this one can't do it (now) :D
Just out of curiosity, why do you need something like this?