• 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) doCreatureSetNoMove Help

MarkSmartRemark

Lua-Noob in Training :D
Joined
Jan 27, 2010
Messages
139
Reaction score
3
Hi everyone,

sorry if im flooding request section..

I was wondering.. i want to use doCreatureSetNoMove in a spell.. it uses it for like 2 seconds and then cancels it.

the way i tried to do this was i put doCreatureSetNoMove(cid, true) and then put addEvent with function that makes doCreatureSetNoMove(cid, false). and it works HOWEVER, if the player switches targets while the spell waits for addEvent to happen, the player is stuck and cannot break free.. is there another way to put a time for doCreatureSetNoMove? or is AddEvent the only way?

if addEvent is the only way, can i make it so it recognizes the first player the spell was targetting?

Thanks in advance!
 
I'm using similar thing in my spell, so here it is, use it like an example:
Code:
local function onCastSpell1(cid, target)
doCreatureSetNoMove(target, true)
end

local function onCastSpell2(cid, target)
doCreatureSetNoMove(target, false)
end

function onCastSpell(cid, var)
local target = getCreatureTarget(cid)
addEvent(onCastSpell1, 0, cid, target)
addEvent(onCastSpell2, 3000, cid, target)
return true
end
I cleaned the code from combat things and left only the noMove part. Basically you need to get target ("local target = getCreatureTarget(cid)") before anything else, so even when you change the target the function will be using target from the beginning.
 
I'm using similar thing in my spell, so here it is, use it like an example:
Code:
local function onCastSpell1(cid, target)
doCreatureSetNoMove(target, true)
end

local function onCastSpell2(cid, target)
doCreatureSetNoMove(target, false)
end

function onCastSpell(cid, var)
local target = getCreatureTarget(cid)
addEvent(onCastSpell1, 0, cid, target)
addEvent(onCastSpell2, 3000, cid, target)
return true
end
I cleaned the code from combat things and left only the noMove part. Basically you need to get target ("local target = getCreatureTarget(cid)") before anything else, so even when you change the target the function will be using target from the beginning.

Thanks alot dude! worked perfectly.. sorry it took me a while loll had a busy weekend lmao but yea thanks once again
 
Back
Top