I wonder if someone can explain how to script an armor, which add a bonus to a skill of a champion when the armor is worn and remove the bonus when the armor is "unworn".
(unworn -> not wear, not sure if it is correct english!)
I'm trying to define a special armor,
which give + 10 in assassination, of course only for a ninja:
and it remove the 10 bonus if removed
I have try this one, but it always give + 10 in assassination and it keeps the value, any times it is worn
the (-) in the unequip function didnt change anything when I remove the armor
SpoilerShow
Code: Select all
defineObject{
name = "ninja_mail",
class = "Item",
uiName = "Shadow Armor",
model = "assets/models/items/lurker_clothes.fbx",
description = "Light, fine, strong, this armor suits for the best ninja.",
slot = "Torso",
armorSkill = "light_armor",
gfxIndex = 17,
gfxAtlas = "mod_assets/oliveitem/retexture/icone/oliveitem.tga",
protection = 12,
evasion = 10,
weight = 4.75,
onEquipItem = function(champion, slot)
if ( slot == 2 ) then
champion:trainSkill("assassination", 10, true)
end
end,
onUnequipItem = function(champion, slot)
if ( slot == 2 ) then
champion:trainSkill("assassination", -10, true)
end
end,
}