• 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 A talkaction that would cause a magic effect near player, not on player.

Slime

Active Member
Joined
Jan 25, 2014
Messages
115
Reaction score
32
I want to do sort of ragnarok online type emoticon system. It will just execute a magic effect depending on the command, for example /emot1, /emot2 etc.
emoticon_test.png

Also I'd like to make a 1 second delay between using them.
 
[03/03/2014 10:58:09] [Error - TalkAction Interface]
[03/03/2014 10:58:09] data/talkactions/scripts/magiceffect.lua
[03/03/2014 10:58:09] Description:
[03/03/2014 10:58:09] (luaGetThingPosition) Thing not found
I'm using TFS 0.3.6.
 
How did you added it?
Make sure you use cid inside the function.
Code:
function onSay(cid, words, param)
   local k = getThingPos(cid)
   doSendMagicEffect({x = k.x -1, y = k.y -1, z = k.z}, 30)
   return true
end
 
function onSay(cid, words, param, channel)
local position = getCreaturePosition(cid)
doSendMagicEffect({x = position.x, y = position.y - 1, z = position.z},CONST_ME_STEPSVERTICAL)
return true
end

It works. Is there a way to set delay time for talkactions in general? I think it would be the only way to prevent players from spamming these.
 
exhaustion lib:
Code:
exhaustion =
{
  check = function (cid, storage)
    return getPlayerStorageValue(cid, storage) >= os.time()
  end,
  get = function (cid, storage)
    local exhaust = getPlayerStorageValue(cid, storage)
    if(exhaust > 0) then
      local left = exhaust - os.time()
      if(left >= 0) then
        return left
      end
    end
    return false
  end,
  set = function (cid, storage, time)
    setPlayerStorageValue(cid, storage, os.time() + time)
  end,
  make = function (cid, storage, time)
    local exhaust = exhaustion.get(cid, storage)
    if(not exhaust) then
      exhaustion.set(cid, storage, time)
      return true
    end
    return false
  end
}

talkaction:
Code:
function onSay(cid, words, param, channel)
if exhaustion.get(cid, 101) then
doPlayerSendCancel(cid, 'You are exhausted.')
return true
end
local position = getCreaturePosition(cid)
doSendMagicEffect({x = position.x, y = position.y - 1, z = position.z},CONST_ME_STEPSVERTICAL)
exhaustion.set(cid, 101, 5) -- 5 seconds
return true
end
 
Ok, it works fine for me too. Do your emoticons "follow" the player if he moves or just stand in place like ordinary magic effects?
 
Ok, it works fine for me too. Do your emoticons "follow" the player if he moves or just stand in place like ordinary magic effects?

Unfortunately, they stay in the place they were originally casted at. I don't think that can be changed if you're gonna use them as magic effect (either through a talkaction offset or sprite offset) because it's still a magic effect. Maybe it could be done through OTClient, but I don't have experience with that :\
 
Back
Top