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

[Spell] Don't walk to say spell.

Saper1995

Technologic
Joined
Jul 11, 2009
Messages
104
Reaction score
3
Location
Poland
Hello. Is it possible that create a spell That can be made but only when the character stops at the spot at a Certain Time, and Whether it is possible to change the direction in which the player looking.
 
Should this be a specific place or any place, can you give an example how it should work exactly for an ingame player?
Which server do you use?
 
I use TFS 0.3.6 (8.54tibia). This script should working everywhere when you don't have (x) and your character stay in sqm for 10sec.
 
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)

local area = createCombatArea(AREA_CIRCLE3X3)
setCombatArea(combat, area)

function onGetFormulaValues(cid, level, maglevel)
     min = -(maglevel*3) -level/5 -76
     max = -(maglevel*4) -level/5 -108
     return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
     if getPlayerIdleTime(cid) < 10000 then
         local tm = math.floor((10000 - getPlayerIdleTime(cid))/1000)
         local rtime = tm >= 1 and tm or 1
         doPlayerSendCancel(cid, "Stand still for 10 seconds before using this spell, "..rtime.." "..(rtime == 1 and "second" or "seconds").." to go.")
         doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
         return false
     end
     return doCombat(cid, combat, var)
end
Not sure what kind of spell you had in mind, but you can just change it to what it's supposed to do.

By not having (x) you mean infight condition?
Code:
if getCreatureCondition(cid, CONDITION_INFIGHT) then
     doPlayerSendCancel(cid, "You can't do this spell when you're in a fight.")
     return false
end
 
I trying something with this and allways give me msg "Stand still for 10 second ..." and then i edited function but i don't know how to add timer in getCreatureNoMove(cid)


Code:
function onCastSpell(cid, var)
local fight = getCreatureCondition(cid, CONDITION_INFIGHT)
local move = getCreatureNoMove(cid)

if getCreatureNoMove(cid) and (fight == false) then
doCreatureChangeOutfit(cid, {lookType=130})
doSendMagicEffect(getCreaturePosition(cid), 35)
elseif getCreatureNoMove(cid) == false and (fight == false) then
doPlayerSendCancel(cid, "Stand still for 5 seconds before using this technique.")
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
elseif (fight == true) then
doPlayerSendCancel(cid, "You can't use technique when you're in a fight.")
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
end
end

This same here ^ allways giving msg ""Stand still for 5 seconds before using this technique."
 
The function getCreatureNoMove is if a player can't move, not if it stands still for some time.
Why don't you use getPlayerIdleTime? The way how I posted it the player needs to stand still for 10 second before being able to use the spell, after walking again it needs to wait again 10 seconds.
If you want something else, can you explain what it should do?
 
I want this what you talking about but something doesn't work.
When i using getPlayerIdleTime then in game i allways get "Stand still for 5 seconds before using this technique." even if i stand still for 5min. What is wrong here?

Code:
function onCastSpell(cid, var)
local fight = getCreatureCondition(cid, CONDITION_INFIGHT)

if getPlayerIdleTime(cid) >= 5000 and (fight == false) then
doCreatureChangeOutfit(cid, {lookType=130})
doSendMagicEffect(getCreaturePosition(cid), 35)
elseif getPlayerIdleTime(cid) < 5000 and (fight == false) then
doPlayerSendCancel(cid, "Stand still for 5 seconds before using this technique.")
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
elseif (fight == true) then
doPlayerSendCancel(cid, "You can't use technique when you're in a fight.")
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
end
end
 
Code:
function onCastSpell(cid, var)
     if getCreatureCondition(cid, CONDITION_INFIGHT) then
         doPlayerSendCancel(cid, "You can't use technique when you're in a fight.")
         return false
     elseif getPlayerIdleTime(cid) < 5000 then
         doPlayerSendCancel(cid, "Stand still for 5 seconds before using this this technique.")
         doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
         return false
     end
     local outfit = getCreatureOutfit(cid)
     outfit.lookType = 130
     doCreatureChangeOutfit(cid, outfit)
     doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HEARTS)
     return true
end
 
I did test on a normal player. It's strange, it seems to me that this function does not check idle and that's why always send cancel msg.
 
Do you have an idle script in creaturescripts and does it add idle time?
You can check with
Code:
print(getPlayerIdleTime(cid))
This will show the idle time in your console (add it under the main function onThink and you can do the same thing with onCastSpell).
 
Last edited:
Yes i have it and i added it there. This is what console showed :
Code:
[11/07/2014 17:37:47] 0
[11/07/2014 17:37:47] 0
[11/07/2014 17:37:48] 0
[11/07/2014 17:37:48] 0
[11/07/2014 17:37:49] 0
[11/07/2014 17:37:49] 0
[11/07/2014 17:37:50] 0
[11/07/2014 17:37:50] 0
[11/07/2014 17:37:51] 0
[11/07/2014 17:37:51] 0
[11/07/2014 17:37:52] 0
[11/07/2014 17:37:52] 0
[11/07/2014 17:37:53] 0
[11/07/2014 17:37:53] 0
[11/07/2014 17:37:54] 0
[11/07/2014 17:37:54] 0
[11/07/2014 17:37:55] 0
[11/07/2014 17:37:55] 0
[11/07/2014 17:37:56] 0
[11/07/2014 17:37:56] 0
[11/07/2014 17:37:57] 0
[11/07/2014 17:37:57] 0
[11/07/2014 17:37:58] 0
[11/07/2014 17:37:58] 0
[11/07/2014 17:37:59] 0
[11/07/2014 17:37:59] 0

When i relog on GOD account then server has debug and when i running sever again, login on normal player then nothing showing in console.
 
Last edited:
Code:
local config = {
    idleWarning = getConfigValue('idleWarningTime'),
    idleKick = getConfigValue('idleKickTime')
}
function onThink(cid, interval)
print(getPlayerIdleTime(cid))
    if(getTileInfo(getCreaturePosition(cid)).nologout or getCreatureNoMove(cid) or
        getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_ALLOWIDLE)) then
        return true
    end

    local idleTime = getPlayerIdleTime(cid) + interval
    doPlayerSetIdleTime(cid, idleTime)
    if(config.idleKick > 0 and idleTime > config.idleKick) then
        doRemoveCreature(cid)
    elseif(config.idleWarning > 0 and idleTime == config.idleWarning) then
        local message = "You have been idle for " .. math.ceil(config.idleWarning / 60000) .. " minutes"
        if(config.idleKick > 0) then
            message = message .. ", you will be disconnected in "
            local diff = math.ceil((config.idleWarning - config.idleKick) / 60000)
            if(diff > 1) then
                message = message .. diff .. " minutes"
            else
                message = message .. "one minute"
            end

            message = message .. " if you are still idle"
        end

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, message .. ".")
    end

    return true
end
 
If you login with a player you don't see anything in your console? Does a player get kicked or receive these messages on your server for being idle?
 
Sorry for the absence but I had no time to write answer.
1) Yes. This "0" is only when i login on GOD.
2) I don't receive any message for being idle. I stay (afk) by 20min and nothing showing.
 
So your players never get kciked for being idle? How is the script added and registered?
Do you get errors when you login with a player?
 
Back
Top