- Joined
- Feb 14, 2015
- Messages
- 5,643
- Solutions
- 559
- Reaction score
- 3,949
inside of data/events/scripts/creature.lua (make sure onChangeOutfit is set to 1 in events.xml)
inside of data/creaturescripts/scripts/login.lua (inside the onLogin function)
how to configure: (i already created two bonuses for citizen and hunter outfits as an example)
the ID should be different for each bonus, so the script can identify between conditions
in my example i started from 1 for citizen bonus and used 2 for hunter, if you were to continue you would go 3, 4, 5, etc.
parameters should be inside a table, {param = some_condition_param, value = value_to_set}
here are the available condition params for tfs 1.2:
Lua:
function createBonusCondition(id, params)
local condition = Condition(CONDITION_ATTRIBUTES, CONDITIONID_DEFAULT)
condition:setParameter(CONDITION_PARAM_TICKS, -1)
condition:setParameter(CONDITION_PARAM_SUBID, id)
for i = 1, #params do
local param = params[i].param
local value = params[i].value
condition:setParameter(param, value)
end
return condition
end
outfitBonuses = {
[{128, 136}] = createBonusCondition(1, {
{param = CONDITION_PARAM_STAT_MAGICPOINTS, value = 10},
{param = CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT, value = 110}
}
),
[{129, 137}] = createBonusCondition(2, {
{param = CONDITION_PARAM_STAT_MAXMANAPOINTSPERCENT, value = 200}
}
)
}
function getBonusCondition(outfit)
for outfits, bonus in pairs(outfitBonuses) do
if table.contains(outfits, outfit) then
return bonus
end
end
return nil
end
function Creature:onChangeOutfit(outfit)
if not self:isPlayer() then
return true
end
local previousBonusCondition = getBonusCondition(self:getOutfit().lookType)
local newBonusCondition = getBonusCondition(outfit.lookType)
if previousBonusCondition then
self:removeCondition(CONDITION_ATTRIBUTES, CONDITIONID_DEFAULT, previousBonusCondition:getSubId())
end
if newBonusCondition then
self:addCondition(newBonusCondition)
end
return true
end
inside of data/creaturescripts/scripts/login.lua (inside the onLogin function)
Lua:
-- Outfit bonus
local bonusCondition = getBonusCondition(player:getOutfit().lookType)
if bonusCondition then
player:addCondition(bonusCondition)
end
how to configure: (i already created two bonuses for citizen and hunter outfits as an example)
Lua:
outfitBonuses = {
[{male outfit id, female outfit id}] = createBonusCondition(ID, parameters & values)
}
in my example i started from 1 for citizen bonus and used 2 for hunter, if you were to continue you would go 3, 4, 5, etc.
parameters should be inside a table, {param = some_condition_param, value = value_to_set}
here are the available condition params for tfs 1.2:
Code:
CONDITION_PARAM_OWNER
CONDITION_PARAM_TICKS
CONDITION_PARAM_HEALTHGAIN
CONDITION_PARAM_HEALTHTICKS
CONDITION_PARAM_MANAGAIN
CONDITION_PARAM_MANATICKS
CONDITION_PARAM_DELAYED
CONDITION_PARAM_SPEED
CONDITION_PARAM_LIGHT_LEVEL
CONDITION_PARAM_LIGHT_COLOR
CONDITION_PARAM_SOULGAIN
CONDITION_PARAM_SOULTICKS
CONDITION_PARAM_MINVALUE
CONDITION_PARAM_MAXVALUE
CONDITION_PARAM_STARTVALUE
CONDITION_PARAM_TICKINTERVAL
CONDITION_PARAM_FORCEUPDATE
CONDITION_PARAM_SKILL_MELEE
CONDITION_PARAM_SKILL_FIST
CONDITION_PARAM_SKILL_CLUB
CONDITION_PARAM_SKILL_SWORD
CONDITION_PARAM_SKILL_AXE
CONDITION_PARAM_SKILL_DISTANCE
CONDITION_PARAM_SKILL_SHIELD
CONDITION_PARAM_SKILL_FISHING
CONDITION_PARAM_STAT_MAXHITPOINTS
CONDITION_PARAM_STAT_MAXMANAPOINTS
CONDITION_PARAM_STAT_SOULPOINTS
CONDITION_PARAM_STAT_MAGICPOINTS
CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT
CONDITION_PARAM_STAT_MAXMANAPOINTSPERCENT
CONDITION_PARAM_STAT_SOULPOINTSPERCENT
CONDITION_PARAM_STAT_MAGICPOINTSPERCENT
CONDITION_PARAM_PERIODICDAMAGE
CONDITION_PARAM_SKILL_MELEEPERCENT
CONDITION_PARAM_SKILL_FISTPERCENT
CONDITION_PARAM_SKILL_CLUBPERCENT
CONDITION_PARAM_SKILL_SWORDPERCENT
CONDITION_PARAM_SKILL_AXEPERCENT
CONDITION_PARAM_SKILL_DISTANCEPERCENT
CONDITION_PARAM_SKILL_SHIELDPERCENT
CONDITION_PARAM_SKILL_FISHINGPERCENT
CONDITION_PARAM_BUFF_SPELL
CONDITION_PARAM_SUBID
CONDITION_PARAM_FIELD