• 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 Outfit/Addons Stats System

Dante_

Philosopher (Owner of Ethraeum)
Premium User
Joined
Dec 18, 2009
Messages
176
Reaction score
13
This was created for and tested on 0.4.

Add to creaturescripts.xml -
XML:
<event type="outfit" name="OutfitStats" event="script" value="outfitstats.lua"/>
Create outfitstats.lua -
Lua:
-- Scripted by Aziz, owner of Mystic Storm --
-- WORKS WITH CUSTOM OUTFITS, JUST DON'T CHANGE THE NAME UNLESS YOU KNOW WHAT YOU'RE DOING --
--Addons: (0=None,1=First/Second,2=Both)      0, 1, 2
local citizen =      {hp = {10,20,30}, mp = {10,20,30}}
local hunter =       {hp = {10,20,30}, mp = {10,20,30}}
local mage =         {hp = {10,20,30}, mp = {10,20,30}}
local knight =       {hp = {10,20,30}, mp = {10,20,30}}
local noble =        {hp = {10,20,30}, mp = {10,20,30}}
local summoner =     {hp = {10,20,30}, mp = {10,20,30}}
local warrior =      {hp = {10,20,30}, mp = {10,20,30}}
local barbarian =    {hp = {10,20,30}, mp = {10,20,30}}
local druid =        {hp = {10,20,30}, mp = {10,20,30}}
local wizard =       {hp = {10,20,30}, mp = {10,20,30}}
local oriental =     {hp = {10,20,30}, mp = {10,20,30}}
local pirate =       {hp = {10,20,30}, mp = {10,20,30}}
local assassin =     {hp = {10,20,30}, mp = {10,20,30}}
local beggar =       {hp = {10,20,30}, mp = {10,20,30}}
local shaman =       {hp = {10,20,30}, mp = {10,20,30}}
local norse =        {hp = {10,20,30}, mp = {10,20,30}}
local nightmare =    {hp = {10,20,30}, mp = {10,20,30}}
local jester =       {hp = {10,20,30}, mp = {10,20,30}}
local brotherhood =  {hp = {10,20,30}, mp = {10,20,30}}
local demonhunter =  {hp = {10,20,30}, mp = {10,20,30}}
local yalaharian =   {hp = {10,20,30}, mp = {10,20,30}}
local warmaster =    {hp = {10,20,30}, mp = {10,20,30}}
local wayfarer =     {hp = {10,20,30}, mp = {10,20,30}}
local wedding =      {hp = {0,0,0},    mp = {0,0,0}}

-- 9.0+ Outfits --
local afflicted =    {hp = {10,20,30}, mp = {10,20,30}}
local elementalist = {hp = {10,20,30}, mp = {10,20,30}}
local deepling =     {hp = {10,20,30}, mp = {10,20,30}}
local insectoid =    {hp = {10,20,30}, mp = {10,20,30}}
local redbaron =     {hp = {10,20,30}, mp = {10,20,30}}

