• 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 Mana shield not working

Joined
May 5, 2017
Messages
71
Solutions
5
Reaction score
15
I haven't done anything to this script. Every time I get hit by a creature it takes from my hp and not my mana when manashield is active.

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)

local condition = Condition(CONDITION_MANASHIELD)
condition:setParameter(CONDITION_PARAM_TICKS, 200000)
combat:setCondition(condition)

function onCastSpell(creature, variant)
    return combat:execute(creature, variant)
end
Is there something special I need to do to get the creature to take from my mana?

I am bumping this because the support team person skipped over it. Clearly I am not asking you to write me a script I just like to know if this is expected behavior that mana shield when casted only provides an icon but no real mana shield.
 
Last edited by a moderator:
it's clearly unintended behavior, you must either have a modified source or some onManaChange creature event which takes from your health instead of mana
or if you're using the latest clean 1.3, it could be a bug within the original code, in which case you should post an issue on github about it
 
I haven't done anything to this script. Every time I get hit by a creature it takes from my hp and not my mana when manashield is active.

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)

local condition = Condition(CONDITION_MANASHIELD)
condition:setParameter(CONDITION_PARAM_TICKS, 200000)
combat:setCondition(condition)

function onCastSpell(creature, variant)
    return combat:execute(creature, variant)
end
Is there something special I need to do to get the creature to take from my mana?

I am bumping this because the support team person skipped over it. Clearly I am not asking you to write me a script I just like to know if this is expected behavior that mana shield when casted only provides an icon but no real mana shield.

Please note that we are not required to answer any threads, didn't read your thread earlier today I only responded to a couple of threads from yesterday.
It does not give you the right to double post (have you read the rules? Rules for the Support board ref #2)

But @Xeraphus was quicker, do what he said and start by checking onManaChange and go from there.
 
it's clearly unintended behavior, you must either have a modified source or some onManaChange creature event which takes from your health instead of mana
or if you're using the latest clean 1.3, it could be a bug within the original code, in which case you should post an issue on github about it
I have not altered the source in regards to anything dealing with health or mana or player/creature in general. And yes I am using 1.3 I have a training monk which is attacking me with physical damage and no other types of attacks. Mana shield or no mana shield when it hits my character it always takes from my health.
 
I have not altered the source in regards to anything dealing with health or mana or player/creature in general. And yes I am using 1.3 I have a training monk which is attacking me with physical damage and no other types of attacks. Mana shield or no mana shield when it hits my character it always takes from my health.

Did you check onManaChange in events?
Try another TFS (download a fresh one and see if you still have the bug, might have been reported and fixed after you downloaded the code)
Is it only with that monster?
 
Did you check onManaChange in events?
Try another TFS (download a fresh one and see if you still have the bug, might have been reported and fixed after you downloaded the code)
Is it only with that monster?
Actually I looked through the sources and the only check I found that asks the question whether a player has manshield on or not is in game.cpp
forgottenserver/game.cpp at master · otland/forgottenserver · GitHub
And this is only if the primary damage type is less than or equal to 0
forgottenserver/game.cpp at master · otland/forgottenserver · GitHub
According to the tutorial @Evan
[TFS 1.0] Critical Hit % - Permanent
The primary damage type in this case is physical so the server is completely ignoring the manashield check which defeats the purpose of having manashield. I can make the changes in the sources for it to effect manashield I was just curious if this was expected behavior.
 
Actually I looked through the sources and the only check I found that asks the question whether a player has manshield on or not is in game.cpp
forgottenserver/game.cpp at master · otland/forgottenserver · GitHub
And this is only if the primary damage type is less than or equal to 0
forgottenserver/game.cpp at master · otland/forgottenserver · GitHub
According to the tutorial @Evan
[TFS 1.0] Critical Hit % - Permanent
The primary damage type in this case is physical so the server is completely ignoring the manashield check which defeats the purpose of having manashield. I can make the changes in the sources for it to effect manashield I was just curious if this was expected behavior.

But is it not working at all or at certain situations?
If it's not working at all it's not the way it should work, do as I said and try another TFS version if you don't have any onHealthChange or onManaChange scripts.
Never heard of this tbh
 
Back
Top