• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

paladin hurt

ConAn Edujawa

Member
Joined
Feb 23, 2015
Messages
457
Reaction score
17
anyone can help in paladin when get attacked losse 10% from mana and 90% from hp

example if monster or player hit paladin like 200 paladin losse 20 mana and 180 hp

tfs 0.4
 
Last edited:
I am attempting something like this myself but I fear it impossible in LUA.
However it is likely very straightforward for anybody with C++ knowledge.
EDIT:
Alternatively you could make it so that paladins have a permanent manashield but are refunded mana in exchange for health when they receive damage, possibly with onThink.
EDIT:
I take that all back, it might be possible with the latest TFS. Working on something now.
 
Last edited:
I am attempting something like this myself but I fear it impossible in LUA.
However it is likely very straightforward for anybody with C++ knowledge.
EDIT:
Alternatively you could make it so that paladins have a permanent manashield but are refunded mana in exchange for health when they receive damage, possibly with onThink.
EDIT:
I take that all back, it might be possible with the latest TFS. Working on something now.
Actually it is possible in both cases Lua & C++ but I am not familiar with 0.4 functions or framework. Sounds like I contradicted myself but this isn't the case what doesn't exist can be written, I am just not going to re-write all the functions. hehe
Isn't there an onstatschange function in 0.4? If that is the case you should be able to accomplish what you want to do. Any function which alters the state of a player's stats is always a good thing. ;)
 
At the moment I have this:

In creaturescripts:
<event type="HealthChange" name="paladinhurt" script="paladinhurt.lua" />

paladinhurt.lua:
Code:
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    player = Player(creature)
    if player:isPlayer() then
        if player:getVocation('Paladin') or player:getVocation('Royal Paladin') then
            if primaryType ~= COMBAT_HEALING then
                player:addMana(0.1*primaryDamage, true)
                return 0.9*primaryDamage, primaryType, secondaryDamage, secondaryType
            end
        end
    end     
                return primaryDamage, primaryType, secondaryDamage, secondaryType
end

this seems to work to your specifications

dont forget to put
player:registerEvent("paladinhurt")
in login.lua

If you have any problems or want anything else let me know
 
Last edited:
At the moment I have this:

In creaturescripts:


paladinhurt.lua:


this seems to work to your specifications

dont forget to put

in login.lua

If you have any problems or want anything else let me know
Unfortunately that code won't work in 0.4 :(
 
What exactly is the problem? I don't know the difference between 0.4 and the version of TFS I am using, can you enlighten me?
Hopefully, it will be useful for someone else at least if not OP.
It has already been useful for me because I am currently working on an item which makes you take half of the physical damage you take as bleeding over subsequent turns.
 
What exactly is the problem? I don't know the difference between 0.4 and the version of TFS I am using, can you enlighten me?
Hopefully, it will be useful for someone else at least if not OP.
It has already been useful for me because I am currently working on an item which makes you take half of the physical damage you take as bleeding over subsequent turns.
The functions differ from one distribution to another. Here is an example.
0.4
LUA:
isPlayer(cid)
1.1+
LUA:
thing:isPlayer()
In 0.4 the interface is called onStatsChange. The interface you provided onHealthChange will not work inside of an 0.4 server because it isn't defined in the sources nor will the code it contains work.
0.4
C++:
onStatsChange(cid, attacker, type, combat, value)
1.3
C++:
onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
Even the arguments given are different, 0.4 uses primarily functions in its scripts passing basic values whereas 1.x uses metamethods on userdata or metatables.

0.4
GitHub - Extrodus/TFS-0.4-rev.3884: TFS 3884 for 8.6

1.3
GitHub - otland/forgottenserver: A free and open-source MMORPG server emulator written in C++
 
I see, thank you very much.
Correct me if I am wrong but that does not seem hard to translate provided the functions I used all exist in some form?
My methodology would be:
onStatsChange(cid, attacker, type, combat, value)
if isPlayer(cid) then
if _healthischanging_ then
if getPlayerVocationName(cid) == 'Paladin' or getPlayerVocationName(cid) == 'Royal Paladin' then
if type ~= COMBAT_HEALING then
_doremovemana(cid, 0.1*value)
_dosomecombatfunction(cid, 0.9*value, type)
return false
end
end
end
end
return true
end

without better knowledge of 0.4 I cannot proceed
 
Back
Top