• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Problem with onEquip/onDeEquip Item

Sytoxian

New Member
Joined
Aug 19, 2010
Messages
40
Reaction score
1
Hey Otland,
I've a short problem. Can u tell me why it doesnt work? ;)

(Using The Forgotten Server 0.3.5)

In movements.xml
Code:
<movevent event="Equip" itemid="2213" slot="ring" function="onEquipItem" script="elitespellbooks.lua" />
<movevent event="DeEquip" itemid="2215" slot="ring" function="onDeEquipItem" script="elitespellbooks.lua" />

In movements\scripts\elitespellbooks.lua
Code:
function onEquip(cid, item, slot)
doPlayerSetStorageValue(cid, 849218, 1)
return true
end

function onDeEquip(cid, item, slot)
doPlayerSetStorageValue(cid, 849218, 0)
return true
end

Thanks :)
 
Last edited:
no, nothing. is it possible that it has something to do with the fact that the item is a ring because there is already a function for rings? ;)

In movements.xml
Code:
<movevent type="Equip" itemid="2213" slot="ring" event="function" value="onEquipItem"/>
<movevent type="Equip" itemid="2215" slot="ring" event="function" value="onEquipItem"/>
<movevent type="DeEquip" itemid="2215" slot="ring" event="function" value="onDeEquipItem"/>

- - - Updated - - -

Changed the following but it still doesnt work! :blink:

In items.xml

From:

Code:
	<item id="2213" article="a" name="dwarven ring">
		<attribute key="weight" value="110"/>
		<attribute key="slotType" value="ring"/>
		<attribute key="transformEquipTo" value="2215"/>
		<attribute key="stopduration" value="1"/>
		<attribute key="showduration" value="1"/>
	</item>
	<item id="2215" article="a" name="dwarven ring">
		<attribute key="weight" value="110"/>
		<attribute key="slotType" value="ring"/>
		<attribute key="decayTo" value="0"/>
		<attribute key="transformDeEquipTo" value="2213"/>
		<attribute key="suppressDrunk" value="1"/>
		<attribute key="duration" value="300"/>
		<attribute key="showduration" value="1"/>
	</item>

To:

Code:
	<item id="2213" article="a" name="dwarven ring">
		<attribute key="weight" value="110"/>
		<attribute key="slotType" value="ring"/>
	</item>
	<item id="2215" article="a" name="dwarven ring">
		<attribute key="weight" value="110"/>
		<attribute key="slotType" value="ring"/>
	</item>

and In elitespellbooks.lua

From: shown in the first post

To:
Code:
function onEquip(cid, item, slot)
if(item.itemid == 2213) then
doPlayerSetStorageValue(cid, 849218, 1)
doTransformItem(item.uid, 2215)
end
return true
end

function onDeEquip(cid, item, slot)
if(item.itemid == 2215) then
doPlayerSetStorageValue(cid, 849218, 0)
doTransformItem(item.uid, 2213)
end
return true
end

and of course In movements.xml

To:

Code:
<movevent event="Equip" itemid="2213" slot="ring" function="onEquipItem" script="elitespellbooks.lua" />
<movevent event="DeEquip" itemid="2215" slot="ring" function="onDeEquipItem" script="elitespellbooks.lua" />

bump pls :)

- - - Updated - - -

Okay, problem solved but i still dont know why this doesnt work. i just made a creaturescript and removed my changes on items.xml and movements.xml (and deleted elitespellbooks.lua):

Code:
	function onThink(cid, interval)
	if getPlayerItemCount(cid, 2215) > 0 then
	doPlayerSetStorageValue(cid, 849218, 1)
	else
	doPlayerSetStorageValue(cid, 849218, 0)
	end
 
Last edited:
Back
Top