• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

CreatureEvent Addon "Bonus System"

Ok ok... Going to explain it better... What you have to do is quite simple...

Using Jester and Oriental... You change to Jester full then Oriental full, then you tick one outfit addon, and relog, you change to jester full and then to oriental full and make the same, the difference is 100 hp or mp extra (i dont know this case, just a known bug)...

I saw druids level 150+ with 11k HP xD

Which one isn't stable?
hellboy or thread author? Or both?
 
#Hermes#
Code:
                        local addonCondition = createConditionObject(CONDITION_ATTRIBUTES)
                        setConditionParam(addonCondition, CONDITION_PARAM_TICKS, -1)
                        setConditionParam(addonCondition, ((outfitBonusTable[old.lookType]).condition)[1], ((outfitBonusTable[old.lookType]).condition)[2])
                        doAddCondition(cid, addonCondition)

I think, that I maked this befor you post xS Look to mine 1 post in this thread. xS
 

Well, I tested it and had no issues, so I apologize. I will not be fixing it because it just took way too much work. You can just add an onLogout function to check if they have the outfit, and then subtract it. I will not be updating this script.
 
The idea is good, but the script is so buggy... If you put an outfit that adds 200 HP and then change to an oufit that adds 100 HP, your HP will be 100+ without any outfit... So, you can have unlimited HP.
 
The idea is good, but the script is so buggy... If you put an outfit that adds 200 HP and then change to an outfit that adds 100 HP, your HP will be 100+ without any outfit... So, you can have unlimited HP.

No your wrong, did you look at the script?
The other IF's are executed even when you change the outfit and when the buffs are applied. So it will add 100hp and then remove 200hp.
 
Ok my shortened version is a big fail xS
Hermes have right. I will try fix it.

Code:
[05/03/2010 21:47:42] [Error - CreatureScript Interface] 
[05/03/2010 21:47:42] data/creaturescripts/scripts/RPG/addons.lua:onOutfit
[05/03/2010 21:47:42] Description: 
[05/03/2010 21:47:42] (luaCreateConditionObject) This function can only be used while loading the script.
 
1. It will be work ONLY IN 0.3.6 or higher version
2. It won't work correct for players with acces 3 or higher
3. Tested, for me work perfect

PHP:
	<event type="outfit" name="Addons" event="script" value="addons.lua"/>
	<event type="login" name="AddonLogin" event="script" value="addonlogin.lua"/>
addonlogin.lua
Lua:
dofile('data/creaturescripts/scripts/addons.lua')
function onLogin(cid)
	registerCreatureEvent(cid, "Addons")
	local oldOutfit = getCreatureOutfit(cid)
	
	if (oldOutfit.lookAddons ~= 3) or (outfitBonusTable[oldOutfit.lookType] == nil) or ((outfitBonusTable[oldOutfit.lookType]).condition == nil) then
		return true
	end
	doAddCondition(cid, (outfitBonusTable[oldOutfit.lookType]).condition)
	return true
end

addons.lua
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)

local nightmare = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(norse, CONDITION_PARAM_TICKS, -1)
setConditionParam(norse, CONDITION_PARAM_SKILL_SHIELD, 3)

outfitBonusTable = { --- [] = {condition = , maxHealth = , maxMana = ,changeSpeed = }
	[128] = {maxHealth = 100, changeSpeed = 10}, [136] = {maxHealth = 100, changeSpeed = 10}, --Citizen
	[129] = {condition = hunter}, [137] = {condition = hunter}, --Hunter
	[130] = {maxMana = 200}, [138] = {maxMana = 200}, --Mage
	[131] = {condition = knight}, [139] = {condition = knight}, --Knight
	[133] = {maxMana = 100}, [141] = {maxMana = 100}, --Summoner
	[134] = {condition = knight}, [142] = {condition = knight}, --Warrior
	[143] = {condition = barbarian}, [147] = {condition = barbarian}, --Barbarian
	[144] = {condition = mage}, [148] = {condition = mage}, --Druid
	[145] = {maxHealth = 100, maxMana = 100}, [149] = {maxHealth = 100, maxMana = 100}, --Wizard
	[146] = {maxHealth = 200, maxMana = 200, changeSpeed = 10}, [150] = {maxHealth = 200, maxMana = 200, changeSpeed = 10}, --Oriental
	[152] = {changeSpeed = 20}, [156] = {changeSpeed = 20}, --Assassin
	[154] = {condition = mage}, [158] = {condition = mage}, --Shaman
	[251] = {condition = norse, maxHealth = 200}, [252] = {condition = norse, maxHealth = 200}, --Norse
	[268] = {condition = nightmare, maxHealth = 100}, [269] = {condition = nightmare, maxHealth = 100}, --Nightmare
	[270] = {maxHealth = 100, maxMana = 100, changeSpeed = 10}, [273] = {maxHealth = 100, maxMana = 100, changeSpeed = 10}, --Jester
	[278] = {maxHealth = 200}, [279] = {maxHealth = 200}, --Brotherhood
	[288] = {maxHealth = 500, maxMana = 500, changeSpeed = 20}, [289] = {maxHealth = 500, maxMana = 500, changeSpeed = 20}, --Demonhunter
	[324] = {condition = mage, maxHealth = 200, maxMana = 200}, [325] = {condition = mage, maxHealth = 200, maxMana = 200} --Yalaharian
}

