S
Shadow_
Guest
YesDo you have onChangeOutfit set toenabled="1"
in events.xml?
YesDo you have onChangeOutfit set toenabled="1"
in events.xml?
<mount id="33" clientid="521" name="Crimson Ray" speed="20" premium="yes" />
Thanks working good, if someone want to also use it add this(line 9) in the function onChangeOutfit(outfit) so the regeneration will not be permament
Code: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()) self:removeCondition(CONDITION_REGENERATION, CONDITIONID_DEFAULT, previousBonusCondition:getSubId()) <-- This line end if newBonusCondition then self:addCondition(newBonusCondition) end return true end
i wrote about that go and add regen condition and alsoDo you have onChangeOutfit set toenabled="1"
in events.xml?
self:removeCondition(CONDITION_HASTE, CONDITIONID_DEFAULT, previousBonusCondition:getSubId())
data/creaturescripts/scripts/login.lua:39: attempt to call global 'getBonusCondition' (a nil value)
stack traceback:
[C]: in function 'getBonusCondition'
data/creaturescripts/scripts/login.lua:39: in function <data/creaturescripts/scripts/login.lua:1>
i need to relog with the especific addon in order to get the bonus, how can i make this work just by changing the outfit ingame?
btw this is working g8 with 1.3
--[[
addions[1] = no addons
addons[2] = 1st addon unlocked
addons[3] = 2nd addon unlocked
]]--
OUTFIT_BONUSES = {
{116, 117} = {id = 1, -- +1 each id for new outfits
addons = {[1] = nil, [2] = {CONDITION_MAGICLEVELPOINT, 5}, [3] = {CONDITION_HASTE, 25}}
},
{118, 119} = {id = 2,
addons = {[1] = nil, [2] = {CONDITION_MAGICLEVELPOINT, 5}, [3] = {CONDITION_HASTE, 25}}
}
}
function getBonusOutfit(outfit)
for i, v in pairs(OUTFIT_BONUSES) do
if outfit == i then
return OUTFIT_BONUSES[i]
end
end
return false
end
function createBonusCondition(bonus, addon)
local condition = Condition(CONDITION_ATTRIBUTES, CONDITIONID_DEFAULT)
condition:setParameter(CONDITION_PARAM_TICKS, -1)
condition:setParameter(CONDITION_PARAM_SUBID, bonus.id)
for x = 1, addon do
for i = 1, #bonus.addons[x] do
local param = bonus.addons[x][1]
local value = bonus.addons[x][2]
condition:setParameter(param, value)
end
end
return condition
end
function getBonusOutfitID(outfit)
for outfits, bonus in pairs(OUTFIT_BONUSES) do
if table.contains(outfits, outfit) then
return bonus.id
end
end
return nil
end
function Creature:onChangeOutfit(outfit)
if not self:isPlayer() then
return true
end
local previousBonusCondition = getBonusOutfitID(self:getOutfit().lookType)
if previousBonusCondition then
self:removeCondition(CONDITION_ATTRIBUTES, CONDITIONID_DEFAULT, previousBonusCondition)
end
local bonusOutfit = getBonusOutfit(outfit)
if bonusOutfit then
local addons = 1
if self:canWearOutfit(outfit, 2) then
addons = 3
elseif self:canWearOutfit(outfit, 1) then
addons = 2
end
local newBonusCondition = createBonusCondition(bonusOutfit, addons)
if newBonusCondition then
self:addCondition(newBonusCondition)
end
end
return true
end
inside of data/events/scripts/creature.lua (make sure onChangeOutfit is set to 1 in events.xml)
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)
the ID should be different for each bonus, so the script can identify between conditionsLua: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
can you help me please, i put your script maybe im wrong, i made a lib in data/libThis should let you do it with different bonuses for different addons. You need to change the code a bit though.
Create a lib file data/lib
Lua:--[[ addions[1] = no addons addons[2] = 1st addon unlocked addons[3] = 2nd addon unlocked ]]-- OUTFIT_BONUSES = { {116, 117} = {id = 1, -- +1 each id for new outfits addons = {[1] = nil, [2] = {CONDITION_MAGICLEVELPOINT, 5}, [3] = {CONDITION_HASTE, 25}} }, {118, 119} = {id = 2, addons = {[1] = nil, [2] = {CONDITION_MAGICLEVELPOINT, 5}, [3] = {CONDITION_HASTE, 25}} } } function getBonusOutfit(outfit) for i, v in pairs(OUTFIT_BONUSES) do if outfit == i then return OUTFIT_BONUSES[i] end end return false end function createBonusCondition(bonus, addon) local condition = Condition(CONDITION_ATTRIBUTES, CONDITIONID_DEFAULT) condition:setParameter(CONDITION_PARAM_TICKS, -1) condition:setParameter(CONDITION_PARAM_SUBID, bonus.id) for x = 1, addon do for i = 1, #bonus.addons[x] do local param = bonus.addons[x][1] local value = bonus.addons[x][2] condition:setParameter(param, value) end end return condition end function getBonusOutfitID(outfit) for outfits, bonus in pairs(OUTFIT_BONUSES) do if table.contains(outfits, outfit) then return bonus.id end end return nil end
Then in data/events/creature onChangeOutfit
Lua:function Creature:onChangeOutfit(outfit) if not self:isPlayer() then return true end local previousBonusCondition = getBonusOutfitID(self:getOutfit().lookType) if previousBonusCondition then self:removeCondition(CONDITION_ATTRIBUTES, CONDITIONID_DEFAULT, previousBonusCondition) end local bonusOutfit = getBonusOutfit(outfit) if bonusOutfit then local addons = 1 if self:canWearOutfit(outfit, 2) then addons = 3 elseif self:canWearOutfit(outfit, 1) then addons = 2 end local newBonusCondition = createBonusCondition(bonusOutfit, addons) if newBonusCondition then self:addCondition(newBonusCondition) end end return true end
> Loading lua libs
This should let you do it with different bonuses for different addons. You need to change the code a bit though.
Create a lib file data/lib
Lua:--[[ addions[1] = no addons addons[2] = 1st addon unlocked addons[3] = 2nd addon unlocked ]]-- OUTFIT_BONUSES = { {116, 117} = {id = 1, -- +1 each id for new outfits addons = {[1] = nil, [2] = {CONDITION_MAGICLEVELPOINT, 5}, [3] = {CONDITION_HASTE, 25}} }, {118, 119} = {id = 2, addons = {[1] = nil, [2] = {CONDITION_MAGICLEVELPOINT, 5}, [3] = {CONDITION_HASTE, 25}} } } function getBonusOutfit(outfit) for i, v in pairs(OUTFIT_BONUSES) do if outfit == i then return OUTFIT_BONUSES[i] end end return false end function createBonusCondition(bonus, addon) local condition = Condition(CONDITION_ATTRIBUTES, CONDITIONID_DEFAULT) condition:setParameter(CONDITION_PARAM_TICKS, -1) condition:setParameter(CONDITION_PARAM_SUBID, bonus.id) for x = 1, addon do for i = 1, #bonus.addons[x] do local param = bonus.addons[x][1] local value = bonus.addons[x][2] condition:setParameter(param, value) end end return condition end function getBonusOutfitID(outfit) for outfits, bonus in pairs(OUTFIT_BONUSES) do if table.contains(outfits, outfit) then return bonus.id end end return nil end
Then in data/events/creature onChangeOutfit
Lua:function Creature:onChangeOutfit(outfit) if not self:isPlayer() then return true end local previousBonusCondition = getBonusOutfitID(self:getOutfit().lookType) if previousBonusCondition then self:removeCondition(CONDITION_ATTRIBUTES, CONDITIONID_DEFAULT, previousBonusCondition) end local bonusOutfit = getBonusOutfit(outfit) if bonusOutfit then local addons = 1 if self:canWearOutfit(outfit, 2) then addons = 3 elseif self:canWearOutfit(outfit, 1) then addons = 2 end local newBonusCondition = createBonusCondition(bonusOutfit, addons) if newBonusCondition then self:addCondition(newBonusCondition) end end return true end
__picif = {}
OUTFIT_BONUSES = {
{116, 117} = {
id = 1,
addons = {
[1] = nil,
[2] = {CONDITION_MAGICLEVELPOINT, 5},
[3] = {CONDITION_HASTE, 25}
},
},
{118, 119} = {
id = 2,
addons = {
[1] = nil,
[2] = {CONDITION_MAGICLEVELPOINT, 5},
[3] = {CONDITION_HASTE, 25}
},
},
}
function getBonusOutfit(outfit)
for i, v in pairs(OUTFIT_BONUSES) do
if outfit == i then
return OUTFIT_BONUSES[i]
end
end
return false
end
function createBonusCondition(bonus, addon)
local condition = Condition(CONDITION_ATTRIBUTES, CONDITIONID_DEFAULT)
condition:setParameter(CONDITION_PARAM_TICKS, -1)
condition:setParameter(CONDITION_PARAM_SUBID, bonus.id)
for x = 1, addon do
for i = 1, #bonus.addons[x] do
local param = bonus.addons[x][1]
local value = bonus.addons[x][2]
condition:setParameter(param, value)
end
end
return condition
end
function getBonusOutfitID(outfit)
for outfits, bonus in pairs(OUTFIT_BONUSES) do
if table.contains(outfits, outfit) then
return bonus.id
end
end
return nil
end
function Creature:onChangeOutfit(outfit)
if not self:isPlayer() then
return true
end
local previousBonusCondition = getBonusOutfitID(self:getOutfit().lookType)
if previousBonusCondition then
self:removeCondition(CONDITION_ATTRIBUTES, CONDITIONID_DEFAULT, previousBonusCondition)
end
local bonusOutfit = getBonusOutfit(outfit)
if bonusOutfit then
local addons = 1
if self:canWearOutfit(outfit, 2) then
addons = 3
elseif self:canWearOutfit(outfit, 1) then
addons = 2
end
local newBonusCondition = createBonusCondition(bonusOutfit, addons)
if newBonusCondition then
self:addCondition(newBonusCondition)
end
end
return true
end
OUTFIT_BONUSES = {
[{116, 117}] = {
id = 1,
addons = {
[1] = nil,
[2] = {CONDITION_MAGICLEVELPOINT, 5},
[3] = {CONDITION_HASTE, 25}
}
},
[{118, 119}] = {
id = 2,
addons = {
[1] = nil,
[2] = {CONDITION_MAGICLEVELPOINT, 5},
[3] = {CONDITION_HASTE, 25}
}
}
}
as for only for full outfit?inside of data/events/scripts/creature.lua (make sure onChangeOutfit is set to 1 in events.xml)
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)
the ID should be different for each bonus, so the script can identify between conditionsLua: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
ites good scripts and work fineinside of data/events/scripts/creature.lua (make sure onChangeOutfit is set to 1 in events.xml)
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)
the ID should be different for each bonus, so the script can identify between conditionsLua: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
Justites good scripts and work fine
i have added it in outfits xml
female
<outfit type="0" looktype="126" name="Legend" premium="0" unlocked="1" enabled="1" />
male
<outfit type="1" looktype="127" name="Legend" premium="0" unlocked="1" enabled="1" />
But I encountered a problem that all players can use this addons legend
I want to make it special for those who don't have Legend addon and will get it by in-game purchase to enjoy its features
Please help and thanks in advance
unlocked="1"
unlocked="0"
is it possible to modify this script so that the player earns the bonus with the amount of addons he has complete regardless of which addon it is?inside of data/events/scripts/creature.lua (make sure onChangeOutfit is set to 1 in events.xml)
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)
the ID should be different for each bonus, so the script can identify between conditionsLua: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
everything is possible if you try hard enoughis it possible to modify this script so that the player earns the bonus with the amount of addons he has complete regardless of which addon it is?
example:
I have 2 full addons Citizen and Hunter I will get +5 Magic Level.
the other player has Beggar and Jester he will also get +5 Magic Level.
He doesn't need to be using that addon to receive the bonus, just have the full addon.