Dilio
Owner of Project Thala
Requested by a bunch of people in: http://otland.net/f132/need-bonus-system-addon-help-64200/
Basically, what it does, is if you have the addons of the specified outfit, you will get bonuses, more explained in the request thread.
First register it as:
And here's the script:
If there's a cleaner more organized way to code it, be my guest. Also, it does not include every outfit, just what was requested by that thread starter.
This was the most annoying script I have ever written, and it easily took an hour to script, so please, if you plan on using it, some rep wouldn't hurt.
I tested with 0.3.6PL1 and it worked fine.
P.S In order to edit this, I'd recommend having at least a bit of LUA knowledge before attempting.
Edit: Credits to Hellboy for the fix and rewrite of the script.
Edit 2: Credits to Chojrak for sorting this out:
If you want to get extremely simple, using Outfits.xml you can just put something like:
FINAL EDIT: CREDIT TO HELLBOY FOR THE LATEST SCRIPT
Basically, what it does, is if you have the addons of the specified outfit, you will get bonuses, more explained in the request thread.
First register it as:
Lua:
<event type="outfit" name="Addons" event="script" value="outfits.lua"/>
<event type="login" name="AddonsLogin" event="script" value="outfits.lua"/>
And here's the script:
Lua:
local hunter = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(hunter, CONDITION_PARAM_TICKS, -1)
setConditionParam(hunter, CONDITION_PARAM_SKILL_DISTANCE, 3)
local knight = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(knight, CONDITION_PARAM_TICKS, -1)
setConditionParam(knight, CONDITION_PARAM_SKILL_SWORD, 3)
local mage = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(mage, CONDITION_PARAM_TICKS, -1)
setConditionParam(mage, CONDITION_PARAM_STAT_MAGICLEVEL, 2)
local barbarian = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(barbarian, CONDITION_PARAM_TICKS, -1)
setConditionParam(barbarian, CONDITION_PARAM_SKILL_AXE, 3)
local norse = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(norse, CONDITION_PARAM_TICKS, -1)
setConditionParam(norse, CONDITION_PARAM_SKILL_SHIELD, 2)
setConditionParam(norse, CONDITION_PARAM_STAT_MAXHEALTH, 200) --- hp
local nightmare = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(nightmare, CONDITION_PARAM_TICKS, -1)
setConditionParam(nightmare, CONDITION_PARAM_SKILL_SHIELD, 3)
setConditionParam(nightmare, CONDITION_PARAM_STAT_MAXHEALTH, 100) --- hp
local yalaharian = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(yalaharian, CONDITION_PARAM_TICKS, -1)
setConditionParam(yalaharian, CONDITION_PARAM_STAT_MAGICLEVEL, 2)
setConditionParam(yalaharian, CONDITION_PARAM_STAT_MAXHEALTH, 200) --- hp
setConditionParam(yalaharian, CONDITION_PARAM_STAT_MAXMANA, 200) --- mana
local demonhunter = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(demonhunter, CONDITION_PARAM_TICKS, -1)
setConditionParam(demonhunter, CONDITION_PARAM_STAT_MAXHEALTH, 500) --- hp
setConditionParam(demonhunter, CONDITION_PARAM_STAT_MAXMANA, 500) -- mana
local brotherhood = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(brotherhood, CONDITION_PARAM_TICKS, -1)
setConditionParam(brotherhood, CONDITION_PARAM_STAT_MAXHEALTH, 200) --- hp
local hpmana100 = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(hpmana100, CONDITION_PARAM_TICKS, -1)
setConditionParam(hpmana100, CONDITION_PARAM_STAT_MAXHEALTH, 100) --- hp
setConditionParam(hpmana100, CONDITION_PARAM_STAT_MAXMANA, 100) --- mana
local hpmana200 = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(hpmana200, CONDITION_PARAM_TICKS, -1)
setConditionParam(hpmana200, CONDITION_PARAM_STAT_MAXHEALTH, 200) --- hp
setConditionParam(hpmana200, CONDITION_PARAM_STAT_MAXMANA, 200) --- mana
local mana100 = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(mana100, CONDITION_PARAM_TICKS, -1)
setConditionParam(mana100, CONDITION_PARAM_STAT_MAXMANA, 100) --- mana
local mana200 = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(mana200, CONDITION_PARAM_TICKS, -1)
setConditionParam(mana200, CONDITION_PARAM_STAT_MAXMANA, 200) --- mana
local hp100 = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(hp100, CONDITION_PARAM_TICKS, -1)
setConditionParam(hp100, CONDITION_PARAM_STAT_MAXHEALTH, 100) --- hp
local speed1 = createConditionObject(CONDITION_HASTE)
setConditionParam(speed1, CONDITION_PARAM_TICKS, -1)
setConditionParam(speed1, CONDITION_PARAM_SPEED, 10)
local speed2 = createConditionObject(CONDITION_HASTE)
setConditionParam(speed2, CONDITION_PARAM_TICKS, -1)
setConditionParam(speed2, CONDITION_PARAM_SPEED, 20)
--- CONDITION_PARAM_STAT_MAXHEALTH, CONDITION_PARAM_STAT_MAXMANA
--- CONDITION_PARAM_BUFF
outfitBonusTable = { --- [] = {condition = , typ = }
[128] = {condition = {speed1, hp100}, typ = {CONDITION_HASTE, CONDITION_ATTRIBUTES}}, [136] = {condition = {speed1, hp100}, typ = {CONDITION_HASTE, CONDITION_ATTRIBUTES}}, --Citizen --[maxHealth = 100]
[129] = {condition = hunter}, [137] = {condition = hunter}, --Hunter
[130] = {condition = mana200, typ = CONDITION_ATTRIBUTES}, [138] = {condition = mana200, typ = CONDITION_ATTRIBUTES}, --Mage
[131] = {condition = knight, typ = CONDITION_ATTRIBUTES}, [139] = {condition = knight, typ = CONDITION_ATTRIBUTES}, --Knight
[133] = {condition = mana100, typ = CONDITION_ATTRIBUTES}, [141] = {condition = mana100, typ = CONDITION_ATTRIBUTES}, --Summoner -- [maxMana = 100]
[134] = {condition = knight, typ = CONDITION_ATTRIBUTES}, [142] = {condition = knight, typ = CONDITION_ATTRIBUTES}, --Warrior
[143] = {condition = barbarian, typ = CONDITION_ATTRIBUTES}, [147] = {condition = barbarian, typ = CONDITION_ATTRIBUTES}, --Barbarian
[144] = {condition = mage, typ = CONDITION_ATTRIBUTES}, [148] = {condition = mage, typ = CONDITION_ATTRIBUTES}, --Druid
[145] = {condition = {hpmana100}, typ = CONDITION_ATTRIBUTES}, [149] = {condition = {hpmana100}, typ = CONDITION_ATTRIBUTES}, --Wizard --[maxHealth = 100, maxMana = 100]
[146] = {condition = {speed1, hpmana200}, typ = {CONDITION_HASTE, CONDITION_ATTRIBUTES}}, [150] = {condition = {speed1, hpmana200}, typ = {CONDITION_HASTE, CONDITION_ATTRIBUTES}}, --Oriental --[maxHealth = 200, maxMana = 200]
[152] = {condition = speed2, typ = CONDITION_HASTE}, [156] = {condition = speed2, typ = CONDITION_HASTE}, --Assassin
[154] = {condition = mage, typ = CONDITION_ATTRIBUTES}, [158] = {condition = mage, typ = CONDITION_ATTRIBUTES}, --Shaman
[251] = {condition = norse, typ = CONDITION_ATTRIBUTES}, [252] = {condition = norse, typ = CONDITION_ATTRIBUTES}, --Norse [maxHealth = 200]
[268] = {condition = nightmare, typ = CONDITION_ATTRIBUTES}, [269] = {condition = nightmare, typ = CONDITION_ATTRIBUTES}, --Nightmare --[maxHealth = 100]
[270] = {condition = {speed1, hpmana100}, typ = {CONDITION_HASTE, CONDITION_ATTRIBUTES}}, [273] = {condition = {speed1, hpmana100}, typ = {CONDITION_HASTE, CONDITION_ATTRIBUTES}}, --Jester --[maxHealth = 100, maxMana = 100]
[278] = {condition = brotherhood, typ = CONDITION_ATTRIBUTES}, [279] = {condition = brotherhood, typ = CONDITION_ATTRIBUTES}, --Brotherhood -- [maxHealth = 200]
[288] = {condition = speed2, typ = CONDITION_HASTE}, [289] = {condition = speed2, typ = CONDITION_HASTE}, --Demonhunter --[maxHealth = 500, maxMana = 500]
[324] = {condition = yalaharian, typ = CONDITION_ATTRIBUTES}, [325] = {condition = yalaharian, typ = CONDITION_ATTRIBUTES} --Yalaharian -- [maxHealth = 200, maxMana = 200]
}
function onLogin(cid)
registerCreatureEvent(cid, "Addons")
--- local current = getCreatureOutfit(cid)
return onOutfit(cid, {lookAddons = 1}, getCreatureOutfit(cid)) and true
end
function onOutfit(cid, old, current)
if getPlayerAccess(cid) >= 3 then
return print("Staff/support can't get any addon bonus!") and true
end
if old.lookAddons == 3 and outfitBonusTable[old.lookType] then --Bonus off
if (outfitBonusTable[old.lookType]).typ ~= nil then
if type((outfitBonusTable[old.lookType]).typ) == "table" then
for _, value in pairs((outfitBonusTable[old.lookType]).typ) do
doRemoveCondition(cid, value)
end
else
doRemoveCondition(cid, (outfitBonusTable[old.lookType]).typ)
end
end
end
if current.lookAddons == 3 and outfitBonusTable[current.lookType] then --Bonus on
if (outfitBonusTable[current.lookType]).condition ~= nil then
if type((outfitBonusTable[current.lookType]).condition) == "table" then
for _, value in pairs((outfitBonusTable[current.lookType]).condition) do
doAddCondition(cid, value)
end
else
doAddCondition(cid, (outfitBonusTable[current.lookType]).condition)
end
end
end
return true
end
If there's a cleaner more organized way to code it, be my guest. Also, it does not include every outfit, just what was requested by that thread starter.
This was the most annoying script I have ever written, and it easily took an hour to script, so please, if you plan on using it, some rep wouldn't hurt.
I tested with 0.3.6PL1 and it worked fine.
P.S In order to edit this, I'd recommend having at least a bit of LUA knowledge before attempting.
Edit: Credits to Hellboy for the fix and rewrite of the script.
Edit 2: Credits to Chojrak for sorting this out:
If you want to get extremely simple, using Outfits.xml you can just put something like:
Lua:
<outfit id="2">
<list gender="0" lookType="137" name="Hunter"/>
<skill dist="3"/>
</list>
<list gender="1" lookType="129" name="Hunter"/>
<skill dist="4"/>
</list>
</outfit>
FINAL EDIT: CREDIT TO HELLBOY FOR THE LATEST SCRIPT
Last edited: