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

Solved Put magic effect on item after use

Exoltes

Novia OTserv Developer
Joined
Jul 2, 2009
Messages
563
Reaction score
47
Location
Belgium
I'm working on a 8.54 Open Tibia Server using The Forgotten Server - Version 0.2.7 (Mystic Spirit).


I'm looking for a way to make a quest box "explode". The chest does not have to be removed after using I just want the effect on it after I use it.

Code:
      elseif item.uid == 5567 then
        if getPlayerStorageValue(cid, 7007) == -1 then
            doTargetCombatHealth(0, cid, COMBAT_FIREDAMAGE, -50, -50, CONST_ME_NONE)
              doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"I told you not to touch it.")
              setPlayerStorageValue(cid,7007,1)
        elseif getPlayerStorageValue(cid, 7007) == 1 and getPlayerStorageValue(cid, 7008) == -1 then
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You stole XXX his treasure.")
              doPlayerAddItem(cid,8602,1)    -- jagged sword
              setPlayerStorageValue(cid,7000,1)
              setPlayerStorageValue(cid,7008,1)
          end

So when you get the fire dmg i also want the explosive effect on the chest itself. (tried copying a couple things from my spells but that didn't work out :( )

Also the effect I would like to have is the following: 'MagicEffect - firearea' (the same as hells core spell)

Thanks in advance.
 
[08/08/2014 15:05:20] attempt to index a nil value
[08/08/2014 15:05:20] stack traceback:
[08/08/2014 15:05:20] [C]: in function 'doSendMagicEffect'
[08/08/2014 15:05:20] data/actions/scripts/quests/Secret Quests.lua:60: in function <data/actions/scripts/quests/Secret Quests.lua:1>
 
Code:
function onUse(cid, item, frompos, item2, topos)

      if item.uid == 5551 then
          queststatus = getPlayerStorageValue(cid,7001)
          if queststatus == -1 then
              doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found the hidden dragon treasure.")
              doPlayerAddItem(cid,8602,1)    -- jagged sword
              setPlayerStorageValue(cid,7000,1)
              setPlayerStorageValue(cid,7001,1)
          end

      elseif item.uid == 5552 then
          queststatus = getPlayerStorageValue(cid,7002)
          if queststatus == -1 then
              doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found the hidden minotaur treasure.")
              doPlayerAddItem(cid,8602,1)    -- jagged sword
              setPlayerStorageValue(cid,7000,1)
              setPlayerStorageValue(cid,7002,1)
          end

      elseif item.uid == 5553 then
          queststatus = getPlayerStorageValue(cid,7003)
          if queststatus == -1 then
              doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found the ice serpent treasure.")
              doPlayerAddItem(cid,8602,1)    -- jagged sword
              setPlayerStorageValue(cid,7000,1)
              setPlayerStorageValue(cid,7003,1)
          end

      elseif item.uid == 5554 then
          queststatus = getPlayerStorageValue(cid,7004)
          if queststatus == -1 then
              doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found the ice witch treasure.")
              doPlayerAddItem(cid,8602,1)    -- jagged sword
              setPlayerStorageValue(cid,7000,1)
              setPlayerStorageValue(cid,7004,1)
          end

      elseif item.uid == 5555 then
          queststatus = getPlayerStorageValue(cid,7005)
          if queststatus == -1 then
              doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found the grim reaper treasure.")
              doPlayerAddItem(cid,8602,1)    -- jagged sword
              setPlayerStorageValue(cid,7000,1)
              setPlayerStorageValue(cid,7005,1)
          end


      elseif item.uid == 5565 then
          queststatus = getPlayerStorageValue(cid,7006)
          if queststatus == -1 then
              doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found the behemoth treasure.")
              doPlayerAddItem(cid,8602,1)    -- jagged sword
              setPlayerStorageValue(cid,7000,1)
              setPlayerStorageValue(cid,7006,1)
          end

      elseif item.uid == 5567 then
        if getPlayerStorageValue(cid, 7007) == -1 then
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREAREA)
            doTargetCombatHealth(0, cid, COMBAT_FIREDAMAGE, -50, -50, CONST_ME_NONE)
              doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"I told you not to touch it.")
              setPlayerStorageValue(cid,7007,1)
        elseif getPlayerStorageValue(cid, 7007) == 1 and getPlayerStorageValue(cid, 7008) == -1 then
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You stole XXX his treasure.")
              doPlayerAddItem(cid,8602,1)    -- jagged sword
              setPlayerStorageValue(cid,7000,1)
              setPlayerStorageValue(cid,7008,1)
          end


        return 1
    else
        return 0
    end
end
 
Haha not completely.

[08/08/2014 15:51:45] Lua Script Error: [Action Interface]
[08/08/2014 15:51:45] data/actions/scripts/quests/Secret Quests.lua:eek:nUse

[08/08/2014 15:51:45] data/actions/scripts/quests/Secret Quests.lua:63: attempt to index global 'toPosition' (a nil value)
[08/08/2014 15:51:45] stack traceback:
[08/08/2014 15:51:45] data/actions/scripts/quests/Secret Quests.lua:63: in function <data/actions/scripts/quests/Secret Quests.lua:1>

And now it keeps looping in the explosion.
But atleast the magic effect is on the right spot.
 
Change toPosition to topos.
It depens which parameter names you use.


function onUse(cid, item, frompos, item2, topos)

Or

function onUse(cid, item, fromPosition, itemEx, toPosition)
 
Back
Top