• 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 How can I remove battle condition after using doCreatureAddMana with negative number?

Ramirez

New Member
Joined
Apr 11, 2013
Messages
19
Reaction score
0
Hey

When I try to change player's mana using
LUA:
setCreatureMaxMana(cid, getCreatureMaxMana(cid)-100)
doCreatureAddMana(cid, -100)
condition is changing to in battle.

Is there a way to remove mana without applying in battle condition?
Also when I'm using the spell blue string pops saying how much mana was removed. Can I change that?
 
Last edited:
Try using doPlayerAddMana instead of doCreatureAddMana.
And if you don't want to show how much mana was removed add a false in the end.

Example:

LUA:
doPlayerAddMana(cid, -100, false)
 
Still in battle.

I also tried
LUA:
doRemoveCondition(cid, CONDITION_INFIGHT)
and it works but it's ineffective because if player is already in battle then it will remove the condition which is unwanted.

The other part works :)
 
spells.xml
XML:
<instant name="Revert" words="revert" lvl="1" mana="0" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="revert.lua"></instant>

I've tested it on this part:
LUA:
if getPlayerVocation(cid) == 2 then ---ssj
		doPlayerSetVocation(cid, 1)
		setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)-200)
		doCreatureAddHealth(cid, -200)
		setCreatureMaxMana(cid, getCreatureMaxMana(cid)-100)
		doPlayerAddMana(cid, -100, false)
		--doRemoveCondition(cid, CONDITION_INFIGHT)
		doSetCreatureOutfit(cid, {lookType=30}, -1)
		doSendMagicEffect(getCreaturePosition(cid), 31)
		doPlayerSendCancel(cid, "You revert!")
 
Last edited:
LUA:
local state = getCreatureCondition(cid, CONDITION_INFIGHT)
-- do your transform stuff
-- set max health / mana
-- add 1 health / mana then remove it, if full health / mana remove 1 health / mana then add it
if not state then
    doRemoveCondition(cid, CONDITION_INFIGHT)
end
Summ posted this in your other thread rep him =d
 
Have it check the state before the spell is cast such as, in ongetformulavalues

- - - Updated - - -

that's why Summ's post says to put this local state = getCreatureCondition(cid, CONDITION_INFIGHT) at the top it will check the state before executing anything else
 
Back
Top