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

TFS 1.X+ Little question about attack, maybe addEvent?

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,837
Solutions
18
Reaction score
615
Location
Poland
Hello there Otlanders!
I made an simple attack spell for my monster and I have a question about setNoMove(true/false).
Everything is okay. Monster is attacking and stop moving while he is using this spell but i want to do something like this way: "Monster stops for attack -> doing spell -> can move (setNoMove(false))"

For now is that monster cannot move because i dont know how to do the block movement only for time while spell is casting.

Anyone know how to do that?
Maybe addEvent? But im not good at this. that's why im asking for.

Script:
Code:
function onCastSpell(creature, var)

    local outfit = {lookTypeEx = 0, lookType = 30, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookAddons = 0}
    doSetCreatureOutfit(creature, outfit, 500)
    doTargetCombatHealth(creature, creature:getTarget(), COMBAT_PHYSICALDAMAGE, -100, -200, CONST_ME_NONE)
    creature:setNoMove(true)
    return true
end
 
Nvm. Fixed. But if you have any other better way let me know.

Fixed:
Code:
local function allowMove(cid)
    local creature = Creature(cid)
    creature:setNoMove(false)
    return true
 end

function onCastSpell(creature, var)

    local outfit = {lookTypeEx = 0, lookType = 30, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookAddons = 0}
    doSetCreatureOutfit(creature, outfit, 700)
    doTargetCombatHealth(creature, creature:getTarget(), COMBAT_PHYSICALDAMAGE, -1, -2, CONST_ME_NONE)
    creature:setNoMove(true)
    addEvent(allowMove, 1 * 1000, creature.uid)
    return true
end
 
Check if the monster exists in your allowMove function, or it'll give an error if the monster dies before the event triggers.
 
Back
Top