function onOutfit(cid, old, current)
        if old.lookAddons == 3 and outfitBonusTable[old.lookType] then --Bonus off
                if (outfitBonusTable[old.lookType]).maxHealth ~= nil then
                        setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) -(outfitBonusTable[old.lookType]).maxHealth)
                        doCreatureAddHealth(cid, -(outfitBonusTable[old.lookType]).maxHealth)
						doRemoveCondition(cid, CONDITION_INFIGHT)
                end
                if (outfitBonusTable[old.lookType]).maxMana ~= nil then
                        setCreatureMaxMana(cid, getCreatureMaxMana(cid) -(outfitBonusTable[old.lookType]).maxMana)
                        doCreatureAddMana(cid, -(outfitBonusTable[old.lookType]).maxMana)
						doRemoveCondition(cid, CONDITION_INFIGHT)
                end
                if (outfitBonusTable[old.lookType]).changeSpeed ~= nil then
                        doChangeSpeed(cid, -(outfitBonusTable[old.lookType]).changeSpeed)
                end
                if (outfitBonusTable[old.lookType]).condition ~= nil then
                        doRemoveCondition(cid, CONDITION_ATTRIBUTES)
                end
        end
        if current.lookAddons == 3 and outfitBonusTable[current.lookType] then --Bonus on
                if (outfitBonusTable[current.lookType]).maxHealth ~= nil then
                        setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) +(outfitBonusTable[current.lookType]).maxHealth)
                        doCreatureAddHealth(cid, (outfitBonusTable[current.lookType]).maxHealth)
                end
                if (outfitBonusTable[current.lookType]).maxMana ~= nil then
                        setCreatureMaxMana(cid, getCreatureMaxMana(cid) +(outfitBonusTable[current.lookType]).maxMana)
                        doCreatureAddMana(cid, (outfitBonusTable[current.lookType]).maxMana)
                end
                if (outfitBonusTable[current.lookType]).changeSpeed ~= nil then
                        doChangeSpeed(cid, (outfitBonusTable[current.lookType]).changeSpeed)
                end
                if (outfitBonusTable[current.lookType]).condition ~= nil then
                        doAddCondition(cid, (outfitBonusTable[current.lookType]).condition)
                end
        end
        return true
end
 
1. Removed part with changing speed and added hatse condition
2. Added one more parameter to table 'typ' (if typ == nil then typ = CONDITION_ATTRIBUTES)
3. Fixed speed

4. It will be work ONLY IN 0.3.6 or higher version
5. It won't work correct for players with acces 3 or higher
6. Tested, for me work perfect


Moved function from addonlogin.lua to addons.lua

PHP:
	<event type="outfit" name="Addons" event="script" value="addons.lua"/>
	<event type="login" name="AddonLogin" event="script" value="addons.lua"/>

addons.lua
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)

local nightmare = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(norse, CONDITION_PARAM_TICKS, -1)
setConditionParam(norse, CONDITION_PARAM_SKILL_SHIELD, 3)

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)

outfitBonusTable = { --- [] = {condition = , maxHealth = , maxMana = }
	[128] = {maxHealth = 100, condition = speed1, typ = CONDITION_HASTE}, [136] = {maxHealth = 100, condition = speed1, typ = CONDITION_HASTE}, --Citizen
	[129] = {condition = hunter}, [137] = {condition = hunter}, --Hunter
	[130] = {maxMana = 200}, [138] = {maxMana = 200}, --Mage
	[131] = {condition = knight}, [139] = {condition = knight}, --Knight
	[133] = {maxMana = 100}, [141] = {maxMana = 100}, --Summoner
	[134] = {condition = knight}, [142] = {condition = knight}, --Warrior
	[143] = {condition = barbarian}, [147] = {condition = barbarian}, --Barbarian
	[144] = {condition = mage}, [148] = {condition = mage}, --Druid
	[145] = {maxHealth = 100, maxMana = 100}, [149] = {maxHealth = 100, maxMana = 100}, --Wizard
	[146] = {maxHealth = 200, maxMana = 200, condition = speed1, typ = CONDITION_HASTE}, [150] = {maxHealth = 200, maxMana = 200, condition = speed1, typ = CONDITION_HASTE}, --Oriental
	[152] = {condition = speed2, typ = CONDITION_HASTE}, [156] = {condition = speed2, typ = CONDITION_HASTE}, --Assassin
	[154] = {condition = mage}, [158] = {condition = mage}, --Shaman
	[251] = {condition = norse, maxHealth = 200}, [252] = {condition = norse, maxHealth = 200}, --Norse
	[268] = {condition = nightmare, maxHealth = 100}, [269] = {condition = nightmare, maxHealth = 100}, --Nightmare
	[270] = {maxHealth = 100, maxMana = 100, condition = speed1, typ = CONDITION_HASTE}, [273] = {maxHealth = 100, maxMana = 100, condition = speed1, typ = CONDITION_HASTE}, --Jester
	[278] = {maxHealth = 200}, [279] = {maxHealth = 200}, --Brotherhood
	[288] = {maxHealth = 500, maxMana = 500, condition = speed2, typ = CONDITION_HASTE}, [289] = {maxHealth = 500, maxMana = 500, condition = speed2, typ = CONDITION_HASTE}, --Demonhunter
	[324] = {condition = mage, maxHealth = 200, maxMana = 200}, [325] = {condition = mage, maxHealth = 200, maxMana = 200} --Yalaharian
}

