• 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"

I know it's an old post. But I want to make it working only in certains vocation. For example, i don't want a knight to have a 2 more magic level, because he is wearing an outfit. How do you make it by especific vocations.
Thanks.
 
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:
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)

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

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>


when u change with outfits it happends sometimes example at when u wear nightmare outfit u get +100 hp , and u change to citizen. Than the +100 hp still stand there.
and doesnt delete :p

this is bad...
someone know a solution?

I use; rev 3858,

0.4
 

Yes, this is working great.

Which one of them ? Since I tried the first one, and one by Hellboy which didnt work at all.. the first one worked but it was bugged, and I coulndt get the attributes as was told. For instance, Demonhunter, add 500 mp/hp ? It added speed! and when I tried to change is, nothing happend.. I made my own; Copied hpmana200, increased all of the values to 500, added it to demonhunter, but nothing happend PLUS the speed were erased.. HELP?

Im getting no errors though, thats a relief
 
I did get it to work.. but when I use and outfit, reloggs, I still got like 500+ hp, and if I do it over and over again I gain ALOT hp/mana, which outfit I decide to wear when I login

Edit: Was only while playing on gm.
 
To everyone who is still using my system, it gets bugged out if you are using any character above a senior tutor; that means GMs, CMs and Gods will get messed up values. Besides, this was made a while ago, so to be honest, I'm not really worried about it right now, but if enough people seriously want me to remake the system, I might consider it. Right now though I am working on other more interesting systems for a secret upcoming project.
 
To every person who thinks this is bugged, I would like your proof of you testing this system on a >>>>>>>>REGULAR<<<<<<<<< player account, not your GOD/GM/CM accounts and showing where the bugs are considering I've tested every accusation and have not been able to remake it.
 
that script has a bug,
if you set an outfit that gives you more hp or mana, then u cast utevo res ina ".. (dragon for example),
you got to set outfits, change outfits and without items,
you wait some time until your illussion turn off, you get your new outfit (what you has set) but what has happened? you have your old mana and hp (what the outfits given)
so if you go to set outfit, and take the same outfit, you will get mana and hp as it was double.

it can be repeat all you want, so players with 1 addon and a loot of patience can perfectly get 5000 hp 10000 or more...

can anybody fix this?
 
This only works for add skill/magic/speed. Nothing else. I'm using the script for 0.4 rev, no I didn't use outfits.xml way.
 
i did notice today, that it broke my utito tempo san , (the skill isnt increased by that spell anymore if you have +distance on from addons)
 
Back
Top