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

Fix/Patch [TFS 0.3b3] Change health if ghost.

Gelio

Lua PHP C++ programmer
Joined
Jun 13, 2008
Messages
61
Reaction score
4
Location
Poland, Lublin
Hello. I've written code for my ot server, because I didn't known when I was ghost. On TFS 0.3b3 if you are ghost nothing except message you can't see about it. So to know when I'm ghost I've written this code. It change your hp to 1 when you are ghost, and when ghost are disable your health change to max health. So, let'a go:
In talkaction.cpp:
Under:
Code:
		player->sendTextMessage(MSG_INFO_DESCR, "You are now invisible.");
Add:
Code:
		player->changeHealth(1);
Under:
Code:
		player->sendTextMessage(MSG_INFO_DESCR, "You are visible again.");
Add:
Code:
		player->changeHealth(player->getMaxHealth());
Now compile.


Yours,
Gelio
 
Simple but useful, well done.

@edit: I'm wondering but it won't work on 0.3RC1 (I've rebuilt all) :D
 
Last edited:
It isn't in my code. If you use this your HP will be lower than 0 (minus value), so you will dead.


Yours,
Gelio
 
I guess he also means to know if himself is invisible too, I think is a really good solution and will implement it to my server :p
 
What hapend to :
PHP:
player->changeHealth(1-player->getHealth());

It isn't in my code. If you use this your HP will be lower than 0 (minus value), so you will dead.


Yours,
Gelio

he is right, if you want to decrease the hitpoints of the god just by 1 use
PHP:
player->changeHealth(player->getHealth()-1);
the other way you will do 1-100 (saying that the hp of the gamemaster is actually 100 when you do ghost)
 
Use
Code:
player->changeHealth(-player->getHealth()+1);
if you wanna player using invisible to have 1hp (darkred hp bar). Just notice the case, which Elf mentioned to me, when /ghost can be used by somebody who DOES gain in fight (eg. senior tutor).
 
Last edited:
Use
Code:
player->changeHealth(-player->getHealth()+1);
if you wanna player using invisible to have 1hp (darkred hp bar). Just notice the case, which Elf mentioned to me, when /ghost can be used by somebody who DOES gain in fight (eg. senior tutor).

And why in the world would you allow senior tutors to go invisible?
 
That is Elf's case. Maybe somebody does it like that - I personally have doubts but it's possible ;)
 
ye thats what I was thinking since gods don't change health, the code wouldnt work unless you are not a gamemaster or a god

Edit: I have also tried stamina and soul and it dosen't work either. Expected tho, I dont know what you could do to notice that you are on ghost mode (there should be someway to change the name, but I think there is not GOD Zaxuhe - Ghost, would be cool)
 
Last edited:
Back
Top