运输脚本 ArmT1AirCon

//下面TA-EXCESS II alpha1e版的CORE的T1工程飞机的脚本,估计每个版本的都一样,如果你的版本不一样也可以对照看看,这个脚本包含很多方面的内容
//这个飞机有运输的功能,这里之解析运输部分
#define TA
#include “sfxtype.h”
#include “exptype.h”
piece base, hull, turn1, engine1, engine2, turn2, engine3, engine4, carry, lathe, spray, thrust1, thrust2, thrust3, thrust4;
static-var DesiredState, StateChanging, UnitHeading, UnitSpeed;
SmokeUnit(HealthPercent, SleepTime)
{
signal 8;
set-signal-mask 8;
while( get BUILD_PERCENT_LEFT )
{
sleep 500;
}
while( TRUE )
{
HealthPercent = get HEALTH;
if( HealthPercent < 60 )
{
emit-sfx 256 | 1 from engine1;
emit-sfx 256 | 1 from engine4;
SleepTime = 300;
}
if( HealthPercent < 30 )
{
emit-sfx 256 | 2 from engine2;
emit-sfx 256 | 2 from engine3;
SleepTime = 200;
}
sleep SleepTime;
}
}
HitByWeapon(AngleX, AngleZ)
{
signal 128;
set-signal-mask 128;
turn base to z-axis AngleZ speed <105.000000>;
turn base to x-axis AngleX speed <105.000000>;
wait-for-turn base around z-axis;
wait-for-turn base around x-axis;
turn base to z-axis <0.000000> speed <30.000000>;
turn base to x-axis <0.000000> speed <30.000000>;
}
RequestState(RequestedState, CurrentState)
{
if( StateChanging )
{
DesiredState = RequestedState;
return (0);
}
StateChanging = TRUE;
CurrentState = DesiredState;
DesiredState = RequestedState;
while( DesiredState != CurrentState )
{
if( DesiredState == 0 )
{
signal 8;
show thrust1;
show thrust2;
show thrust3;
show thrust4;
CurrentState = 0;
}
if( DesiredState == 1 )
{
start-script SmokeUnit();
hide thrust1;
hide thrust2;
hide thrust3;
hide thrust4;
CurrentState = 1;
UnitSpeed = 0;
}
}
StateChanging = FALSE;
}
MoveRate1()
{
signal 32;
set-signal-mask 32;
if( UnitSpeed == 0 )
{
UnitSpeed = 1;
turn turn1 to x-axis <0.00> speed <200.00>;
turn turn2 to x-axis <0.00> speed <200.00>;
turn hull to x-axis <0.00> speed <20.00>;
return (0);
}
if( UnitSpeed >= 2 )
{
UnitSpeed = 1;
turn turn1 to x-axis <-25.00> speed <200.00>;
turn turn2 to x-axis <-15.00> speed <200.00>;
turn hull to x-axis <-20.00> speed <80.00>;
sleep 500;
turn turn1 to x-axis <0.00> speed <200.00>;
turn turn2 to x-axis <0.00> speed <200.00>;
turn hull to x-axis <0.00> speed <20.00>;
return (0);
}
}
MoveRate2()
{
signal 32;
set-signal-mask 32;
if( UnitSpeed <= 1 )
{
UnitSpeed = 2;
turn turn1 to x-axis <15.00> speed <200.00>;
turn turn2 to x-axis <25.00> speed <200.00>;
turn hull to x-axis <10.00> speed <40.00>;
sleep 500;
turn hull to x-axis <0.00> speed <20.00>;
return (0);
}
if( UnitSpeed == 3 )
{
UnitSpeed = 2;
turn turn1 to x-axis <-25.00> speed <200.00>;
turn turn2 to x-axis <-15.00> speed <200.00>;
turn hull to x-axis <-10.00> speed <80.00>;
sleep 500;
turn hull to x-axis <0.00> speed <20.00>;
return (0);
}
}
MoveRate3()
{
signal 32;
set-signal-mask 32;
UnitSpeed = 3;
turn turn1 to x-axis <30.00> speed <200.00>;
turn turn2 to x-axis <50.00> speed <200.00>;
turn hull to x-axis <20.00> speed <40.00>;
sleep 500;
turn hull to x-axis <0.00> speed <20.00>;
}
//上面的3个Moverate是移动速度的脚本,根据移动速度来改变喷射引擎的强度和角度的效果,效果而已,不要也可以
Create()
{
DesiredState = 1;
StateChanging = 0;
UnitSpeed = 0;

dont-cache thrust1;
dont-cache thrust2;
dont-cache thrust3;
dont-cache thrust4;

hide thrust1;
hide thrust2;
hide thrust3;
hide thrust4;

spin thrust1 around y-axis speed <360.00>;
spin thrust2 around y-axis speed <360.00>;
spin thrust3 around y-axis speed <360.00>;
spin thrust4 around y-axis speed <360.00>;
start-script SmokeUnit();
}
SweetSpot(PieceNum)
{
PieceNum = hull;
}
Activate()
{
set-signal-mask 16;
start-script RequestState(0);
while( TRUE )
{
UnitHeading = UnitHeading - get XZ_ATAN(7);
turn engine1 to x-axis <0.00> - 3 * UnitHeading speed <200.00>;
turn engine2 to x-axis 3 * UnitHeading speed <200.00>;
UnitHeading = get XZ_ATAN(7);
sleep 100;
}
}
//上面是活动状态下控制喷射引擎的喷射角度的脚本
Deactivate()
{
signal 16;
start-script RequestState(1);
turn engine1 to x-axis <0.00> speed <200.00>;
turn engine2 to x-axis <0.00> speed <200.00>;
}
QueryTransport(PieceNum) //指定吊起的部件的脚本
{
PieceNum = carry; //指定吊起的部件为carry这个部件
}
BeginTransport(Height) //吊起的脚本
{
move carry to y-axis [0.000000] - Height now; //把carry部件下降单位的高度
}
//上面是什么意思呢,实际上TA是没有吊起这个的,只有托起,这里其实是把部件carry(无模型的空部件,所以游戏里是看不见的)下降跟单位的高度相同的距离,这样看起来就像是吊起,其实还是托起的。

EndTransport() //运输完结的脚本(注:可有可无的)
{
//Nothing!
}
QueryNanoPiece(PieceNum)
{
PieceNum = spray;
}
StartBuilding() //开始建造的脚本
{
set INBUILDSTANCE to 1;
}
StopBuilding() //停止建造的脚本
{
set INBUILDSTANCE to 0;
}
Killed(Severity, CorpseType)
{
CorpseType = 3;
explode hull type FALL | SMOKE | EXPLODE_ON_HIT | BITMAP1;
explode engine1 type FALL | SMOKE | EXPLODE_ON_HIT | BITMAP1;
explode engine2 type FALL | SMOKE | EXPLODE_ON_HIT | BITMAP1;
explode engine3 type FALL | SMOKE | EXPLODE_ON_HIT | BITMAP1;
explode engine4 type FALL | SMOKE | EXPLODE_ON_HIT | BITMAP1;
}
//总结,运输部分照抄吧,没什么能改的,除非你要做像最高指挥官那种吊起一排单位的运输机,那种脚本是有的,不过比较复杂,不解析了。
ArmT1AirCon.jpg
ArmT1AirCon.rar (4 KB)

这段脚本的解释有许多错误。。。不过懒得全部纠正了。
反正attach-unit的确是吊起单位而非托起单位就是了。

能全部看懂的人真不赖!!!

这飞机是新的原创模型吗?

这飞机是 TA EXCESS II的工程飞机

难怪看着这么眼熟。