• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

TFS 1.X+ Where is located magic forcefield cooldown?

Lopaskurwa

Well-Known Member
Joined
Oct 6, 2017
Messages
936
Solutions
2
Reaction score
57
Where can i find magic forcefield teleport cooldown i mean like entry so you wouldnt be able to stack on teleports every milisecond. My timeBetweenActions is set to zero for particular reasons so cannot do anything in config.lua, and writing action script for movement probably isnt the best choice for performance so doing it directly in source probably would be a bit faster
 
This exemple?
LUA:
local delayTP = 1000 -- ms

local TimeTP= {}

function onStepIn(creature, item, position, fromPosition)
    local cid = creature:getId()
    local now = os.mtime()
    if TimeTP[cid] and now < TimeTP[cid] then
        creature:teleportTo(fromPosition)
        creature:getPosition():sendMagicEffect(CONST_ME_POFF)
        return false
    end

    TimeTP[cid] = now + delayTP
    return true
end
XML:
<movevent type="StepIn" itemid="1387" script="teleport_cooldown.lua"/>
 
This exemple?
LUA:
local delayTP = 1000 -- ms

local TimeTP= {}

function onStepIn(creature, item, position, fromPosition)
    local cid = creature:getId()
    local now = os.mtime()
    if TimeTP[cid] and now < TimeTP[cid] then
        creature:teleportTo(fromPosition)
        creature:getPosition():sendMagicEffect(CONST_ME_POFF)
        return false
    end

    TimeTP[cid] = now + delayTP
    return true
end
XML:
<movevent type="StepIn" itemid="1387" script="teleport_cooldown.lua"/>
Wouldnt it be better to alter
<attribute key="type" value="teleport" /> for a better performance in src then writing a lua script?
 

Similar threads

Back
Top