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

Dont use haste in certain area

Wanheda

New Member
Joined
Feb 17, 2016
Messages
44
Solutions
2
Reaction score
4
is it possible something like, from x place to x place can not use the spell haste?

If anyone can help me, thank you.
 
hi man i recently received help with a similar problem and here is the script


Lua:
local event_areas = {
    {{x = 940, y = 987, z = 7}, {x = 947, y = 994, z = 7}}, -- {{from},{to}}
    {{x = 950, y = 989, z = 7}, {x = 956, y = 995, z = 7}}
}

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)

local condition = createConditionObject(CONDITION_HASTE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 33000)
setConditionFormula(condition, 0.3, -24, 0.3, -24)
setCombatCondition(combat, condition)

function onCastSpell(cid, var)
        local cid_pos = getThingPosition(cid)
    for i = 1, #event_areas do
        if isInArea(cid_pos, event_areas[i][1], event_areas[i][2]) then
            doPlayerSendCancel(cid, "You cannot use any runes in event zone.")
            return false
        end
    end
    return doCombat(cid, combat, var)
end
 
I got this error.

Lua:
Lua Script Error: [Spell Interface]
data/spells/scripts/support/haste.lua:onCastSpell
data/spells/scripts/support/haste.lua:15: attempt to call global 'getThingPosition' (a nil value)
stack traceback:
        [C]: in function 'getThingPosition'
        data/spells/scripts/support/haste.lua:15: in function <data/spells/scripts/support/haste.lua:14>


I use TFS 1.3, maybe this is the problem?
 
Last edited:
try

Lua:
local combat = Combat()
local playerpos = player:getPosition()
local zone = {
   from = Position(100, 100, 8),
   to = Position(200, 200, 8)
}

combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)

local condition = Condition(CONDITION_HASTE)
condition:setParameter(CONDITION_PARAM_TICKS, 33000)
condition:setFormula(0.3, -24, 0.3, -24)
combat:addCondition(condition)

function onCastSpell(creature, variant)
if playerpos:isInRange(zone.from, zone.to) then
playerpos:sendMagicEffect(CONST_ME_POFF, nil)
return false
end
return combat:execute(creature, variant)
end
 
Lua:
Lua Script Error: [Test Interface]
data/spells/scripts/support/haste.lua
data/spells/scripts/support/haste.lua:2: attempt to index global 'player' (a nil value)
stack traceback:
        [C]: in function '__index'
        data/spells/scripts/support/haste.lua:2: in main chunk
[Warning - Event::checkScript] Can not load script: scripts/support/haste.lua
 
Lua:
Lua Script Error: [Test Interface]
data/spells/scripts/support/haste.lua
data/spells/scripts/support/haste.lua:2: attempt to index global 'creature' (a nil value)
stack traceback:
        [C]: in function '__index'
        data/spells/scripts/support/haste.lua:2: in main chunk
[Warning - Event::checkScript] Can not load script: scripts/support/haste.lua
 
Back
Top