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

A simple fix (Request)

Siegh

Thronar Developer
Joined
Mar 12, 2011
Messages
1,308
Solutions
1
Reaction score
693
Location
Brazil
Please, I need a small fix on this spell script. Everything is working fine but the bolded parts, where I try to check the caster's target.

This spell is supposed to make you and your target muted, disabled and unable to move with a certain sucess rate. The problem is: the caster condition part is working fine, but not his target's condition, neither the muted, disable or setNoMove.

Id like to someone please show me how to check my target correctly, since this method isnt working.

Code:
function onCastSpell(cid, var)
rand = math.random(0,100)
[I][B]local target = getCreatureTarget(cid)[/B][/I]
local pos = getPlayerPosition(cid)
local targetpos = getCreaturePosition(target)
 
if rand <= 70 then
addEvent(doAddCondition, 1000, cid, disable)
addEvent(doAddCondition, 1000, cid, muted)

[I][B]addEvent(doAddCondition, 1000, target, disable)
addEvent(doAddCondition, 1000, target, muted)[/B][/I]

addEvent(doSendMagicEffect, 1, pos, 45)
addEvent(doSendMagicEffect, 1000, pos, 45)
addEvent(doSendMagicEffect, 2000, pos, 45)
addEvent(doSendMagicEffect, 3000, pos, 45)
addEvent(doSendMagicEffect, 4000, pos, 45)

addEvent(doSendMagicEffect, 1000, targetpos, 45)
addEvent(doSendMagicEffect, 2000, targetpos, 45)
addEvent(doSendMagicEffect, 3000, targetpos, 45)
addEvent(doSendMagicEffect, 4000, targetpos, 45)

addEvent(doCreatureSetNoMove, 1, cid, 1)
[I][B]addEvent(doCreatureSetNoMove, 1, target, 1)[/B][/I]

addEvent(doCreatureSetNoMove, 5000, cid, 0)
[I][B]addEvent(doCreatureSetNoMove, 5000, target, 0)[/B][/I]

else
doSendMagicEffect((getPlayerPosition(cid)), 46)
doSendAnimatedText((getPlayerPosition(cid)),"Failed!", 66)
end
return true
end

Thanks in advance.
 
Last edited:
Hmm, I believe this is not the problem since the function is working when I put cid, with 1/0 or true/false (anyway, 1 = true so its the same thing). As I said the caster conditions are working fine, just cant make it work for my target aswell.
 
Back
Top