-- DON'T SCREW AROUND PAST THIS POINT IF YOU DON'T KNOW WHAT YOU'RE DOING --
local outfits = {
	[128] = {[0] = {citizen.hp[1],citizen.mp[1]}, [1] = {citizen.hp[2],citizen.mp[2]}, [2] = {citizen.hp[2],citizen.mp[2]}, [3] = {citizen.hp[3],citizen.mp[3]}}, 
	[136] = {[0] = {citizen.hp[1],citizen.mp[1]}, [1] = {citizen.hp[2],citizen.mp[2]}, [2] = {citizen.hp[2],citizen.mp[2]}, [3] = {citizen.hp[3],citizen.mp[3]}},
	[129] = {[0] = {hunter.hp[1],hunter.mp[1]}, [1] = {hunter.hp[2],hunter.mp[2]}, [2] = {hunter.hp[2],hunter.mp[2]}, [3] = {hunter.hp[3],hunter.mp[3]}}, 
	[137] = {[0] = {hunter.hp[1],hunter.mp[1]}, [1] = {hunter.hp[2],hunter.mp[2]}, [2] = {hunter.hp[2],hunter.mp[2]}, [3] = {hunter.hp[3],hunter.mp[3]}}, 	
	[130] = {[0] = {mage.hp[1],mage.mp[1]}, [1] = {mage.hp[2],mage.mp[2]}, [2] = {mage.hp[2],mage.mp[2]}, [3] = {mage.hp[3],mage.mp[3]}}, 
	[138] = {[0] = {mage.hp[1],mage.mp[1]}, [1] = {mage.hp[2],mage.mp[2]}, [2] = {mage.hp[2],mage.mp[2]}, [3] = {mage.hp[3],mage.mp[3]}},	
	[131] = {[0] = {knight.hp[1],knight.mp[1]}, [1] = {knight.hp[2],knight.mp[2]}, [2] = {knight.hp[2],knight.mp[2]}, [3] = {knight.hp[3],knight.mp[3]}}, 
	[139] = {[0] = {knight.hp[1],knight.mp[1]}, [1] = {knight.hp[2],knight.mp[2]}, [2] = {knight.hp[2],knight.mp[2]}, [3] = {knight.hp[3],knight.mp[3]}},	
	[132] = {[0] = {noble.hp[1],noble.mp[1]}, [1] = {noble.hp[2],noble.mp[2]}, [2] = {noble.hp[2],noble.mp[2]}, [3] = {noble.hp[3],noble.mp[3]}}, 
	[140] = {[0] = {noble.hp[1],noble.mp[1]}, [1] = {noble.hp[2],noble.mp[2]}, [2] = {noble.hp[2],noble.mp[2]}, [3] = {noble.hp[3],noble.mp[3]}},	
	[133] = {[0] = {summoner.hp[1],summoner.mp[1]}, [1] = {summoner.hp[2],summoner.mp[2]}, [2] = {summoner.hp[2],summoner.mp[2]}, [3] = {summoner.hp[3],summoner.mp[3]}}, 
	[141] = {[0] = {summoner.hp[1],summoner.mp[1]}, [1] = {summoner.hp[2],summoner.mp[2]}, [2] = {summoner.hp[2],summoner.mp[2]}, [3] = {summoner.hp[3],summoner.mp[3]}},	
	[134] = {[0] = {warrior.hp[1],warrior.mp[1]}, [1] = {warrior.hp[2],warrior.mp[2]}, [2] = {warrior.hp[2],warrior.mp[2]}, [3] = {warrior.hp[3],warrior.mp[3]}}, 
	[142] = {[0] = {warrior.hp[1],warrior.mp[1]}, [1] = {warrior.hp[2],warrior.mp[2]}, [2] = {warrior.hp[2],warrior.mp[2]}, [3] = {warrior.hp[3],warrior.mp[3]}},	
	[143] = {[0] = {barbarian.hp[1],barbarian.mp[1]}, [1] = {barbarian.hp[2],barbarian.mp[2]}, [2] = {barbarian.hp[2],barbarian.mp[2]}, [3] = {barbarian.hp[3],barbarian.mp[3]}}, 
	[147] = {[0] = {barbarian.hp[1],barbarian.mp[1]}, [1] = {barbarian.hp[2],barbarian.mp[2]}, [2] = {barbarian.hp[2],barbarian.mp[2]}, [3] = {barbarian.hp[3],barbarian.mp[3]}},	
	[144] = {[0] = {druid.hp[1],druid.mp[1]}, [1] = {druid.hp[2],druid.mp[2]}, [2] = {druid.hp[2],druid.mp[2]}, [3] = {druid.hp[3],druid.mp[3]}}, 
	[148] = {[0] = {druid.hp[1],druid.mp[1]}, [1] = {druid.hp[2],druid.mp[2]}, [2] = {druid.hp[2],druid.mp[2]}, [3] = {druid.hp[3],druid.mp[3]}},	
	[145] = {[0] = {wizard.hp[1],wizard.mp[1]}, [1] = {wizard.hp[2],wizard.mp[2]}, [2] = {wizard.hp[2],wizard.mp[2]}, [3] = {wizard.hp[3],wizard.mp[3]}}, 
	[149] = {[0] = {wizard.hp[1],wizard.mp[1]}, [1] = {wizard.hp[2],wizard.mp[2]}, [2] = {wizard.hp[2],wizard.mp[2]}, [3] = {wizard.hp[3],wizard.mp[3]}},	
	[146] = {[0] = {oriental.hp[1],oriental.mp[1]}, [1] = {oriental.hp[2],oriental.mp[2]}, [2] = {oriental.hp[2],oriental.mp[2]}, [3] = {oriental.hp[3],oriental.mp[3]}}, 
	[150] = {[0] = {oriental.hp[1],oriental.mp[1]}, [1] = {oriental.hp[2],oriental.mp[2]}, [2] = {oriental.hp[2],oriental.mp[2]}, [3] = {oriental.hp[3],oriental.mp[3]}},	
	[151] = {[0] = {pirate.hp[1],pirate.mp[1]}, [1] = {pirate.hp[2],pirate.mp[2]}, [2] = {pirate.hp[2],pirate.mp[2]}, [3] = {pirate.hp[3],pirate.mp[3]}}, 
	[155] = {[0] = {pirate.hp[1],pirate.mp[1]}, [1] = {pirate.hp[2],pirate.mp[2]}, [2] = {pirate.hp[2],pirate.mp[2]}, [3] = {pirate.hp[3],pirate.mp[3]}},	
	[152] = {[0] = {assassin.hp[1],assassin.mp[1]}, [1] = {assassin.hp[2],assassin.mp[2]}, [2] = {assassin.hp[2],assassin.mp[2]}, [3] = {assassin.hp[3],assassin.mp[3]}}, 
	[156] = {[0] = {assassin.hp[1],assassin.mp[1]}, [1] = {assassin.hp[2],assassin.mp[2]}, [2] = {assassin.hp[2],assassin.mp[2]}, [3] = {assassin.hp[3],assassin.mp[3]}},	
	[153] = {[0] = {beggar.hp[1],beggar.mp[1]}, [1] = {beggar.hp[2],beggar.mp[2]}, [2] = {beggar.hp[2],beggar.mp[2]}, [3] = {beggar.hp[3],beggar.mp[3]}}, 
	[157] = {[0] = {beggar.hp[1],beggar.mp[1]}, [1] = {beggar.hp[2],beggar.mp[2]}, [2] = {beggar.hp[2],beggar.mp[2]}, [3] = {beggar.hp[3],beggar.mp[3]}},
	[154] = {[0] = {shaman.hp[1],shaman.mp[1]}, [1] = {shaman.hp[2],shaman.mp[2]}, [2] = {shaman.hp[2],shaman.mp[2]}, [3] = {shaman.hp[3],shaman.mp[3]}}, 
	[158] = {[0] = {shaman.hp[1],shaman.mp[1]}, [1] = {shaman.hp[2],shaman.mp[2]}, [2] = {shaman.hp[2],shaman.mp[2]}, [3] = {shaman.hp[3],shaman.mp[3]}},
	[251] = {[0] = {norse.hp[1],norse.mp[1]}, [1] = {norse.hp[2],norse.mp[2]}, [2] = {norse.hp[2],norse.mp[2]}, [3] = {norse.hp[3],norse.mp[3]}}, 
	[252] = {[0] = {norse.hp[1],norse.mp[1]}, [1] = {norse.hp[2],norse.mp[2]}, [2] = {norse.hp[2],norse.mp[2]}, [3] = {norse.hp[3],norse.mp[3]}},
	[268] = {[0] = {nightmare.hp[1],nightmare.mp[1]}, [1] = {nightmare.hp[2],nightmare.mp[2]}, [2] = {nightmare.hp[2],nightmare.mp[2]}, [3] = {nightmare.hp[3],nightmare.mp[3]}}, 
	[269] = {[0] = {nightmare.hp[1],nightmare.mp[1]}, [1] = {nightmare.hp[2],nightmare.mp[2]}, [2] = {nightmare.hp[2],nightmare.mp[2]}, [3] = {nightmare.hp[3],nightmare.mp[3]}},
	[273] = {[0] = {jester.hp[1],jester.mp[1]}, [1] = {jester.hp[2],jester.mp[2]}, [2] = {jester.hp[2],jester.mp[2]}, [3] = {jester.hp[3],jester.mp[3]}}, 
	[270] = {[0] = {jester.hp[1],jester.mp[1]}, [1] = {jester.hp[2],jester.mp[2]}, [2] = {jester.hp[2],jester.mp[2]}, [3] = {jester.hp[3],jester.mp[3]}},
	[278] = {[0] = {brotherhood.hp[1],brotherhood.mp[1]}, [1] = {brotherhood.hp[2],brotherhood.mp[2]}, [2] = {brotherhood.hp[2],brotherhood.mp[2]}, [3] = {brotherhood.hp[3],brotherhood.mp[3]}}, 
	[279] = {[0] = {brotherhood.hp[1],brotherhood.mp[1]}, [1] = {brotherhood.hp[2],brotherhood.mp[2]}, [2] = {brotherhood.hp[2],brotherhood.mp[2]}, [3] = {brotherhood.hp[3],brotherhood.mp[3]}},
	[289] = {[0] = {demonhunter.hp[1],demonhunter.mp[1]}, [1] = {demonhunter.hp[2],demonhunter.mp[2]}, [2] = {demonhunter.hp[2],demonhunter.mp[2]}, [3] = {demonhunter.hp[3],demonhunter.mp[3]}}, 
	[288] = {[0] = {demonhunter.hp[1],demonhunter.mp[1]}, [1] = {demonhunter.hp[2],demonhunter.mp[2]}, [2] = {demonhunter.hp[2],demonhunter.mp[2]}, [3] = {demonhunter.hp[3],demonhunter.mp[3]}},
	[325] = {[0] = {yalaharian.hp[1],yalaharian.mp[1]}, [1] = {yalaharian.hp[2],yalaharian.mp[2]}, [2] = {yalaharian.hp[2],yalaharian.mp[2]}, [3] = {yalaharian.hp[3],yalaharian.mp[3]}}, 
	[324] = {[0] = {yalaharian.hp[1],yalaharian.mp[1]}, [1] = {yalaharian.hp[2],yalaharian.mp[2]}, [2] = {yalaharian.hp[2],yalaharian.mp[2]}, [3] = {yalaharian.hp[3],yalaharian.mp[3]}},
	[335] = {[0] = {warmaster.hp[1],warmaster.mp[1]}, [1] = {warmaster.hp[2],warmaster.mp[2]}, [2] = {warmaster.hp[2],warmaster.mp[2]}, [3] = {warmaster.hp[3],warmaster.mp[3]}}, 
	[336] = {[0] = {warmaster.hp[1],warmaster.mp[1]}, [1] = {warmaster.hp[2],warmaster.mp[2]}, [2] = {warmaster.hp[2],warmaster.mp[2]}, [3] = {warmaster.hp[3],warmaster.mp[3]}},
	[367] = {[0] = {wayfarer.hp[1],wayfarer.mp[1]}, [1] = {wayfarer.hp[2],wayfarer.mp[2]}, [2] = {wayfarer.hp[2],wayfarer.mp[2]}, [3] = {wayfarer.hp[3],wayfarer.mp[3]}}, 
	[366] = {[0] = {wayfarer.hp[1],wayfarer.mp[1]}, [1] = {wayfarer.hp[2],wayfarer.mp[2]}, [2] = {wayfarer.hp[2],wayfarer.mp[2]}, [3] = {wayfarer.hp[3],wayfarer.mp[3]}},
	[328] = {[0] = {wedding.hp[1],wedding.mp[1]}, [1] = {wedding.hp[2],wedding.mp[2]}, [2] = {wedding.hp[2],wedding.mp[2]}, [3] = {wedding.hp[3],wedding.mp[3]}}, 
	[329] = {[0] = {wedding.hp[1],wedding.mp[1]}, [1] = {wedding.hp[2],wedding.mp[2]}, [2] = {wedding.hp[2],wedding.mp[2]}, [3] = {wedding.hp[3],wedding.mp[3]}},
	[430] = {[0] = {afflicted.hp[1],afflicted.mp[1]}, [1] = {afflicted.hp[2],afflicted.mp[2]}, [2] = {afflicted.hp[2],afflicted.mp[2]}, [3] = {afflicted.hp[3],afflicted.mp[3]}}, 
	[431] = {[0] = {afflicted.hp[1],afflicted.mp[1]}, [1] = {afflicted.hp[2],afflicted.mp[2]}, [2] = {afflicted.hp[2],afflicted.mp[2]}, [3] = {afflicted.hp[3],afflicted.mp[3]}},
	[432] = {[0] = {elementalist.hp[1],elementalist.mp[1]}, [1] = {elementalist.hp[2],elementalist.mp[2]}, [2] = {elementalist.hp[2],elementalist.mp[2]}, [3] = {elementalist.hp[3],elementalist.mp[3]}}, 
	[433] = {[0] = {elementalist.hp[1],elementalist.mp[1]}, [1] = {elementalist.hp[2],elementalist.mp[2]}, [2] = {elementalist.hp[2],elementalist.mp[2]}, [3] = {elementalist.hp[3],elementalist.mp[3]}},
	[463] = {[0] = {deepling.hp[1],deepling.mp[1]}, [1] = {deepling.hp[2],deepling.mp[2]}, [2] = {deepling.hp[2],deepling.mp[2]}, [3] = {deepling.hp[3],deepling.mp[3]}}, 
	[464] = {[0] = {deepling.hp[1],deepling.mp[1]}, [1] = {deepling.hp[2],deepling.mp[2]}, [2] = {deepling.hp[2],deepling.mp[2]}, [3] = {deepling.hp[3],deepling.mp[3]}},
	[465] = {[0] = {insectoid.hp[1],insectoid.mp[1]}, [1] = {insectoid.hp[2],insectoid.mp[2]}, [2] = {insectoid.hp[2],insectoid.mp[2]}, [3] = {insectoid.hp[3],insectoid.mp[3]}}, 
	[466] = {[0] = {insectoid.hp[1],insectoid.mp[1]}, [1] = {insectoid.hp[2],insectoid.mp[2]}, [2] = {insectoid.hp[2],insectoid.mp[2]}, [3] = {insectoid.hp[3],insectoid.mp[3]}},
	[472] = {[0] = {redbaron.hp[1],redbaron.mp[1]}, [1] = {redbaron.hp[2],redbaron.mp[2]}, [2] = {redbaron.hp[2],redbaron.mp[2]}, [3] = {redbaron.hp[3],redbaron.mp[3]}}, 
	[471] = {[0] = {redbaron.hp[1],redbaron.mp[1]}, [1] = {redbaron.hp[2],redbaron.mp[2]}, [2] = {redbaron.hp[2],redbaron.mp[2]}, [3] = {redbaron.hp[3],redbaron.mp[3]}}
}

