• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

[Release]Funny onEquip/onDeEquip Functions.

Jano

oturhaN
Joined
Feb 21, 2008
Messages
876
Solutions
1
Reaction score
68
Location
Chile
Well As The Title Say, ill Release Some Funny/Util Things That You can Do With the onEquip/onDeEquip Functions.

-Teleport Amulet.
Function: When You Put This Amulet in Your Neck, This Will Save Your Current Pos And Teleport You To a Pos That you Configure in The Script, When you take off The
Amulet from your Neck it Will Teleport you back to the old pos.
Create a new File in movements/scripts called tpamulet.lua inside put this.

Code:
local storage = 1800------change this to the storage where your back pos will save, example if you set it to 1800 make you sure you have not used 
tha storages 1800, 1801, 1802.
local npos = {x=1000, y=1000, z=7} -----Where the Amulet Teleport you.
---------------------------------------End Config-------------------------------------------------------------------------------------
function onEquip(cid, item, slot)
setPlayerStorageValue(cid, storage, getPlayerPosition(cid).x)
setPlayerStorageValue(cid, storage+1, getPlayerPosition(cid).y)
setPlayerStorageValue(cid, storage+2, getPlayerPosition(cid).z)
doTeleportThing(cid,npos)
doSendMagicEffect(npos, 10)
end
function onDeEquip(cid, item, slot)
initial = { x = getPlayerStorageValue(cid, storage), y = getPlayerStorageValue(cid, storage+1), z = getPlayerStorageValue(cid, storage+2) }
doTeleportThing(cid,initial)
doSendMagicEffect(initial, 10)
end



-Vocation Amulet.
Function: When You Put This Amulet in Your Neck, This Will Save Your Current Vocation and Change it to a new voc that you configure in the script,When you take off The
Amulet from your Neck it Will change your vocation to your old vocation.
Create a new File in movements/scripts called vocamulet.lua inside put this.
Code:
local storage = 18009 ----Where Your initial voc will save.
local nvoc = 5 ---The new Voc.(From 0 to 8, if you have more voc you can put their id here)
-------------------------------------End Config---------------------------------
function onEquip(cid, item, slot)
setPlayerStorageValue(cid, storage, getPlayerVocation(cid))
doPlayerSetVocation(cid,nvoc)
end
function onDeEquip(cid, item, slot)
old = getPlayerStorageValue(cid, storage)
doPlayerSetVocation(cid,old)
end

-Light Amulet.(simple)
Function: When You Put This Amulet in Your Neck, This Will increase your light,when you take off it will turn off the light.

Create a new File in movements/scripts called lightamulet.lua inside put this.

Code:
function onEquip(cid, item, slot)
doSetCreatureLight(cid, 9, 65, 10*60*1000)
end
function onDeEquip(cid, item, slot)
doSetCreatureLight(cid, 7, 215, 1*1000)
end

-Funny Boh.
Function: Funny Mesages and efects When put it on and when take it off.

Goto movements/scripts and Change your current boh.lua for this.

Code:
function onEquip(cid, item, slot)
local pos = getPlayerPosition(cid)
doSendMagicEffect(pos, 14)
doSendAnimatedText(pos, "Boh In", 65)
end
function onDeEquip(cid, item, slot)
local pos = getPlayerPosition(cid)
doSendMagicEffect(pos, 13)
doSendAnimatedText(pos, "Boh Out", 65)
end
-Tranformation Boots.
Function: When You put it on This will save Your outfit and change your outfit to a item that you configure in the script, when you take it off it will return your outfit.

Create a new File in movements/scripts called transboots.lua inside put this.

Code:
local storage = 1800 ---change this to the storage where your outfit will save, example if you set it to 1800 make you sure you have not used tha storages 1800, 1801, 1802, 1803, 1804, 1805.
local tran = 5080----change it to the item that you will get transformed.
---------------------------------------End Config-------------------------------------------------------------------------------------
function onEquip(cid, item, slot)
setPlayerStorageValue(cid, storage, getCreatureOutfit(cid).lookType)
setPlayerStorageValue(cid, storage+1, getCreatureOutfit(cid).lookHead)
setPlayerStorageValue(cid, storage+2, getCreatureOutfit(cid).lookBody)
setPlayerStorageValue(cid, storage+3, getCreatureOutfit(cid).lookLegs)
setPlayerStorageValue(cid, storage+4, getCreatureOutfit(cid).lookFeet)
setPlayerStorageValue(cid, storage+5, getCreatureOutfit(cid).lookAddons)
doSetItemOutfit(cid, tran, 300000)
end
function onDeEquip(cid, item, slot)
standardoutfit = { lookType = getPlayerStorageValue(cid, storage), lookHead = getPlayerStorageValue(cid, storage+1), lookBody = getPlayerStorageValue(cid, storage+2), lookLegs = getPlayerStorageValue(cid, storage+3), lookFeet = getPlayerStorageValue(cid, storage+4), lookAddons = getPlayerStorageValue(cid, storage+5) }
doSetCreatureOutfit(cid, standardoutfit, 1)
end

