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

Lua VERY easy question about conditions (CONDITION_XXXXX)

angelobodj

Lazy OT Researcher
Joined
Dec 24, 2009
Messages
107
Reaction score
3
Location
Spain
Hello OTLand,

I'm playing around with conditions and I can't understand what I'm doing wrong.

I set this code to a talkaction:

Lua:
function onSay(cid, words, param, channel)
    local condition = createConditionObject(CONDITION_INFIGHT)
    setConditionParam(condition, CONDITION_PARAM_TICKS, 3000)
    doAddCondition(cid, condition)
    return TRUE
end

So, shouldn't that code give my character the small fight swords for 3 seconds and then dissapear?

It is just doing nothing, or applying any condition randomly.

I'm sure this is a really noob question, so I hope someone can explain me how to do it correctly :)

Greetings everyone :p
 
Last edited:
So, shouldn't that code give my character the small fight swords for 3 seconds and then dissapear?

Yes, be sure you have this inside the function.
Lua:
doAddCondition(cid, condition)
So for example with a talkaction, under function onSay(cid, words, param).
 
Yes, be sure you have this inside the function.
Lua:
doAddCondition(cid, condition)
So for example with a talkaction, under function onSay(cid, words, param).

Yeah, that's exactly what I did but it doesn't work :S

I updated first post with the full code I am using on my talkaction.
 
Add this above function onSay(cid, words, param)
Lua:
local condition = createConditionObject(CONDITION_INFIGHT)
setConditionParam(condition, CONDITION_PARAM_TICKS, 3000)
 
Add this above function onSay(cid, words, param)
Lua:
local condition = createConditionObject(CONDITION_INFIGHT)
setConditionParam(condition, CONDITION_PARAM_TICKS, 3000)

Alright, it is working perfectly now! Thanks a lot :)

Btw, isn't there a condition for protection zones? I can't see it in the const file :/
 
Back
Top