Alien Swarm

Alien Swarm

Not enough ratings
Creating mobile healing beacon via mapping
By Orange
Mobile healing for all players around with particle effects
   
Award
Favorite
Favorited
Unfavorite
New way
At first it is good to read older way to get the ideas. The main problem of it healing goes over MArineMaxHP limit and we can limit it only by 1 constant (max sarge's hp for example).This is sad for medics. For now we go new way via advanced script with more perfomance and overhealing fix


We need 1sec refire timer to run HealAllMarines() function via logic_script
and trigger_once to init script with StartFunc() (script starts timer from inside script) also output to stop script if core marine dies

Add particles via OnTrigger particle_name SetParent !activator

Thats all exept the script http://pastebin.com/92Jczdm7
const MaxNumberOfMarines = 8; const HealRadius = 96; MyVector <- Vector(5024, 8928, -1296); //trigger's origin coordinates ActivatorIndex <- 0; MarineStringArray <- ["#asw_name_sarge", "#asw_name_jaeger", "#asw_name_wildcat", "#asw_name_wolfe", "#asw_name_faith", "#asw_name_bastille", "#asw_name_crash", "#asw_name_vegas"]; MarineExistArray <- [0, 0, 0, 0, 0, 0, 0, 0]; MarinePossibleActivatorArray <- [0, 0, 0, 0, 0, 0, 0, 0]; MarineHpArray <- [140, 120, 80, 120, 80, 80, 80, 120]; Distances <- [null, null, null, null, null, null, null, null]; function StartFunc() { CheckMarineExist(); GetActivatorIndex(); EntFire("timer_last_healing", "Enable", 0); } function CheckMarineExist() { for ( local i = 0; i < MaxNumberOfMarines; i++ ) { ent <- Entities.FindByName(null, MarineStringArray);
if ( ent != null )
{
MarineExistArray = 1;
}
}
}

function GetActivatorIndex()
{
local TempDist = 64;
for ( local i = 0; i < MaxNumberOfMarines; i++ )
{
if (MarineExistArray == 1)
{
ent <- Entities.FindByNameNearest(MarineStringArray, MyVector, TempDist)
if (ent != null)
{
ActivatorIndex = i; //any possible activator to start as init in search for real one
MarinePossibleActivatorArray = 1
Distances = ent.GetOrigin() - MyVector
}
}
}

for (local i = 0; i < MaxNumberOfMarines; i++ ) //check for real activator
{
if (MarinePossibleActivatorArray == 1 && i != ActivatorIndex)
{
if (abs(Distances.x) <= abs(Distances[ActivatorIndex].x) &&
abs(Distances.y) <= abs(Distances[ActivatorIndex].y) &&
abs(Distances.z) <= abs(Distances[ActivatorIndex].z))
{
ActivatorIndex = i;
}
}
}
}

function HealAllMarines()
{
Basemarine <- Entities.FindByName(null, MarineStringArray[ActivatorIndex]);

local BasemarinePosition = Basemarine.GetOrigin();
local MarineHealth = Basemarine.GetHealth();

if (MarineHealth < MarineHpArray[ActivatorIndex])
{
Basemarine.SetHealth(MarineHealth+10);
}

for (local i = 0; i < MaxNumberOfMarines; i++ )
{
if (MarineExistArray == 1 && i != ActivatorIndex)
{
ent <- Entities.FindByNameWithin(null, MarineStringArray, BasemarinePosition, HealRadius)
if (ent != null)
{
MarineHealth = ent.GetHealth();
if (MarineHealth < MarineHpArray)
{
ent.SetHealth(MarineHealth+10);
}
}
}
}}[/code]
Old Way
To make this thing we need
1.trigger_once
2.trigger_multiple
3.2x logic_timer
4.2x info_particle_system
5.logic_script and custom script













At first since beacon healing is circle thing we need to create circular like trigger_multiple that will be main healing trigger for starttouch\endtouch events
In the middle of it we need small trigger_once to parent base trigger_multiple on marine so marine become "source of healing"
So with trigger_once we name our marine as "healedmarine", start particle effects and enable healing trigger_multiple

With trigger_multiple we parent particle effects and trigger itself on named marine and should make starttouch\endtouch to start\stop healing around. With OnStartTouch we name every touching marine same as healed played. Where is OnEndTouch? It added to here from trigger_once with AddOutput for reason to avoid bug. When u parent trigger_multiple it's output OnEndTouch fires immideatly even if marine still touching this. Ok so this EndTouch removes "healedmarine" name from non touching marines.

Now we need timer with script healing function. Make timer refire 1 second.

Make new text file in scripts\vscripts , name it morscript_m3.nut or something like this and add function inside of it


For example same way u can increase or multiple drone HP for real, instead of bugged settings on asw_spawner etc

2nd timer is to kill all stuff after Healing End time(60 seconds for example)


Nothing Special with particles












And the result:
1 Comments
Orange  [author] May 7, 2016 @ 1:39am 
Important fix of stupid engine bug - Never use EntFire(), use DoEntFire() instead. Otherwise it works only on local nonserver hosted maps
So here:
DoEntFire("timer_last_healing","Enable","0",0,null,null);