Hi, I want stealth ring to be unable to use in battle event. Is there any way to do this? I also want to unable "utevo res ina "monster" spell, I cant find the .lua file for that spell, its all in functions I think, how to unable that? Thanks 

<?xml version="1.0" encoding="UTF-8"?>
<mod name="spell to talkaction" version="1.0" author="Willian Batista Cima" contact="none" enabled="yes">
---- exemple passing param from spell to talkaction
-----------------------------------------------------------------------
<!-- Custom Spells -->
<instant name="Creature Illusion" words="utevo res iva" lvl="23" mana="100" aggressive="0" params="1" exhaustion="2000" groups="3,2000" icon="38" needlearn="0" event="script" >
<vocation id="1"/>
<vocation id="2"/>
<vocation id="5"/>
<vocation id="6"/>
<![CDATA[
function onCastSpell(cid, var )
-- print ( var["type"] ..' '.. var["string"] )
return doCreatureExecuteTalkAction(cid, "!xbout "..var["string"] , true)
end
]]></instant>
<talkaction words="!xbout" event="script"><![CDATA[
function onSay(cid, words, param, channel)
-- put here the storage value from the event
local storage = 123456789 -- better use global storagevalue to avoid truble if the player log out.
-- and dont forget to set the value to -1 when the event end
local pos = getPlayerPosition(cid)
local params=1
local vocation = {1,2,5,6}
local lvl=23
local mana=0
local exhaustion=2000
local groups={3,2000}
local icon=38
local aggressive=0
if getPlayerStorageValue(cid, storage ) ~= -1 then return doPlayerSendCancel(cid, "This spell is blocked during event time.") end
if params==1 and param=='' then return doPlayerSendCancel(cid, "Sorry, monster name doesn't exist.") end
if isInArray(vocation, getPlayerVocation(cid) ) then return false end
if getPlayerLevel(cid) < lvl then return doPlayerSendCancel(cid, "Sorry, you dont have the required lvl.") end
if getCreatureMana(cid) < mana then return doPlayerSendCancel(cid, "Sorry, you dont have the required mana.")
else doCreatureAddMana(cid, -mana) end
if aggressive==1 and getTilePzInfo(pos) == true then return doPlayerSendCancel(cid, "This action, isnt allowed in a PZ.") end
if getCreatureByName(param) then
if getMonsterInfo(param).illusionable then
local xtime = 10*1000 -- time duration in seconds
doSetMonsterOutfit(cid, param, xtime)
else
doPlayerSendCancel(cid, "Sorry, doesn't possible.")
end
else
doPlayerSendCancel(cid, "Sorry, monster name doesn't exist.")
end
return true
end
]]></talkaction>
-----------------------------------------------------------------------
</mod>
<?xml version="1.0" encoding="UTF-8"?>
<mod name="utevo_res_iva" version="1.0" author="Willian Batista Cima" contact="none" enabled="yes">
<!-- Custom Spells -->
<instant name="Creature Illusion" words="utevo res iva" lvl="23" mana="100" aggressive="0" params="1" exhaustion="2000" groups="3,2000" icon="38" needlearn="0" event="script" >
<vocation id="1"/>
<vocation id="2"/>
<vocation id="5"/>
<vocation id="6"/>
<![CDATA[
function onCastSpell(cid, var )
-- print ( var["type"] ..' '.. var["string"] )
local storage = 12345678910111213
local param = var["string"]
if getPlayerStorageValue(cid, storage ) ~= -1 then return doPlayerSendCancel(cid, "This spell is blocked during event time.") end
if getCreatureByName(param) then
if getMonsterInfo(param).illusionable then
local xtime = 10*1000
doSetMonsterOutfit(cid, param, xtime)
else
doPlayerSendCancel(cid, "Sorry, doesn't possible.")
end
else
doPlayerSendCancel(cid, "Sorry, monster name doesn't exist.")
end
return true
end
]]></instant>
</mod>
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Chameleon_rune" version="1.0" author="Willian Batista Cima" contact="none" enabled="yes">
<!-- Custom rune -->
-- try without selftarget="1"
<rune name="Chameleon" id="2291" allowfaruse="1" charges="1" lvl="27" maglv="3" groups="3,2000" icon="14" aggressive="0" selftarget="0" blocktype="solid" event="script" >
<vocation id="1"/>
<vocation id="2"/>
<vocation id="5"/>
<vocation id="6"/>
<![CDATA[
local function doTargetItem(cid, position)
position.stackpos = 255
local item = getThingFromPos(position)
if( item.uid > 0 and isMoveable(item.uid) ) then
local xtime = 10*1000
doSetItemOutfit(cid, item.itemid, xtime )
doSendMagicEffect(position, CONST_ME_MAGIC_BLUE)
return true
end
doSendMagicEffect(getThingPosition(cid), CONST_ME_POFF)
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
return false
end
function onCastSpell(cid, var)
local storage = 12345678910111213
if getPlayerStorageValue(cid, storage ) ~= -1 then return doPlayerSendCancel(cid, "This spell is blocked during event time.") end
local position = variantToPosition(var)
if(position.x ~= 0 and position.y ~= 0) then
return doTargetItem(cid, position)
end
doSendMagicEffect(getThingPosition(cid), CONST_ME_POFF)
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
return false
end
]]></rune>
</mod>
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Chameleon_rune" version="2.0" author="Willian Batista Cima" contact="none" enabled="yes">
<!-- Custom action -->
<action itemid="2291" allowfaruse="1" event="script" override="yes"><![CDATA[
function onUse(cid, item, fromPosition, itemEx, toPosition)
local storage = 123456789
if getPlayerStorageValue(cid, storage ) ~= -1 then return false end
local lvl = 27
local maglv = 3
local charges= 1
if getPlayerLevel(cid) < lvl then return doPlayerSendCancel(cid, "Sorry, you dont have the required lvl.") end
if getPlayerMagLevel(cid) < maglv then return doPlayerSendCancel(cid, "Sorry, you dont have the required maglvl.") end
if( itemEx.uid > 0 and isMoveable(itemEx.uid) ) then
local xtime = 60*1000
doSetItemOutfit(cid, itemEx.itemid, xtime )
doSendMagicEffect(fromPosition, CONST_ME_MAGIC_BLUE)
if charges>0 then doRemoveItem( item.uid, charges ) end
return true
end
doSendMagicEffect(fromPosition, CONST_ME_POFF) -- getThingPosition(cid)
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
return false
end
]]></action>
<!-- Custom rune -->
<rune name="Chameleon" id="2291" allowfaruse="1" charges="1" lvl="27" maglv="3" groups="3,2000" icon="14" aggressive="0" selftarget="1" blocktype="solid" event="script" >
<![CDATA[
function onCastSpell(cid, var)
return true
end
]]></rune>
</mod>
local storage = 123456789
if getPlayerStorageValue(cid, storage ) ~= -1 then return false end
<movevent type="Equip" itemid="2165" event="script"><![CDATA[
local storage = 123456789
function onEquip(cid, item)
if getPlayerStorageValue(cid, storage ) ~= -1 then return false end
]]> </movevent>
[17:22:31.419] > Loading battle.xml...[Error - LuaInterface::loadBuffer] [string "LuaInterface::loadBuffer"]:4: 'end' expected (to close 'function' at line 2) near '<eof>'
[17:22:31.419] [Error - Event::checkScript] Cannot load script (local storage = 123456789
[17:22:31.419] function onEquip(cid, item)
[17:22:31.419] if getPlayerStorageValue(cid, storage ) ~= -1 then return false end
[17:22:31.419] )
[17:22:31.419] [string "LuaInterface::loadBuffer"]:4: 'end' expected (to close 'function' at line 2) near '<eof>'
[17:22:31.420] done.
write end to close the function at line 2 near <eof>[17:22:31.419] > Loading battle.xml...[Error - LuaInterface::loadBuffer] [string "LuaInterface::loadBuffer"]:4: 'end' expected (to close 'function' at line 2) near '<eof>'
function onCastSpell(cid, var)
return true
end
function onEquip(cid, item)
<movevent type="Equip" itemid="2165" slot="ring" event="script"><![CDATA[
function onEquip(cid, item, slot)
local storage = 123456789
if getPlayerStorageValue(cid, storage ) ~= -1 then return false end
return true
end
]]></movevent>
CONDITION_NONE = 0
CONDITION_POISON = 1
CONDITION_FIRE = 2
CONDITION_ENERGY = 4
CONDITION_BLEEDING = 8
CONDITION_HASTE = 16
CONDITION_PARALYZE = 32
CONDITION_OUTFIT = 64
CONDITION_INVISIBLE = 128
CONDITION_LIGHT = 256
CONDITION_MANASHIELD = 512
CONDITION_INFIGHT = 1024
CONDITION_DRUNK = 2048
CONDITION_EXHAUST = 4096
CONDITION_FOOD = 8192
CONDITION_REGENERATION = 8192
CONDITION_SOUL = 16384
CONDITION_DROWN = 32768
CONDITION_MUTED = 65536
CONDITION_ATTRIBUTES = 131072
CONDITION_FREEZING = 262144
CONDITION_DAZZLED = 524288
CONDITION_CURSED = 1048576
CONDITION_PACIFIED = 2097152
CONDITION_GAMEMASTER = 4194304
CONDITION_HUNTING = 8388608
CONDITION_SPELLCOOLDOWN = 16777216
<movevent type="Equip" itemid="2165" slot="ring" event="script"><![CDATA[
function onEquip(cid, item, slot)
local storage = 9907
if getPlayerStorageValue(cid, storage ) ~= -1 then return false end
if(item.itemid == 2165) then
doPlayerSetStorageValue(cid, 1234231235, 1)
doTransformItem(item.uid, 2202)
end
return true
end
]]></movevent>
You basically wanna make it so the event gives u storage ID and if storage ID = xxxxxx you cannot equip the ring or use utevo res ina
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Stealth ring System" version="1.0" author="Willian Batista Cima" contact="none" enabled="yes">
-----------------------------------------------------------------------
<config name="stealthRingSystem"><![CDATA[
------------------------------------ Setting up condition
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
local CONDITION_ = CONDITION_INVISIBLE
local condition = createConditionObject(CONDITION_)
setConditionParam(condition, CONDITION_PARAM_TICKS, -1)
setCombatCondition(combat, condition)
------------------------------------ Setting up condition
stealthRingSystem = {
storageBase = 9000101 ,
storageEvent = 9907 , -- event to negate its use.
ringOn = 2202 ,
ringOff = 2165 ,
precision = 2 , -- how less the precision is better. ( in second )
CONDITION_ = CONDITION_,
COMBAT_ = combat,
}
stealthRingSystem.ringInUse = stealthRingSystem.storageBase
function doItemSetDuration(uid, duration)
return doItemSetAttribute(uid, "duration", duration)
end
function getItemDuration(uid)
return getItemAttribute(uid, "duration") or 0
end
]]></config>
-----------------------------------------------------------------------
<event type="login" name="stealthRingSystem_login" event="script"><![CDATA[
domodlib('stealthRingSystem')
local cfg = stealthRingSystem
function onLogin(cid)
local ring = getPlayerSlotItem(cid, CONST_SLOT_RING)
if ring.itemid == cfg.ringOn then
registerCreatureEvent(cid,"stealthRingSystem_think")
setPlayerStorageValue(cid, cfg.ringInUse , 1 )
------------------------------------
local var ={}
var["number"] = cid
var["type"] = 1
doCombat(cid, cfg.COMBAT_, var)
------------------------------------
end
return true
end
]]></event>
-----------------------------------------------------------------------
<event type="think" name="stealthRingSystem_think" event="script"><![CDATA[
domodlib('stealthRingSystem')
local cfg = stealthRingSystem
function onThink(cid, interval)
if stealthRingSystem_last_interval == nil then stealthRingSystem_last_interval= os.clock() end
if (os.clock() - stealthRingSystem_last_interval) > cfg.precision then -- execute every X sec
if isPlayer(cid) then
if getPlayerStorageValue(cid, cfg.ringInUse ) == 1 then
local ring = getPlayerSlotItem(cid, CONST_SLOT_RING)
if ring.itemid == cfg.ringOn then
local duration = getItemDuration(ring.uid)
if getPlayerAccess(cid) > 2 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "stealth duration is : "..duration)
end
doItemSetDuration(ring.uid, (duration-(cfg.precision*1000))) -- 10*1000 = 10s
if duration < 0 then doDecayItem(ring.uid) end
else
local msg = "if you got this msg, pls report to ADM, that there is a bug with the stealthRing."
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg )
end
end
stealthRingSystem_last_interval= os.clock()
end
return true
end
return false
end
]]></event>
-----------------------------------------------------------------------
-----------------------------------------------------------------------
<movevent type="Equip" itemid="2165" slot="ring" event="script"><![CDATA[
domodlib('stealthRingSystem')
local cfg = stealthRingSystem
function onEquip(cid, item, slot)
if(item.itemid == cfg.ringOff) then
if getPlayerStorageValue(cid, cfg.storageEvent ) ~= -1 then return false end
doTransformItem(item.uid, cfg.ringOn)
end
return true
end
]]></movevent>
-----------------------------------------------------------------------
<movevent type="Equip" itemid="2202" slot="ring" event="script"><![CDATA[
domodlib('stealthRingSystem')
local cfg = stealthRingSystem
------------------------------------
function onEquip(cid, item, slot)
if(item.itemid == cfg.ringOn) then
if getPlayerStorageValue(cid, cfg.ringInUse ) < 0 then
setPlayerStorageValue(cid, cfg.ringInUse , 1 )
registerCreatureEvent(cid,"stealthRingSystem_think")
------------------------------------
local var ={}
var["number"] = cid
var["type"] = 1
doCombat(cid, cfg.COMBAT_, var)
------------------------------------
end
end
return true
end
]]></movevent>
-----------------------------------------------------------------------
<movevent type="DeEquip" itemid="2202" slot="ring" event="script"><![CDATA[
domodlib('stealthRingSystem')
local cfg = stealthRingSystem
function onDeEquip(cid, item, slot)
if(item.itemid == cfg.ringOn) then
if (item.uid < 70001 ) and (item.uid > 0 ) then return false end
unregisterCreatureEvent(cid, "stealthRingSystem_think")
if getPlayerStorageValue(cid, cfg.ringInUse ) > 0 then
setPlayerStorageValue(cid, cfg.ringInUse , -1 )
if hasCondition(cid, cfg.CONDITION_) then
doRemoveCondition(cid, cfg.CONDITION_)
end
end
if (item.uid > 0 ) then
local duration = getItemDuration(item.uid)
doTransformItem(item.uid, cfg.ringOff)
doItemSetDuration(item.uid, duration)
end
end
return true
end
]]></movevent>
<talkaction words="!steal_ring_reset" event="script"><![CDATA[
domodlib('stealthRingSystem')
local cfg = stealthRingSystem
function onSay(cid, words, param, channel)
if(param ~= '') then
doPlayerSendCancel(cid, 'no need a para. ')
return true
end
local ring = getPlayerSlotItem(cid, CONST_SLOT_RING)
if ring.itemid == cfg.ringOn then
doItemSetDuration(ring.uid, 0 )
end
local msg =" ring duration set to 0. "
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, msg )
return true
end
]]></talkaction>
</mod>
delete all tags for the rings in movements.xml goto [...] mods folder.
PHP:<?xml version="1.0" encoding="UTF-8"?> <mod name="Stealth ring System" version="1.0" author="Willian Batista Cima" contact="none" enabled="yes"> ----------------------------------------------------------------------- <config name="stealthRingSystem"><![CDATA[ ------------------------------------ Setting up condition local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED) setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false) local CONDITION_ = CONDITION_INVISIBLE local condition = createConditionObject(CONDITION_) setConditionParam(condition, CONDITION_PARAM_TICKS, -1) setCombatCondition(combat, condition) ------------------------------------ Setting up condition stealthRingSystem = { storageBase = 9000101 , storageEvent = 9907 , -- event to negate its use. ringOn = 2202 , ringOff = 2165 , precision = 10 , -- how less the precision is better. ( in second ) CONDITION_ = CONDITION_, COMBAT_ = combat, } stealthRingSystem.ringInUse = stealthRingSystem.storageBase function doItemSetDuration(uid, duration) return doItemSetAttribute(uid, "duration", duration) end function getItemDuration(uid) return getItemAttribute(uid, "duration") or 0 end ]]></config> ----------------------------------------------------------------------- <event type="login" name="stealthRingSystem_login" event="script"><![CDATA[ domodlib('stealthRingSystem') local cfg = stealthRingSystem function onLogin(cid) local ring = getPlayerSlotItem(cid, CONST_SLOT_RING) if ring.itemid == cfg.ringOn then registerCreatureEvent(cid,"stealthRingSystem_think") ------------------------------------ local var ={} var["number"] = cid var["type"] = 1 doCombat(cid, cfg.COMBAT_, var) ------------------------------------ end return true end ]]></event> ----------------------------------------------------------------------- <event type="think" name="stealthRingSystem_think" event="script"><![CDATA[ domodlib('stealthRingSystem') local cfg = stealthRingSystem function onThink(cid, interval) if stealthRingSystem_last_interval == nil then stealthRingSystem_last_interval= os.clock() end if (os.clock() - stealthRingSystem_last_interval) > cfg.precision then -- execute every X sec if isPlayer(cid) then if getPlayerStorageValue(cid, cfg.ringInUse ) == 1 then local ring = getPlayerSlotItem(cid, CONST_SLOT_RING) if ring.itemid == cfg.ringOn then local duration = getItemDuration(ring.uid) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Ok, you can go.") doItemSetDuration(ring.uid, (duration-(cfg.precision*(10*100)))) -- 10*100 = 1000 = 10s if duration < 0 then doDecayItem(ring.uid) end else local msg = "if you got this msg, pls report to ADM, that there is a bug with the stealthRing." doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg ) end end stealthRingSystem_last_interval= os.clock() end return true end return false end ]]></event> ----------------------------------------------------------------------- ----------------------------------------------------------------------- <movevent type="Equip" itemid="2165" slot="ring" event="script"><![CDATA[ domodlib('stealthRingSystem') local cfg = stealthRingSystem function onEquip(cid, item, slot) if(item.itemid == cfg.ringOff) then if getPlayerStorageValue(cid, cfg.storageEvent ) ~= -1 then return false end doTransformItem(item.uid, cfg.ringOn) end return true end ]]></movevent> ----------------------------------------------------------------------- <movevent type="Equip" itemid="2202" slot="ring" event="script"><![CDATA[ domodlib('stealthRingSystem') local cfg = stealthRingSystem ------------------------------------ function onEquip(cid, item, slot) if(item.itemid == cfg.ringOn) then if getPlayerStorageValue(cid, cfg.ringInUse ) < 0 then setPlayerStorageValue(cid, cfg.ringInUse , 1 ) registerCreatureEvent(cid,"stealthRingSystem_think") ------------------------------------ local var ={} var["number"] = cid var["type"] = 1 doCombat(cid, cfg.COMBAT_, var) ------------------------------------ end end return true end ]]></movevent> ----------------------------------------------------------------------- <movevent type="DeEquip" itemid="2202" slot="ring" event="script"><![CDATA[ domodlib('stealthRingSystem') local cfg = stealthRingSystem function onDeEquip(cid, item, slot) if(item.itemid == cfg.ringOn) then unregisterCreatureEvent(cid, "stealthRingSystem_think") if getPlayerStorageValue(cid, cfg.ringInUse ) > 0 then setPlayerStorageValue(cid, cfg.ringInUse , -1 ) if hasCondition(cid, cfg.CONDITION_) then doRemoveCondition(cid, cfg.CONDITION_) end end if (item.uid > 0 ) then local duration = getItemDuration(item.uid) doTransformItem(item.uid, cfg.ringOff) doItemSetDuration(item.uid, duration) end end return true end ]]></movevent> </mod>
[20:59:16.494] [Error - MoveEvent::executeEquip] Call stack overflow.
[20:59:16.494] [Error - MoveEvent::executeEquip] Call stack overflow.
[20:59:16.494] [Error - MoveEvent::executeEquip] Call stack overflow.
The duration is like 10 times to slow.just search for ( CTRL+F ) "Ok, you can go." and delete the line
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Ok, you can go.")
inside stealthRingSystem = {
set precision to 2 ( and yes that was 10 times slower. the ring should last for 100min.
23:23 You see a stealth ring (invisibility) that will expire in 5 minutes and 2 seconds.
It weighs 1.00 oz.
23:28 You see a stealth ring (invisibility) that will expire in 1 minute and 30 seconds.
It weighs 1.00 oz.
stealthRingSystem = {
storageBase = 9000101 ,
storageEvent = 9907 , -- event to negate its use.
ringOn = 2202 ,
ringOff = 2165 ,
precision = 10 , -- how less the precision is better. ( in second )
CONDITION_ = CONDITION_,
COMBAT_ = combat,
}
precision = 2 , -- how less the precision is better. ( in second )
if (item.uid < 70001 ) and (item.uid > 0 ) then return false end
function onDeEquip(cid, item, slot)
if(item.itemid == cfg.ringOn) then
if (item.uid < 70001 ) and (item.uid > 0 ) then return false end
unregisterCreatureEvent(cid, "stealthRingSystem_think")
i have updated my post before this one.
The duration is like 10 times to slow.
PHP:stealthRingSystem = { storageBase = 9000101 , storageEvent = 9907 , -- event to negate its use. ringOn = 2202 , ringOff = 2165 , precision = 10 , -- how less the precision is better. ( in second ) CONDITION_ = CONDITION_, COMBAT_ = combat, }
------------------------------------------------------------------------------------------------Code:precision = 2 , -- how less the precision is better. ( in second )
the stack overflow. problem is easy solved by adding it after DeEquip function
Code:function onDeEquip(cid, item, slot) if(item.itemid == cfg.ringOn) then if (item.uid < 70001 ) and (item.uid > 0 ) then return false end unregisterCreatureEvent(cid, "stealthRingSystem_think")