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

onAttack - Help

kakashihatak

New Member
Joined
Nov 18, 2010
Messages
12
Reaction score
0
I'm having a little problem ...
I'm trying to stage the event mosnter condition_drunk had with him can not atack
and the condition disappears after he returns to attack
fis more so I did not have much success
Code:
function onAttack(cid, target)
       local pos = getCreaturePosition(cid)
     if getCreatureCondition(cid, CONDITION_DRUNK) == TRUE then
	    doSendAnimatedText(pos, 'Fail', 215)     
     end            

return TRUE
end

if anyone can help me

thx
 
Lua:
function onAttack(cid, target)
    if getCreatureCondition(cid, CONDITION_DRUNK) then
        return false, doSendAnimatedText(getThingPos(cid), 'Fail', 215)
     end            
    return true
end
 
Do not work here
now sends the message once and not again after Atack
My intention is that while you are on the condition he not be sending the message Atack

thx
 
nobody can help me?
I did not understand why the error
return false if I put it performs a single time
and he's not coming back to attack someone help me?
 
try
Lua:
function changeTarget(cid)
	if doMonsterChangeTarget(cid) then
		return true
	else
		return false,addEvent(changeTarget,100,cid)
	end
end

function onTarget(cid, target)
	if getCreatureCondition(cid,CONDITION_DRUNK) then
		doSendAnimatedText(getThingPos(cid), 'Fail', 215)
		if doMonsterChangeTarget(cid) then
			return true
		else
			return false,addEvent(changeTarget,100,cid)
		end
	end
	return true
end
 
I'm trying to stage the event mosnter condition_drunk had with him can not atack
and the condition disappears after he returns to attack

I cant undertand u!! You mean he return to attack after the condtion disappear?
 
That's right this way
Code:
function onAttack(cid, target)
    if getCreatureCondition(cid, CONDITION_DRUNK) then
        return false, doSendAnimatedText(getThingPos(cid), 'Fail', 215)
     end            
    return true
end
until it worked but he did not return after the strike ends the condition
 
Back
Top