function onOutfit(cid, old, current)
	local oldOutfit, curOutfit = outfits[old.lookType], outfits[current.lookType]
	if(not oldOutfit or not curOutfit or getPlayerAccess(cid) > 2)then
		return true
	end
	
	local hp, maxHp, mp, maxMp = getCreatureHealth(cid), getCreatureMaxHealth(cid), getCreatureMana(cid), getCreatureMaxMana(cid)

	local oldHp, oldMp = oldOutfit[old.lookAddons][1], oldOutfit[old.lookAddons][2]
	local curHp, curMp = curOutfit[current.lookAddons][1], curOutfit[current.lookAddons][2]

	local hpChange, mpChange = -(oldHp-(maxHp+curHp)), -(oldMp-(maxMp+curMp))
	setCreatureMaxHealth(cid, hpChange)
	setCreatureMaxMana(cid, hpChange)
	doTargetCombatHealth(cid, cid, COMBAT_HEALING, hpChange, hpChange, CONST_ME_MAGIC_BLUE, false)
	doTargetCombatMana(cid, cid, mpChange, mpChange, CONST_ME_MAGIC_BLUE, false)
	return true
end
Register at login.lua -
Lua:
registerCreatureEvent(cid, "OutfitStats")
Alright, so basically this works for addons and plain outfits. If anyone wants anything added or modified, just request it. Trust me, you don't want to mess with the actual script past "local outfits"
 
