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:31:02 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] Healing wave that gives uber  (Read 268 times)
Glider⠠⠵
Global Moderator
Sr. Member
*****
Posts: 413


⠠⠵


View Profile
« on: October 21, 2010, 01:14:53 PM »

Taken from a medic race I made for myself. This is the only remarkable thing about the race so I thought I might aswell share it.

Requires tf2_uber.inc

Code:
// Calls this from a timer, ability or whenever you want to do a healingwave
public HealingWave(client)
{
    new skill = War3_GetSkillLevel(client,thisRaceID,SKILL_HEALINGWAVE);
    if(skill>0)
    {
        new Float:dist = HealingWaveDistance[skill];
        new HealerTeam = GetClientTeam(client);
        new Float:HealerPos[3];
        GetClientAbsOrigin(client,HealerPos);
        new Float:VecPos[3];
        new Float:healed = 0.0;
        new Float:difference = 0.0;
       
        // Broadcast the healing ring
        new Float:vec[3];
        GetClientAbsOrigin(client, vec);
        vec[2] += 10;

        TE_SetupBeamRingPoint(vec, 10.0, dist, g_BeamSprite, g_HaloSprite, 0, 15, 0.5, 5.0, 0.0, Green, 10, 0);
        TE_SendToAll();
       
        // Search for teammates around (Don't heal yourself with this)
        if(client>0)
        {
            for(new i=1;i<=MaxClients;i++)
                    {
                        if(ValidPlayer(i,true)&&GetClientTeam(i)==HealerTeam&&(i!=client))
                        {
                            GetClientAbsOrigin(i,VecPos);
                            if(GetVectorDistance(HealerPos,VecPos)<=dist)
                            {
                                // Heal them, but remember how much we healed them by
                                difference = float(GetClientHealth(i));
                                new Float:VictimCurHP = float(GetClientHealth(i));
                                new Float:VictimMaxHP = float(War3_GetMaxHP(i));
                                if(VictimCurHP<VictimMaxHP)
                                {
                                    War3_HealToMaxHP(i,RoundToCeil(VictimMaxHP / 100 * HealingWaveAmount[skill]));
                                    healed = healed + GetClientHealth(i) - difference;
                                }
                            }
                        }
                    }
            if (TF2_GetPlayerClass(client) == TFClass_Medic)
            {
                // If the player is a medic add a small amount for the HP he recovered with the wave to his uber
                new Float:uberlevel = TF2_GetUberLevel(client);
                // 0.01 = 1%
                new Float:amount = healed / 5000;
                if(amount>0.0)
                {
                    if((amount+uberlevel)>1.0)
                    {
                        TF2_ExSetUberLevel(client, 1.0);
                    }
                    else
                    {
                        TF2_ExSetUberLevel(client, amount+uberlevel);
                    }
                }
            }
        }
    }
}
Logged

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!