-Skiller Helmet.
Function: When You put it on you will gain an skill of sword, when you take it off you will gain an skill of axe.(If someone need it ill add a configuration later, lol)

Create a new File in movements/scripts called skillhelmet.lua inside put this.

Code:
function onEquip(cid, item, slot)
local pos = getPlayerPosition(cid)
doPlayerAddSkillTry(cid,2,1)
doSendMagicEffect(pos, 14)
end
function onDeEquip(cid, item, slot)
local pos = getPlayerPosition(cid)
doPlayerAddSkillTry(cid,3,1)
doSendMagicEffect(pos, 14)
end


ok now go to movements.xml and add this lines.

Code:
<movevent event="Equip" itemid="7459" slot="head" function="onEquipItem" script="skillhelmet.lua" />
<movevent event="DeEquip" itemid="7459" slot="head" function="onDeEquipItem" script="skillhelmet.lua" />
<movevent event="Equip" itemid="2131" slot="necklace" function="onEquipItem" script="vocamulet.lua" />
<movevent event="DeEquip" itemid="2131" slot="necklace" function="onDeEquipItem" script="vocamulet.lua" />
<movevent event="Equip" itemid="2136" slot="necklace" function="onEquipItem" script="lightamulet.lua" />
<movevent event="DeEquip" itemid="2136" slot="necklace" function="onDeEquipItem" script="lightamulet.lua" />
<movevent event="Equip" itemid="7457" slot="feet" function="onEquipItem" script="transboots.lua" />
<movevent event="DeEquip" itemid="7457" slot="feet" function="onDeEquipItem" script="transboots.lua" />
<movevent event="Equip" itemid="2130" slot="necklace" function="onEquipItem" script="tptamulet.lua" />
<movevent event="DeEquip" itemid="2130" slot="necklace" function="onDeEquipItem" script="tpamulet.lua" />
and change this line:
Code:
<movevent event="Equip" itemid="2195" slot="feet" function="onEquipItem" />
<movevent event="DeEquip" itemid="2195" slot="feet" function="onDeEquipItem" />
for this:
Code:
<movevent event="Equip" itemid="2195" slot="feet" function="onEquipItem" script="boh.lua" />
<movevent event="DeEquip" itemid="2195" slot="feet" function="onDeEquipItem" script="boh.lua" />


Note: The Scripts Just are Some Examples That All You can do With That Functions.
Note: You Can Change slot="feet", to Feet,legs,armor,head,necklace,ring.
 
First was best, then second. Other's didn't like! Good work dude ;)

Also, since I've actually never been using these functions... If you die and drop the amulet, is it onDeEquip too?
 
-in case of teleport amulet:
i think if you die and drop the amulet your dead body will be teleport to the old pos but you will spawn in the temple.
-in case of vocation amulet:
i think if you die and drop the amulet your voc will back to the normal voc, so there is no problem.
-in case of transformation boots:
i think if you die and drop the boots your outfit will change to your normal outfit.
-in case of funny boh:
you will say boh out and die, lol.
-in case of skill helmet:
i think you will gain a skill level.
-in case of light amulet:
the light will turn off.
---------------------------------------------------------------------------
other things when you login and have the items on your body they make the function, with a server with creatuesevent is easy to edit that part.
also if you die.
 
HAHA that's quite funny "boh out" when you die... LOL all noobs would stack around you xD
 
Code:
local outfit =
	{
		lookType = 203,
		lookHead = 0,
		lookBody = 0,
		lookLegs = 0,
		lookFeet = 0,
		lookAddons = 0
	}

function onEquip(cid, item, slot)
	doSetCreatureOutfit(cid, outfit, -1)
end

function onDeEquip(cid, item, slot)
	doRemoveCondition(cid, CONDITION_OUTFIT)
end
Much easier for newbies to configure.
 
@ Nahruto - Hey friend i'm need one help, can you to solve this for me??? many thx...

They have 5% fire protection, but also increase damage taken from ice by 5%.

- How to me enchant my armor with this attribute???

No more,

F@bio
 
-Vocation Amulet. best by far

look type ammy by Stix awesome also
 
Back
Top