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

AddHealth() with no animation

bizao030188

Member
Joined
Jun 4, 2012
Messages
50
Solutions
2
Reaction score
7
Hey there!
Is it possible to cast lua command monster:addHealth() with no animation at all?

I appreciate any kind of help!
 
Solution
Hi, thanks for your help! Yes, it could be done with conditions. The problem is that conditions have some delay (even setting ticks and healthticks = 1) , and I don't know how to eliminate them. In my script I want to summon a monster with, let's say, half its life. If I use conditions, the monster appears with full life and then loses (with no animation) its life. On the other hand, if I use addHealth, the life appears instantly at half but with the animation of loosing health.
I needed something like that, I ended up modifying function in source to use parameter to send the change or not. I think TFS lack function which would silently set creature health, gonna make a pull request in main repo soon.

doTargetCombatHealth(0...
I'm not sure about how this function works, but I'm sure that you can do it using conditions
Code:
local healthGain = 10000
local condition = Condition(CONDITION_REGENERATION)
condition:setParameter(CONDITION_PARAM_TICKS, 1 * 1000)
condition:setParameter(CONDITION_PARAM_HEALTHGAIN, healthGain)
condition:setParameter(CONDITION_PARAM_HEALTHTICKS, 10)
monster:addCondition(condition)
monster:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
it would solve ur problem to not show the "cure"
 
I'm not sure about how this function works, but I'm sure that you can do it using conditions
Code:
local healthGain = 10000
local condition = Condition(CONDITION_REGENERATION)
condition:setParameter(CONDITION_PARAM_TICKS, 1 * 1000)
condition:setParameter(CONDITION_PARAM_HEALTHGAIN, healthGain)
condition:setParameter(CONDITION_PARAM_HEALTHTICKS, 10)
monster:addCondition(condition)
monster:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
it would solve ur problem to not show the "cure"

Hi, thanks for your help! Yes, it could be done with conditions. The problem is that conditions have some delay (even setting ticks and healthticks = 1) , and I don't know how to eliminate them. In my script I want to summon a monster with, let's say, half its life. If I use conditions, the monster appears with full life and then loses (with no animation) its life. On the other hand, if I use addHealth, the life appears instantly at half but with the animation of loosing health.
 
Hi, thanks for your help! Yes, it could be done with conditions. The problem is that conditions have some delay (even setting ticks and healthticks = 1) , and I don't know how to eliminate them. In my script I want to summon a monster with, let's say, half its life. If I use conditions, the monster appears with full life and then loses (with no animation) its life. On the other hand, if I use addHealth, the life appears instantly at half but with the animation of loosing health.
I needed something like that, I ended up modifying function in source to use parameter to send the change or not. I think TFS lack function which would silently set creature health, gonna make a pull request in main repo soon.

doTargetCombatHealth(0, target, healMin, healMax, CONST_ME_NONE)
This will be visible too.

Made a pull request: Adding creature:setHealth() method by nekiro · Pull Request #2408 · otland/forgottenserver · GitHub
 
Last edited:
Solution
Maybe you can set it's Max Hp to the half and then back to it's normal Max Hp.
Like:
creature:setMaxHealth(x)
creature:setMaxHealth(MonsterType(creature:getName()):getMaxHealth())
 
Maybe you can set it's Max Hp to the half and then back to it's normal Max Hp.
Like:
creature:setMaxHealth(x)
creature:setMaxHealth(MonsterType(creature:getName()):getMaxHealth())

Good idea! It works fine.. Thanks!
So we end out with 2 solutions. The first is cleaner and the second is easier to implement.
 
Good idea! It works fine.. Thanks!
So we end out with 2 solutions. The first is cleaner and the second is easier to implement.
Actually the second answer still have an animation but at least it is not of the amount of health lost
What are the two solutions? Which one has animation?
I'm pretty sure setting max health will get you what you were looking for.
 
What are the two solutions? Which one has animation?
I'm pretty sure setting max health will get you what you were looking for.
You are right. The animation that I was seeing came from other command.
So both solutions work fine.

first:
I needed something like that, I ended up modifying function in source to use parameter to send the change or not. I think TFS lack function which would silently set creature health, gonna make a pull request in main repo soon.


This will be visible too.

Made a pull request: Adding creature:setHealth() method by nekiro · Pull Request #2408 · otland/forgottenserver · GitHub

second:
Maybe you can set it's Max Hp to the half and then back to it's normal Max Hp.
Like:
creature:setMaxHealth(x)
creature:setMaxHealth(MonsterType(creature:getName()):getMaxHealth())
 
You shouldn't set max health to other value than it is default to set creature health to whatever you want. My pr should be working, give it a try.
 
Last edited:
You shouldn't set max health to other value that it is default to set creature health to whatever you want. My pr should be working, give it a try.
I've implemented your pr on TFS 1.2 but it is not working as I expected. I created the following lua script that is activated saying !createspider:

Lua:
function onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end
    local monster = Game.createMonster("Spider", player:getPosition())
    if monster then
        monster:setHealth(5)
    end
end

The monster is created with no life at all and disappears after 1 second.
Thanks
 
I've implemented your pr on TFS 1.2 but it is not working as I expected. I created the following lua script that is activated saying !createspider:

Lua:
function onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true

[QUOTE="Itutorial, post: 2485838, member: 209303"][code=Lua]
local monster = Game.createMonster("Spider", player:getPosition(), 0, 1)
use true and false instead of number values and if you are refering to his post then it doesnt matter.
 
Back
Top