Few questions
Re: Few questions
To workaround the shield protection issue you could implement custom onEquipItem and onUnequipItem hooks for the shield.
Re: Few questions
ah, didn't think of that, nice workaround
Finished Dungeons - complete mods to play
-
thermalburn
- Posts: 13
- Joined: Mon Dec 24, 2012 12:16 am
Re: Few questions
i've been trying to get it to work but unfortunatly my scripting experience is limited. Upon equiping the shield, my editor just crashes. Could you please take a look at my script and see what could be causing this?petri wrote:To workaround the shield protection issue you could implement custom onEquipItem and onUnequipItem hooks for the shield.
Code: Select all
cloneObject{
name = "tower_shield",
baseObject = "legionary_shield",
uiName = "Scutum",
evasion = 2,
protection = 2,
onEquipItem = function(champion,slot)
champion:modifyStat(protection,2)
end,
onUnequipItem = function(champion,slot)
champion:modifyStat(protection,-2)
end
}
Last edited by thermalburn on Fri Dec 28, 2012 1:31 am, edited 1 time in total.
Re: Few questions
you have to enclose strings with ' or "
eg.
champion:modifyStat('protection',2)
plain protection means a variable named protection.
eg.
champion:modifyStat('protection',2)
plain protection means a variable named protection.
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
- cloneObject viewtopic.php?f=22&t=8450
-
thermalburn
- Posts: 13
- Joined: Mon Dec 24, 2012 12:16 am
Re: Few questions
ah thank you. its no longer crashing, so that was the problem.
EDIT #2:
got it to work correctly. I just had to up the maxstat of the stat. Here is the code if anyone is interested.
EDIT #2:
got it to work correctly. I just had to up the maxstat of the stat. Here is the code if anyone is interested.
Code: Select all
cloneObject{
name = "tower_shield",
baseObject = "legionary_shield",
uiName = "Scutum",
evasion = 2,
protection = 2,
onEquipItem = function(champion,slot)
if slot == 7 then
champion:modifyStatCapacity("protection", 2)
champion:modifyStat("protection", 2)
elseif slot == 8 then
champion:modifyStatCapacity("protection", 2)
champion:modifyStat("protection", 2)
else
--do nothing
end
end,
onUnequipItem = function(champion,slot)
if slot == 7 then
champion:modifyStatCapacity("protection", -2)
champion:modifyStat("protection", -2)
elseif slot == 8 then
champion:modifyStatCapacity("protection", -2)
champion:modifyStat("protection", -2)
else
--do nothing
end
end,
}
