• 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 Remove conditions

Warmix

New Member
Joined
Mar 28, 2010
Messages
18
Solutions
1
Reaction score
2
Lua:
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_SUBID, 1)
setConditionParam(condition, CONDITION_PARAM_TICKS, -1)
setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, 10)

local condition2 = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition2, CONDITION_PARAM_SUBID, 2)
setConditionParam(condition2, CONDITION_PARAM_TICKS, -1)
setConditionParam(condition2, CONDITION_PARAM_SKILL_AXE, 5)

player:addCondition(condition) -- axe 10
player:addCondition(condition2) -- axe 10+5 -> 15

player:removeCondition(CONDITION_ATTRIBUTES, 1) --axe 5

Why is it not working? How to delete condition with subid == 1?
 
Last edited:
Lua:
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_SUBID, 1)
setConditionParam(condition, CONDITION_PARAM_TICKS, -1)
setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, 10)

local condition2 = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition2, CONDITION_PARAM_SUBID, 2)
setConditionParam(condition2, CONDITION_PARAM_TICKS, -1)
setConditionParam(condition2, CONDITION_PARAM_SKILL_AXE, 5)

player:addCondition(condition) -- axe 10
player:addCondition(condition2) -- axe 10+5 -> 15

player:removeCondition(CONDITION_ATTRIBUTES, 1) --axe 5

Why is it not working? How to delete condition with subid == 1?
I dont really understand what you want to be done whit the script but if you change
Lua:
setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, 10)
for
Lua:
setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, -10)
that would remove 10 axe skills i think

edit:
not sure if this is the way to remove the condition either, i might not be the best guy to help you whit this since i've not been tinkering whit conditions that much or tfs 1.x
But i'll do my best :)
Code:
player:removeCondition(condition)
 
Last edited:
Thanks for answer, but I was looking something else and I think I found it.

Second param is conditionId so:

Code:
player:removeCondition(CONDITION_ATTRIBUTES, condition, 1)
 
Thanks for answer, but I was looking something else and I think I found it.

Second param is conditionId so:

Code:
player:removeCondition(CONDITION_ATTRIBUTES, condition, 1)
Im glad you figured it out ;)
but im still not sure what you are trying to do, since whats the point in adding 10 axe skill and then remove it straight away. I might not see the whole script, but whit the code you provided thats what it looks like to me.
 
but im still not sure what you are trying to do, since whats the point in adding 10 axe skill and then remove it straight away. I might not see the whole script, but whit the code you provided thats what it looks like to me.

I've showed you just example here. I use this knowledge to create large code and there will be necessary something like this :)
 
Back
Top