TALON航母的脚本,要求将两个建造位置改为飞机维修平台,因为这种移动建造比较烦。。。
#define TA // This is a TA script
#define plantheight 2449660
#define height 593536
#include “sfxtype.h”
#include “exptype.h”
piece pad1, flare1, flare2, flare3, base, dish, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, wakes, turret, gun, pad2, pad3;
static-var Static_Var_1, gun_1, statechg_DesiredState, statechg_StateChanging, ifplant, padnum;
// Signal definitions
#define SIG_MOVE 2
#define SIG_AIM 4
// Lowest valid unit ID number
#ifndef MIN_ID
#define MIN_ID 69
#endif
// Highest valid unit ID number
#ifndef MAX_ID
#define MAX_ID 70
#endif
// ID of current unit
#ifndef MY_ID
#define MY_ID 71
#endif
// Player number of the unit given in parameter
#ifndef UNIT_TEAM
#define UNIT_TEAM 72
#endif
// Like BUILD_PERCENT_LEFT, but comes with a unit parameter
#ifndef UNIT_BUILD_PERCENT_LEFT
#define UNIT_BUILD_PERCENT_LEFT 73
#endif
// Is unit allied to the current COB script
#ifndef UNIT_ALLIED
#define UNIT_ALLIED 74
#endif
// Is unit owned by the local computer
#ifndef UNIT_IS_ON_THIS_COMP
#define UNIT_IS_ON_THIS_COMP 75
#endif
// Kills * 100
#ifndef VETERAN_LEVEL
#define VETERAN_LEVEL 32
#endif
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 )
{
currentstate = 0;
}
if( statechg_DesiredState == 1 )
{
currentstate = 1;
}
}
statechg_StateChanging = FALSE;
}
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;
}
}
RestoreAfterDelay()
{
sleep 3000;
spin dish around y-axis speed <60.010989>;
turn gun to x-axis <0.000000> speed <35.005495>;
turn turret to y-axis <0.000000> speed <15.000000>;
}
detectplane()
{
sleep rand(500,5000);
var unit_ID, numbcared;
var max, min;
max = get MAX_ID;
min = get MIN_ID;
var myteam;
myteam = get UNIT_TEAM(get MY_ID);
numbcared=0;
while(1)
{
if(get ACTIVATION == 1)
{
numbcared=0;
for (unit_ID = min; unit_ID <= max; ++unit_ID)
{
if (get UNIT_XZ(unit_ID) == get PIECE_XZ(pad2))
{
++numbcared;
padnum=pad3;
}
if (get UNIT_XZ(unit_ID) == get PIECE_XZ(pad3))
{
++numbcared;
padnum=pad2;
}
}
if(numbcared < 2)
{
if(ifplant)
{
for (unit_ID = min; unit_ID <= max; ++unit_ID)
{
if (get UNIT_IS_ON_THIS_COMP(unit_ID))
{
if (get UNIT_BUILD_PERCENT_LEFT(unit_ID))
{
if (get UNIT_HEIGHT(unit_ID) != [4.2])
{
if (get UNIT_TEAM(unit_ID) == myteam)
{
if (get UNIT_Y(unit_ID) != get PIECE_Y(pad2))
{
attach-unit unit_ID to -1;
attach-unit unit_ID to padnum;
break;
/if (get UNIT_XZ(unit_ID) == get PIECE_XZ(padnum))
{
++padnum;
if(padnum == 23)
{
padnum = 21;
}
}/
}
}
}
}
}
}
}
}
}
sleep 999;
}
}
detectplant()
{
sleep rand(500,5000);
var myteam;
var unit_ID;
var max, min;
max = get MAX_ID;
min = get MIN_ID;
myteam = get UNIT_TEAM(get MY_ID);
while(1)
{
ifplant=0;
for (unit_ID = min; unit_ID <= max; ++unit_ID)
{
if (!(get UNIT_BUILD_PERCENT_LEFT(unit_ID)))
{
if (get UNIT_IS_ON_THIS_COMP(unit_ID))
{
if (get UNIT_HEIGHT(unit_ID) == plantheight)
{
if (get UNIT_TEAM(unit_ID) == myteam)
{
ifplant=1;
show pad2;
show pad3;
}
}
}
}
}
if (!ifplant)
{
hide pad2;
hide pad3;
}
sleep 2500;
}
}
Create()
{
//hide pad2;
//hide pad3;
padnum=pad2;
Static_Var_1 = 0;
gun_1 = 1;
ifplant=0;
hide flare1;
hide flare2;
hide flare3;
dont-cache flare1;
dont-cache flare2;
dont-cache flare3;
call-script InitState();
start-script SmokeUnit();
while( get BUILD_PERCENT_LEFT )
{
sleep 1000;
}
spin dish around y-axis speed <60.010989>;
if(get UNIT_IS_ON_THIS_COMP(get MY_ID))
{
start-script detectplant();
}
if(get UNIT_IS_ON_THIS_COMP(get MY_ID))
{
start-script detectplane();
}
}
StartMoving()
{
signal SIG_MOVE;
set-signal-mask SIG_MOVE;
while( TRUE )
{
emit-sfx 3 from w1;
emit-sfx 3 from w2;
emit-sfx 3 from w3;
emit-sfx 3 from w4;
emit-sfx 3 from w5;
emit-sfx 3 from w6;
emit-sfx 3 from w7;
emit-sfx 3 from w8;
emit-sfx 3 from w9;
emit-sfx 3 from w10;
emit-sfx 3 from w11;
emit-sfx 3 from w12;
emit-sfx 5 from w1;
emit-sfx 5 from w2;
emit-sfx 5 from w3;
emit-sfx 5 from w4;
emit-sfx 5 from w5;
emit-sfx 5 from w6;
emit-sfx 5 from w7;
emit-sfx 5 from w8;
emit-sfx 5 from w9;
emit-sfx 5 from w10;
emit-sfx 5 from w11;
emit-sfx 5 from w12;
sleep 250;
}
}
StopMoving()
{
signal SIG_MOVE;
}
SweetSpot(piecenum)
{
piecenum = base;
}
QueryLandingPad(Func_Var_1, Func_Var_2)
{
Func_Var_1 = pad1;
Func_Var_2 = pad1;
}
AimTertiary(heading, pitch)
{
signal SIG_AIM;
set-signal-mask SIG_AIM;
turn turret to y-axis heading speed <250>;
turn dish to y-axis heading speed <250>;
turn gun to x-axis <0.000000> - pitch speed <250>;
wait-for-turn turret around y-axis;
wait-for-turn gun around x-axis;
start-script RestoreAfterDelay();
return (1);
}
flareu()
{
show flare1;
sleep 45;
hide flare1;
}
flared()
{
show flare2;
sleep 45;
hide flare2;
}
flaret()
{
show flare3;
sleep 45;
hide flare3;
}
FireTertiary()
{
if( gun_1 == 1 )
{
start-script flareu();
}
if( gun_1 == 2 )
{
start-script flared();
}
if( gun_1 == 3 )
{
start-script flaret();
}
++gun_1;
if( gun_1 == 4 )
{
gun_1 = 1;
}
}
QueryTertiary(piecenum)
{
piecenum = gun_1;
}
AimFromTertiary(piecenum)
{
piecenum = gun_1;
}
Killed(severity, corpsetype)
{
if( severity <= 25 )
{
corpsetype = 1;
explode base type BITMAPONLY | BITMAP1;
explode dish type BITMAPONLY | BITMAP2;
explode pad1 type BITMAPONLY | BITMAP3;
explode w1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode w2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
explode w3 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode w4 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
explode w5 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode w6 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
explode w7 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode w8 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
explode w9 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode w10 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
explode w11 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode w12 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
return (0);
}
if( severity <= 50 )
{
corpsetype = 2;
explode base type BITMAPONLY | BITMAP1;
explode dish type SHATTER | BITMAP2;
explode pad1 type FALL | BITMAP3;
explode w1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode w2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
explode w3 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode w4 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
explode w5 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode w6 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
explode w7 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode w8 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
explode w9 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode w10 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
explode w11 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode w12 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
return (0);
}
if( severity <= 99 )
{
corpsetype = 3;
explode base type BITMAPONLY | BITMAP1;
explode dish type SHATTER | BITMAP2;
explode pad1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode w1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode w2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
explode w3 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode w4 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
explode w5 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode w6 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
explode w7 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode w8 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
explode w9 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode w10 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
explode w11 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode w12 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
return (0);
}
corpsetype = 3;
explode base type BITMAPONLY | BITMAP1;
explode dish type SHATTER | EXPLODE_ON_HIT | BITMAP2;
explode pad1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode w1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode w2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
explode w3 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode w4 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
explode w5 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode w6 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
explode w7 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode w8 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
explode w9 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode w10 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
explode w11 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode w12 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
}