[SOLVED] Equip Items to Remove Conditions
Posted: Fri May 11, 2018 6:04 pm
hi modders,
That's it, as very few people are aware, I'm creating a mod that stays pretty big with a certain number of components. It will be 3 years that I try to finish it (at least try to get it out
) and it will also be 3 years that I discovered the script, because at the base, I knew absolutely nothing about it, so it was a total discovery for me. I thank the developers, Skuggasveinn and other players/modders who allowed me to learn more and improve on the editors and scripts...
But in short, this is not the subject of the day (or not yet...
), I am exploiting most of the functions of the game and it's been a while since I'm stuck with a particular function.
To put it simply, when the party receives the negative condition "cold", they must be equipped with light or heavy armor to remove the condition. I thought that the function will be rather simple and oddly, when I do it rightly, nothing happens and the condition has still not been removed from the party.
For the moment, I'm just trying to make it work with light armors, but no need to go further, if I can not even get it working! What puzzles me is that all light armor logically have the feature "light_armor" and therefore should make it work...
Someone has an explanation or answer due to this problem?
That's it, as very few people are aware, I'm creating a mod that stays pretty big with a certain number of components. It will be 3 years that I try to finish it (at least try to get it out
But in short, this is not the subject of the day (or not yet...
To put it simply, when the party receives the negative condition "cold", they must be equipped with light or heavy armor to remove the condition. I thought that the function will be rather simple and oddly, when I do it rightly, nothing happens and the condition has still not been removed from the party.
Code: Select all
defineObject{
name = "party",
baseObject = "party",
components = {
{
class = "Party",
onReceiveCondition = function(self, champion, condition)
local helmet = champion:getItem(ItemSlot.Head)
local cuirass = champion:getItem(ItemSlot.Chest)
local cuisse = champion:getItem(ItemSlot.Legs)
local greaves = champion:getItem(ItemSlot.Feet)
if condition == "cold" then
if (helmet and helmet:hasTrait("light_armor")) and
(cuirass and cuirass:hasTrait("light_armor")) and
(cuisse and cuisse:hasTrait("light_armor")) and
(greaves and greaves:hasTrait("light_armor")) then
champion:removeCondition("cold")
end
end
end,
},
},
editorIcon = 32,
placement = "floor",
}
Someone has an explanation or answer due to this problem?