function onLogin(cid)
	registerCreatureEvent(cid, "Addons")
	local oldOutfit = getCreatureOutfit(cid)
	
	if (oldOutfit.lookAddons ~= 3) or (outfitBonusTable[oldOutfit.lookType] == nil) or ((outfitBonusTable[oldOutfit.lookType]).condition == nil) then
		return true
	end
	doAddCondition(cid, (outfitBonusTable[oldOutfit.lookType]).condition)
	return true
end

function onOutfit(cid, old, current)
        if old.lookAddons == 3 and outfitBonusTable[old.lookType] then --Bonus off
                if (outfitBonusTable[old.lookType]).maxHealth ~= nil then
                        setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) -(outfitBonusTable[old.lookType]).maxHealth)
                        doCreatureAddHealth(cid, -(outfitBonusTable[old.lookType]).maxHealth)
						doRemoveCondition(cid, CONDITION_INFIGHT)
                end
                if (outfitBonusTable[old.lookType]).maxMana ~= nil then
                        setCreatureMaxMana(cid, getCreatureMaxMana(cid) -(outfitBonusTable[old.lookType]).maxMana)
                        doCreatureAddMana(cid, -(outfitBonusTable[old.lookType]).maxMana)
						doRemoveCondition(cid, CONDITION_INFIGHT)
                end
                if (outfitBonusTable[old.lookType]).condition ~= nil then
					(outfitBonusTable[old.lookType]).typ = ( (outfitBonusTable[old.lookType]).typ == nil) and CONDITION_ATTRIBUTES or (outfitBonusTable[old.lookType]).typ
					doRemoveCondition(cid, (outfitBonusTable[old.lookType]).typ)
                end
        end
        if current.lookAddons == 3 and outfitBonusTable[current.lookType] then --Bonus on
                if (outfitBonusTable[current.lookType]).maxHealth ~= nil then
                        setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) +(outfitBonusTable[current.lookType]).maxHealth)
                        doCreatureAddHealth(cid, (outfitBonusTable[current.lookType]).maxHealth)
                end
                if (outfitBonusTable[current.lookType]).maxMana ~= nil then
                        setCreatureMaxMana(cid, getCreatureMaxMana(cid) +(outfitBonusTable[current.lookType]).maxMana)
                        doCreatureAddMana(cid, (outfitBonusTable[current.lookType]).maxMana)
                end
                if (outfitBonusTable[current.lookType]).condition ~= nil then
                        doAddCondition(cid, (outfitBonusTable[current.lookType]).condition)
                end
        end
        return true
end
 
Last edited:
@Hellboy
you can add other outfits:
nobleman, receives more experience
beggar, losses less when die
 
@Thread, Hellboy:
Lol, what an idiots ;|
(No offence.)

Example through outfits.xml:
Code:
<outfit id="3">
	<list gender="0" lookType="138" name="Mage">
		<stats magLevel="2"/>
	</list>
	<list gender="1" lookType="130" name="Mage">
		<stats magLevel="2"/>
	</list>
</outfit>

That means if someone is wearing full mage he'll receive magic level +2.
 
Last edited:
:p you devs know everything, don't ya

what other attrs can be used? i guess i can look them in the sources
 
Look into outfits.cpp, you can find all attrib types there.
Absorbs/reflects/skills/stats.
 
@Thread, Hellboy:
Lol, what an idiots ;|
(No offence.)

Example through outfits.xml:
Code:
<outfit id="3">
	<list gender="0" lookType="138" name="Mage">
		<stats magLevel="2"/>
	</list>
	<list gender="1" lookType="130" name="Mage">
		<stats magLevel="2"/>
	</list>
</outfit>


That means if someone is wearing full mage he'll receive magic level +2.
works for tfs 0.3.5? :D
 
@blondeboy: maybe private svn's version
 
Back
Top