armspartan脚本分析- from from fonter456

#define TA // This is a TA script
#include “sfxtype.h”
#include “exptype.h”
piece base, pelvis, torso, shield, arm, gun, rthigh, rleg, lthigh, lleg, flare, sh1, sh2, sh3, sh4, sh5, sh6, sh7, sh8, shields;
static-var restore_delay, bMoving, aimingat, armored;
// Signal definitions
#define SIG_AIM 2
#define SIG_SH 4
#define BLINK_SHIELD\

replace()
{
while(1)
{
if(!armored)
{
sleep 5000;
show shield;
set ARMORED to TRUE;
armored = 1;
}
sleep 1000;
}
}

HitByWeapon(x, z) //这就是脚本的重点,被击中的脚本
{
if(armored)
{
var hitangle;
var aimangle;
hitangle = <180> - (get ATAN(z, x));
aimangle = 0 - aimingat;
var dif;
var isok;

if(hitangle < 0)
{
hitangle = hitangle + <360>;
}
if(aimangle < 0)
{
aimangle = aimangle + <360>;
}
if(hitangle > <360>)
{
hitangle = hitangle - <360>;
}
if(aimangle > <360> )
{
aimangle = aimangle + <360>;
}

dif = hitangle - aimangle;

if(dif >= <180>)
{
dif = <360> - dif;
}

if(dif <= <-180>)
{
dif = dif + <360>;
}
isok = 0;

if(dif < <90> && dif > <-90>)
{
isok = 1;
}

if(!isok)
{
set ARMORED to FALSE;
armored = 0;
explode shield type SHATTER | BITMAP2;
hide shield;
}

if(isok)
{
turn shields to y-axis -1*hitangle now;
signal SIG_SH;
set-signal-mask SIG_SH;
hide sh1;
hide sh2;
hide sh3;
hide sh4;
hide sh5;
hide sh6;
hide sh7;
hide sh8;

show sh1;
sleep 100;
hide sh1;

show sh2;
sleep 100;
hide sh2;

show sh3;
sleep 100;
hide sh3;

show sh4;
sleep 100;
hide sh4;

show sh5;
sleep 100;
hide sh5;

show sh6;
sleep 100;
hide sh6;

show sh7;
sleep 100;
hide sh7;

show sh8;
sleep 100;
hide sh8;
}
}
}

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 base;
}
sleeptime = healthpercent * 50;
if( sleeptime < 200 )
{
sleeptime = 200;
}
sleep sleeptime;
}
}
Create()
{
start-script replace();
set ARMORED to TRUE;
armored = 1;
aimingat=0;
hide flare;
dont-cache flare;
restore_delay = 3000;

dont-cache sh1;
dont-cache sh2;
dont-cache sh3;
dont-cache sh4;
dont-cache sh5;
dont-cache sh6;
dont-cache sh7;
dont-cache sh8;

hide sh1;
hide sh2;
hide sh3;
hide sh4;
hide sh5;
hide sh6;
hide sh7;
hide sh8;

bMoving=0;

start-script SmokeUnit();
}
SetMaxReloadTime(Func_Var_1)
{
restore_delay = Func_Var_1 * 2;
}
RestoreAfterDelay()
{
sleep restore_delay;
aimingat = 0;
turn torso to y-axis <0.000000> speed <90.021978>;
turn arm to x-axis <0.000000> speed <50.010989>;
}
AimPrimary(heading, pitch)
{
signal SIG_AIM;
set-signal-mask SIG_AIM;
aimingat = heading;
turn torso to y-axis heading speed <100.021978>;
turn arm to x-axis <0.000000> - pitch speed <80.010989>;
wait-for-turn torso around y-axis;
wait-for-turn gun around x-axis;
start-script RestoreAfterDelay();
return (1);
}
FirePrimary()
{
show flare;
move gun to z-axis [-3.400000] speed [500.000000];
sleep 150;
hide flare;
wait-for-move gun along z-axis;
move gun to z-axis [0.000000] speed [3.000000];
}
AimFromPrimary(piecenum)
{
piecenum = arm;
}
QueryPrimary(piecenum)
{
piecenum = flare;
}
SweetSpot(piecenum)
{
piecenum = base;
}
Walk()
{
while(bMoving)
{
if( bMoving )
{
move pelvis to y-axis [-0.300000] now;
turn pelvis to x-axis <13.010989> now;
turn rthigh to x-axis <17.230769> now;
turn lthigh to x-axis <-48.879121> now;
turn lleg to x-axis <32.351648> now;
turn rleg to x-axis <17.230769> now;
sleep 110;
}
if( bMoving )
{
move pelvis to y-axis [-0.200000] now;
turn pelvis to x-axis <9.142857> now;
turn rthigh to x-axis <30.241758> now;
turn lthigh to x-axis <-32.351648> now;
turn lleg to x-axis <22.153846> now;
turn rleg to x-axis <17.582418> now;
sleep 110;
}
if( bMoving )
{
move pelvis to y-axis [0.050000] now;
turn pelvis to x-axis <6.329670> now;
turn rthigh to x-axis <-0.346154> now;
turn lthigh to x-axis <-22.857143> now;
turn rleg to x-axis <63.642857> now;
sleep 110;
}
if( bMoving )
{
move pelvis to y-axis [0.200000] now;
turn pelvis to x-axis <2.813187> now;
turn rthigh to x-axis <-28.478022> now;
turn lthigh to x-axis <-10.901099> now;
turn rleg to x-axis <84.395604> now;
sleep 110;
}
if( bMoving )
{
turn pelvis to x-axis <0.000000> now;
turn rthigh to x-axis <-32.351648> now;
turn lthigh to x-axis <1.406593> now;
sleep 110;
}
if( bMoving )
{
move pelvis to y-axis [-0.050000] now;
turn pelvis to x-axis <4.219780> now;
turn rthigh to x-axis <-42.901099> now;
turn lthigh to x-axis <11.252747> now;
turn lleg to x-axis <29.538462> now;
turn rleg to x-axis <79.472527> now;
sleep 110;
}
if( bMoving )
{
move pelvis to y-axis [-0.450000] now;
turn pelvis to x-axis <13.010989> now;
turn rthigh to x-axis <-48.873626> now;
turn lthigh to x-axis <12.302198> now;
turn lleg to x-axis <28.835165> now;
turn rleg to x-axis <32.703297> now;
sleep 110;
}
if( bMoving )
{
move pelvis to y-axis [-0.200000] now;
turn pelvis to x-axis <9.142857> now;
turn rthigh to x-axis <-33.758242> now;
turn lthigh to x-axis <3.159341> now;
turn lleg to x-axis <47.824176> now;
sleep 110;
}
if( bMoving )
{
move pelvis to y-axis [-0.050000] now;
turn pelvis to x-axis <6.329670> now;
turn rthigh to x-axis <-25.670330> now;
turn lthigh to x-axis <-11.604396> now;
turn lleg to x-axis <66.461538> now;
sleep 110;
}
if( bMoving )
{
move pelvis to y-axis [0.200000] now;
turn pelvis to x-axis <2.813187> now;
turn rthigh to x-axis <-15.120879> now;
turn lthigh to x-axis <-27.076923> now;
sleep 110;
}
if( bMoving )
{
turn pelvis to x-axis <0.000000> now;
turn rthigh to x-axis <2.109890> now;
turn lthigh to x-axis <-34.109890> now;
turn lleg to x-axis <68.571429> now;
sleep 110;
}
if( bMoving )
{
move pelvis to y-axis [-0.049994] now;
turn pelvis to x-axis <4.219780> now;
turn rthigh to x-axis <11.252747> now;
turn lthigh to x-axis <-44.307692> now;
turn lleg to x-axis <75.604396> now;
sleep 110;
}
turn pelvis to x-axis <0> now;
turn rthigh to x-axis <0> now;
turn rleg to x-axis <0> now;
turn lthigh to x-axis <0> now;
turn lleg to x-axis <0> now;
move pelvis to y-axis [0] now;
}
return (0);
}
StartMoving()
{
if(!bMoving)
{
start-script walk();
}
bMoving=1;
}
StopMoving()
{
bMoving=0;
}
Killed(severity, corpsetype)
{
hide flare;
if( severity <= 25 )
{
corpsetype = 1;
explode gun type BITMAPONLY | BITMAP1;
explode base type BITMAPONLY | BITMAP2;
explode flare type BITMAPONLY | BITMAP3;
explode arm type BITMAPONLY | BITMAP4;
explode torso type BITMAPONLY | BITMAP5;
return (0);
}
if( severity <= 50 )
{
corpsetype = 2;
explode gun type FALL | BITMAP1;
explode base type BITMAPONLY | BITMAP2;
explode flare type FALL | BITMAP3;
explode arm type FALL | BITMAP4;
explode torso type SHATTER | BITMAP5;
return (0);
}
if( severity <= 99 )
{
corpsetype = 3;
explode gun type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1;
explode base type BITMAPONLY | BITMAP2;
explode flare type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode arm type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
explode torso type SHATTER | BITMAP5;
return (0);
}
corpsetype = 3;
explode gun type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1;
explode base type BITMAPONLY | BITMAP2;
explode flare type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode arm type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
explode torso type SHATTER | EXPLODE_ON_HIT | BITMAP5;
}
armspartan.rar (5.26 KB)
ARMSPARTAN.jpg

样子不错,是第三方单位还是新的MOD的单位?

TALON单元。因太囧取消了。。。

脚本得花点心思。