Why don't you just use
Code:
    <outfit id="10" premium="yes">
        <list gender="0" lookType="149" name="Wizard">
        <stats magLevel="1"/>
        <stats maxMana="100"/>
        </list>
        <list gender="1" lookType="145" name="Wizard">
        <stats magLevel="1"/>
        <stats maxMana="100"/>
        </list>
    </outfit>
instead =/
 
Why don't you just use
Code:
    <outfit id="10" premium="yes">
        <list gender="0" lookType="149" name="Wizard">
        <stats magLevel="1"/>
        <stats maxMana="100"/>
        </list>
        <list gender="1" lookType="145" name="Wizard">
        <stats magLevel="1"/>
        <stats maxMana="100"/>
        </list>
    </outfit>
instead =/

The only works with full addons, whereas with mine it works dynamically based on your addons.
 
I think I just saw a bug, but I have'nt test it yet. The bug is that if the addon is giving you 50+ health (for example) and then when you relog, it gives you 50+50=100 hp so your total hp+100 and so on...
 
Nope, it does not execute on Login. As I stated in my original post, it has been tested. It only executes when you change your outfit.
 
i use Tfs 0.4
and
i get this error in console, when i change outfits in game

Code:
Error-CreatureScript Interface]
data/creaturesscripts/scripts/outfitstast.lua:onOutfit
Description:
<luaDoTargetCombatMana> Creature not found

