Winner gets free lollipop!
Code: Select all
#define TA // This is a TA script
#include "sfxtype.h"
#include "exptype.h"
piece base, body, aim, emitnano;
static-var Static_Var_1, Static_Var_2, statechg_DesiredState, statechg_StateChanging;
Activatescr()
{
sleep 1;
}
Deactivatescr()
{
sleep 1;
}
SmokeUnit(healthpercent, sleeptime, smoketype)
{
while( get BUILD_PERCENT_LEFT )
{
sleep 400;
}
while( TRUE )
{
healthpercent = get HEALTH;
if( healthpercent < 66 )
{
smoketype = 256 | 2;
if( Rand( 1, 66 ) < healthpercent )
{
smoketype = 256 | 1;
}
emit-sfx smoketype from aim;
}
sleeptime = healthpercent * 50;
if( sleeptime < 200 )
{
sleeptime = 200;
}
sleep sleeptime;
}
}
Go()
{
call-script Activatescr();
turn aim to y-axis Static_Var_1 speed <160.000000>;
wait-for-turn aim around y-axis;
set INBUILDSTANCE to 1;
}
Stop()
{
set INBUILDSTANCE to 0;
call-script Deactivatescr();
}
InitState()
{
statechg_DesiredState = TRUE;
statechg_StateChanging = FALSE;
}
RequestState(requestedstate, currentstate)
{
if( statechg_StateChanging )
{
statechg_DesiredState = requestedstate;
return (0);
}
statechg_StateChanging = TRUE;
currentstate = statechg_DesiredState;
statechg_DesiredState = requestedstate;
while( statechg_DesiredState != currentstate )
{
if( statechg_DesiredState == 0 )
{
call-script Go();
currentstate = 0;
}
if( statechg_DesiredState == 1 )
{
call-script Stop();
currentstate = 1;
}
}
statechg_StateChanging = FALSE;
}
Create()
{
call-script InitState();
start-script SmokeUnit();
Static_Var_1 = 0;
Static_Var_2 = 5000;
}
RestoreAfterDelay()
{
sleep Static_Var_2;
turn aim to y-axis <0.000000> speed <100.000000>;
wait-for-turn aim around y-axis;
}
Activate()
{
start-script RequestState(0);
}
Deactivate()
{
start-script RequestState(1);
}
StartBuilding(Func_Var_1)
{
Static_Var_1 = Func_Var_1;
start-script RequestState(0);
}
StopBuilding()
{
start-script RequestState(1);
}
QueryNanoPiece(piecenum)
{
piecenum = emitnano;
}
TargetHeading(Func_Var_1)
{
Static_Var_1 = 0 - Func_Var_1;
}
SweetSpot(piecenum)
{
piecenum = aim;
}
Killed(severity, corpsetype)
{
if( severity <= 25 )
{
corpsetype = 1;
explode base type BITMAPONLY | BITMAP1;
explode aim type BITMAPONLY | BITMAP3;
return (0);
}
if( severity <= 50 )
{
corpsetype = 2;
explode base type FALL | BITMAP1;
explode aim type FALL | BITMAP3;
return (0);
}
if( severity <= 99 )
{
corpsetype = 3;
explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1;
explode aim type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
return (0);
}
corpsetype = 3;
explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1;
explode aim type SHATTER | EXPLODE_ON_HIT | BITMAP3;
}