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

item

Lbtg

Advanced OT User
Joined
Nov 22, 2008
Messages
2,398
Reaction score
165
how i make that amulet gives utamo vita , when put it of it whent off ?
 
Something like this?
LUA:
function onUse(cid, item, frompos, item2, topos)

magicshieldseconds = 300 -- 10 minutes
itemnumber = 1010 -- item number id

local combatUtamo = createConditionObject(CONDITION_MANASHIELD)
setConditionParam(combatUtamo, CONDITION_PARAM_BUFF, true)
setConditionParam(combatUtamo, CONDITION_PARAM_TICKS, magicshieldseconds*1000)

   	if item.uid == itemnumber then
		doAddCondition(cid, combatUtamo)
	else

	end
	return 1
end
 
no , i want that if player puts amulet on he gets utamo vita , if he puts it off utamo vita went off

ty for reply
 
Here is:

XML:
    <movevent type="Equip" itemid="ITEMNUMBER" slot="ring" event="function" value="onEquipItem"/>
    <movevent type="Equip" itemid="ITEMNUMBERUSED" slot="ring" event="script" value="expring.lua"/>
    <movevent type="DeEquip" itemid="ITEMNUMBER" slot="ring" event="function" value="onDeEquipItem"/>
    <movevent type="DeEquip" itemid="ITEMNUMBERUSED" slot="ring" event="script" value="expring.lua"/>
LUA:
item = 1010 -- item number id
used = 1011 -- item number id on use
local combatUtamo = createConditionObject(CONDITION_MANASHIELD)

function onDeEquip(cid, item, slot)
   	if item.uid == itemnumber then
		doRemoveCondition(cid, combatUtamo)
                doTransformItem(item.uid, item)
	end
end

function onEquip(cid, item, slot)
   	if item.uid == itemnumber then
		doAddCondition(cid, combatUtamo)
                doTransformItem(item.uid, used)
                return true
	end
end
 
Last edited:
Well, why to use script if its already developed in c++ to 0.2, 0.3 and 0.4 and in 0.3.6 onEquip function is bugged it wont work as script and mayby items.xml

LUA:
<attribute key="manashield" value="1" />
 
Take it:
Code:
<item id="2204" article="an" name="energy ring (mana shield protection)">
		<attribute key="weight" value="80" />
		<attribute key="slotType" value="ring" />
		<attribute key="decayTo" value="0" />
		<attribute key="transformDeEquipTo" value="2167" />
		<attribute key="duration" value="1200" />
		<attribute key="showduration" value="1" />
[COLOR="#FF0000"][B]		<attribute key="manashield" value="1" />[/B][/COLOR]
		<attribute key="showattributes" value="1" />
	</item>
And add in code of amulet in items.xml

Code:
	<!-- Amulets -->
         <movevent type="Equip" itemid="[COLOR="#FF0000"][B]xxxx[/B][/COLOR]" slot="necklace" event="function" value="onEquipItem"/>
	<movevent type="DeEquip" itemid="[COLOR="#FF0000"][B]xxxx[/B][/COLOR]" slot="necklace" event="function" value="onDeEquipItem"/>


Change XXXX for item id of amulet
 
okej i made all things , but i got another problem , when i try put that amulet it says "put this object in your hand.

me amulet loooks like this atm:
PHP:
	<item id="10133" article="a" name="Mage Amulet">
		<attribute key="description" value="This Amulet Is Amazing For Mages."/>
		<attribute key="magiclevelpoints" value="12"/>
		<attribute key="manashield" value="1" />
		<attribute key="absorbPercentall" value="12"/>
		<attribute key="manaGain" value="800"/>
		<attribute key="manaTicks" value="1000"/>
		<attribute key="weight" value="2000"/>

movements:
PHP:
		<movevent type="Equip" itemid="10133" slot="necklace" event="function" value="onEquipItem">
		<vocation id="1"/>
		<vocation id="5"/>
		<vocation id="9" showInDescription="0"/>
		<vocation id="2"/>
		<vocation id="6"/>
		<vocation id="10" showInDescription="0"/>
	</movevent>
	<movevent type="DeEquip" itemid="10133" slot="necklace" event="function" value="onDeEquipItem"/>

edit: this item was not added in me items.xml so i added it
 
LUA:
<item id="10133" article="a" name="Mage Amulet"> 
        <attribute key="description" value="This Amulet Is Amazing For Mages."/> 
        <attribute key="magiclevelpoints" value="12"/> 
        <attribute key="manashield" value="1" /> 
        <attribute key="absorbPercentall" value="12"/> 
        <attribute key="manaGain" value="800"/> 
        <attribute key="manaTicks" value="1000"/> 
        <attribute key="weight" value="2000"/>
        <attribute key="slotType" value="necklace"/>
 
Back
Top