Most games I only used Bombers and let them attack each other or the ground.
I checked the Weapons and Unit FBIs, but nothing seems to be the reason for the crashes. Now the only chance are the scripts. Both units arm and core use nearly the same script. But the stealthed lvl 3 bombers dont use them and with them the game never crashed (till now).
So i will delete the lvl 2 bombers untill someone can help me to get them to work without crashing the game.
And here comes the script:
#define TA // This is a TA script
#include "sfxtype.h"
#include "exptype.h"
piece groundplane, base, bombbay, flare, turret2, plate2, sleeve2, barrel2, flare2;
static-var gun_1, gun_2, RestoreDelay;
// Signal definitions
#define SIG_AIM 2
#define SIG_AIM_2 4
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()
{
hide flare;
hide flare2;
gun_1 = 0;
gun_2 = 0;
RestoreDelay = 5000;
start-script SmokeUnit();
}
RestoreAfterDelay()
{
sleep RestoreDelay;
turn bombbay to y-axis <0.000000> speed <55.000000>;
turn turret2 to y-axis <0.000000> speed <55.000000>;
turn sleeve2 to x-axis <0.000000> speed <30.000000>;
gun_1 = 0;
gun_2 = 0;
}
//AimWeapon
AimWeapon1(heading, pitch)
{
signal SIG_AIM;
set-signal-mask SIG_AIM;
turn bombbay to y-axis heading speed <300.000000>;
wait-for-turn bombbay around y-axis;
start-script RestoreAfterDelay();
return (1);
}
AimWeapon2(heading, pitch)
{
signal SIG_AIM_2;
set-signal-mask SIG_AIM_2;
turn turret2 to y-axis heading speed <350.000000>;
turn sleeve2 to x-axis <0.000000> - pitch speed <300.000000>;
wait-for-turn turret2 around y-axis;
wait-for-turn sleeve2 around x-axis;
if( gun_2 == 0 )
{
wait-for-move barrel2 along z-axis;
}
start-script RestoreAfterDelay();
return (1);
}
//FireWeapon
FireWeapon1()
{
show flare;
sleep 75;
hide flare;
}
FireWeapon2()
{
if( gun_2 == 0 )
{
show flare2;
sleep 50;
hide flare2;
turn barrel2 to z-axis <90.000000> speed <350.00000>;
}
if( gun_2 == 1 )
{
show flare2;
sleep 50;
hide flare2;
turn barrel2 to z-axis <180.000000> speed <350.00000>;
}
if( gun_2 == 2 )
{
show flare2;
sleep 50;
hide flare2;
turn barrel2 to z-axis <270.000000> speed <350.00000>;
}
if( gun_2 == 3 )
{
show flare2;
sleep 50;
hide flare2;
turn barrel2 to z-axis <0.000000> speed <350.00000>;
}
gun_2 = gun_2 + 1;
if( gun_2 == 4 )
{
gun_2=0;
}
}
//AimFromWeapon
AimFromWeapon1(piecenum)
{
piecenum = bombbay;
}
QueryWeapon1(piecenum)
{
piecenum = flare;
}
AimFromWeapon2(piecenum)
{
piecenum = turret2;
}
QueryWeapon2(piecenum)
{
piecenum = flare2;
}
SweetSpot(piecenum)
{
piecenum = base;
}
Killed(severity, corpsetype)
{
hide flare;
hide flare2;
corpsetype = 3;
explode base type FALL | SMOKE | EXPLODE_ON_HIT | BITMAP1;
explode turret2 type SHATTER | EXPLODE_ON_HIT | BITMAP4;
}