Archived copy of war3source.com, the War3Source forum (2009–2020), rebuilt from the Internet Archive by wc3mods.net. This page was captured on 2012-10-24 (original capture). Forum · All archived topics · Wiki · Bug tracker · Blog
Chat

War3:Source
October 24, 2012, 03:26:01 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Download: http://war3source.com/index.php?board=9.0
What is War3Source?: http://war3source.com/index.php?topic=200.0
Sample Stats: http://war3source.com/war3stats
Steam Community Group: http://steamcommunity.com/groups/war3source
War3Source SVN Checkout: http://ownageclan.com/svn/war3source/
War3Source servers: http://www.game-monitor.com/search.php?vars=war3_version=
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [TF2] Setting max health and keeping it there :|  (Read 499 times)
Smilax
Newbie
*
Posts: 34


I make things for tf2.


View Profile WWW Email
« on: July 22, 2011, 03:35:25 PM »

I'm just trying to keep the health static.
It wont stay.
I've been meandering around the sourcemod forums for a while and couldn't find anything, just trying to set and keep health.
This is what I have so far but I don't know a way to keep health static other then setting arrays for every health value possible, intercepting damage and applying it to keep hp values right but that's so much more work then should be neccessary.

This is my current code, it sets the max hp just fine. That stupid overheal decay thing is what's killing me. Is there anyway to disable that on a client basis?
Code:

new DragonbornHealthMedic[5]={150,156,162,168,175};//Yay class specific health bonus's
new DragonbornHealthScout[5]={125,130,135,140,145};
new DragonbornHealthHeavy[5]={300,315,330,345,360};
new DragonbornHealthDemoMan[5]={175,183,190,198,205};
new DragonbornHealthSniper[5]={125,130,135,140,145};
new DragonbornHealthSpy[5]={125,130,135,140,145};
new DragonbornHealthSoldier[5]={200,210,220,230,240};
new DragonbornHealthPyro[5]={175,183,190,198,205};
new DragonbornHealthEngineer[5]={125,130,135,140,145};

public OnWar3EventSpawn(client)
{
    CreateTimer(0.1, TimerPlayerSpawn, client);
}

public Action:TimerPlayerSpawn(Handle:timer, any:client)
{
new skilllevel_health=War3_GetSkillLevel(client,thisRaceID,SKILL_DRAGONBORN);
new TFClassType:class = TF2_GetPlayerClass(client);
if (class == TFClass_Medic)
{
new medhealth=DragonbornHealthMedic[skilllevel_health];
SetEntData(client, FindDataMapOffs(client, "m_iMaxHealth"), medhealth, 4, true);
SetEntData(client, FindDataMapOffs(client, "m_iHealth"), medhealth, 4, true);
}
if (class == TFClass_Scout)
{
new medhealth=DragonbornHealthScout[skilllevel_health];
SetEntData(client, FindDataMapOffs(client, "m_iMaxHealth"), medhealth, 4, true);
SetEntData(client, FindDataMapOffs(client, "m_iHealth"), medhealth, 4, true);
}
if (class ==  TFClass_Heavy)
{
new medhealth=DragonbornHealthHeavy[skilllevel_health];
SetEntData(client, FindDataMapOffs(client, "m_iMaxHealth"), medhealth, 4, true);
SetEntData(client, FindDataMapOffs(client, "m_iHealth"), medhealth, 4, true);
}
if (class ==  TFClass_DemoMan)
{
new medhealth=DragonbornHealthDemoMan[skilllevel_health];
SetEntData(client, FindDataMapOffs(client, "m_iMaxHealth"), medhealth, 4, true);
SetEntData(client, FindDataMapOffs(client, "m_iHealth"), medhealth, 4, true);
}
if (class ==  TFClass_Sniper)
{
new medhealth=DragonbornHealthSniper[skilllevel_health];
SetEntData(client, FindDataMapOffs(client, "m_iMaxHealth"), medhealth, 4, true);
SetEntData(client, FindDataMapOffs(client, "m_iHealth"), medhealth, 4, true);
}
if (class ==  TFClass_Spy)
{
new medhealth=DragonbornHealthSpy[skilllevel_health];
SetEntData(client, FindDataMapOffs(client, "m_iMaxHealth"), medhealth, 4, true);
SetEntData(client, FindDataMapOffs(client, "m_iHealth"), medhealth, 4, true);
}
if (class ==  TFClass_Soldier)
{
new medhealth=DragonbornHealthSoldier[skilllevel_health];
SetEntData(client, FindDataMapOffs(client, "m_iMaxHealth"), medhealth, 4, true);
SetEntData(client, FindDataMapOffs(client, "m_iHealth"), medhealth, 4, true);
}
if (class ==  TFClass_Pyro)
{
new medhealth=DragonbornHealthPyro[skilllevel_health];
SetEntData(client, FindDataMapOffs(client, "m_iMaxHealth"), medhealth, 4, true);
SetEntData(client, FindDataMapOffs(client, "m_iHealth"), medhealth, 4, true);
}
if (class ==  TFClass_Engineer)
{
new medhealth=DragonbornHealthEngineer[skilllevel_health];
SetEntData(client, FindDataMapOffs(client, "m_iMaxHealth"), medhealth, 4, true);
SetEntData(client, FindDataMapOffs(client, "m_iHealth"), medhealth, 4, true);
}
}
Logged

Ownz
Developer
Administrator
Hero Member
*****
Posts: 2045



View Profile WWW Email
« Reply #1 on: July 22, 2011, 03:36:42 PM »

theres a global cvar to disable overheal decay, but thats it

i would do what human does, constantly loop to add health back if player wasn't damaged
Logged

DarkEnergy
Smilax
Newbie
*
Posts: 34


I make things for tf2.


View Profile WWW Email
« Reply #2 on: July 22, 2011, 03:58:57 PM »

I figured out a way to do it

public OnGameFrame() //HAH a way to keep hp static
{
     for (new i=1;i<MaxClients; i++)
     {
          if (IsClientInGame(i)&&IsPlayerAlive(i))
          {
               TF2_AddCondition(i, TFCond_Healing, 1.0);
          }
     }
}
Logged

Ownz
Developer
Administrator
Hero Member
*****
Posts: 2045



View Profile WWW Email
« Reply #3 on: July 22, 2011, 04:00:04 PM »

it wont add hp right? even if its below 100 hp?
Logged

DarkEnergy
Smilax
Newbie
*
Posts: 34


I make things for tf2.


View Profile WWW Email
« Reply #4 on: July 24, 2011, 11:23:35 AM »

Yep, it only keeps the heal status so that health doesn't degrade.

If you get overhealed your health will stay but I can write in something to take it down, but really that was the closest I could get.
Logged

Ownz
Developer
Administrator
Hero Member
*****
Posts: 2045



View Profile WWW Email
« Reply #5 on: August 12, 2011, 08:27:14 AM »

TF2_AddCondition(i, TFCond_Healing, 1.0); somehow adds particles along with it...
Logged

DarkEnergy
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!