[Error-CreatureScript Interface]
data/creaturesscripts/scripts/outfitstast.lua:onOutfit
Description:
<luaDoTargetCombatheath> Creature not found
 
solved
Tfs 0.4 not work with doTargetCombatHealth doTargetCombatMana

i removed this lines and work 100% ;)
 
but now i need to add not only mana or hp, but percent damages, for example, if you wear full pirate outfit, you get a bonus for death damage + 10% resistance. u know how to do this?
 
but now i need to add not only mana or hp, but percent damages, for example, if you wear full pirate outfit, you get a bonus for death damage + 10% resistance. u know how to do this?

Curious about this as well.
 
Don't think this is working for .3.6 :'( its kk though

also; just curious; but i didn't get any error messages while loading this script...

But what are the stats that this is adding? I don't really see how to edit things myself >_< Looks really intimidating!
 
local hpChange, mpChange = -(oldHp-(maxHp+curHp)), -(oldMp-(maxMp+curMp))
setCreatureMaxHealth(cid, hpChange)
setCreatureMaxMana(cid, hpChange)
doTargetCombatHealth(cid, cid, COMBAT_HEALING, hpChange, hpChange, CONST_ME_MAGIC_BLUE, false)
doTargetCombatMana(cid, cid, mpChange, mpChange, CONST_ME_MAGIC_BLUE, false)
return true
end

@ setCreatureMaxMana(cid, hpChange) = setCreatureMaxMana(cid, mpChange)
 
Back
Top