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

Stealth ring and "utevo res ina" in battle event, how to unable?

ohman

Member
Joined
Oct 24, 2008
Messages
294
Reaction score
8
Location
Sweden
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 :)
 
When the event starts only allow players that do not have a stealth ring equiped and add a movement event for stealth ring which checks if the player has the event storage and if so return false. (Not sure if that disallows the player from equiping)

About utevo res ina, you can either code the spell as a talkaction and check for the storage there or you can edit the source function which is called on casting utevo res ina. I assume that is in spells.cpp
 
Can you please give med the codes for the stealth ring? Im not good at that, sorry.

I dont find anything that is called on casting utevo res ina in spells.cpp or spells.h
 
HERE is the code for utevo res ino [ no source change needed ] but there is a detail i ll not tell you.

1st goto spell.xml and delete the old utevo res ina ( for test i used the name utevo res iva )
then goto mods and make a new file the name u want ( i used bout.xml [ b = block , out = outfit ] )
Code:
<?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>

OK the detail i not wanted to tell u is that there is a really Symple way to do it.
HERE it GOES.

mods folder just make a new file the name u want, past the following code.
Code:
<?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>
hope i have help, for the ring that is even more easy. i ll let u try by ur self for a bit.
remember it is all for you good.
 
Last edited:
Thanks!! :) it works. Now its just the stealth ring problem left :)

EDIT: I need Chameleon rune to unable to :/ its also dont have a .lua file :/
 
Last edited:
CHAMELEON RUNE
( there is something missing, it cant be used to transforme to a item inside a contener i dont know how to get it ID )
inside mods folder make a file with the f name u want ( getting used to it )
Code:
<?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>
 
this version work 100% ( using item action )
good : this work | bad : use a short version of a rune tag in xml ( this will allow the item have rune look, when u look it )
ok first delete the old chamaleon tag from spells.xml then go inside mods folder and here is the code ( u shall know what to do right ? )
Code:
<?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>

for the stealth ring problem just use something like this inside the the script ( on equip )
Code:
            local storage = 123456789
            if getPlayerStorageValue(cid, storage )    ~= -1 then return false end
storage is the storage from the event !
 
Thanks! :D What is the condition name when a player is transformed to a item id? I want it to be removed when entering event :) I'll try the stealth ring code soon! :)


I tried to add this into my mod:

Code:
<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>

What do I miss? I get this error:
Code:
[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.
 
Last edited:
you have still a lot to learn.
if u just read the awser is right there o_O just read.
[17:22:31.419] > Loading battle.xml...[Error - LuaInterface::loadBuffer] [string "LuaInterface::loadBuffer"]:4: 'end' expected (to close 'function' at line 2) near '<eof>'
write end to close the function at line 2 near <eof>
the function is [ function onEquip(cid, item) ]
<eof> mean [ end of file ]
check the my script for Chameleon rune.
Code:
function onCastSpell(cid, var)
return true
end
u just declared a function right ?
Code:
function onEquip(cid, item)
but that function doesnt have a END so it will never finish it. and before its end it is wise to return true or false else it will be nill
Code:
    <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>
here is condition listed at the file [ 000-constant.lua ]
just remove the CONDITION_OUTFIT

PHP:
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
 
Last edited:
Thanks man! Its very good that you explain :) It didnt make me invisible at start but I changed it a bit. Now I get invisible and I cant put it up in battle event. (good).

The problem that I have now: The time dont change, on the stealth ring. I need to know the correct storage id of it.

Code:
    <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>

I also need the storage id so I can set it to 0 when entering the event. Else players can use it before entering the tp and still have it on.

Thanks m8!
 
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

Utevo res ina is allready fixed. And stealth ring cant be equipped but the time does not work on stealth ring when I use the script above. Look at the older post and you'll understand :)

Summery: I need to do something so stealth ring goes off when entering the event teleport. I need stealth ring to have working duration. Thats it!
 
delete all tags for the rings in movements.xml goto [...] mods folder.

Code:
<?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>
 
Last edited:
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>

The duration is like 10 times to slow. And it keep saying: "Ok, you can go." after a while. :)

EDIT: more than 10 times to slow.
18:21 You see a stealth ring (invisibility) that will expire in 10 minutes.
19:47 You see a stealth ring (invisibility) that will expire in 6 minutes and 33 seconds.

EDIT: I also get this error when a player wearing a stealth ring and loggout:

[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.
 
Last edited:
i have updated my post before this one.
just search for ( CTRL+F ) "Ok, you can go." and delete the line
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Ok, you can go.")
The duration is like 10 times to slow.
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.
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

if (item.uid < 70001 ) and (item.uid > 0 ) then return false end
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")
 
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")

Still problem with duration. Its still to slow. Mush to slow, 4 sec duration in around 30~ sec. And the script is spamming: "16:51 stealth duration is : 600000" , "16:52 stealth duration is : 594000". The other stuff is solved. I just copied your edited mod ^up.

EDIT: I found "doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "stealth duration is : "..duration)".

EDIT AGAIN: I dont know if it matter, but I use rev 0.3.7 5969 client 8.6
 
Last edited:
Back
Top