Crash on fire
Posted: 10 Oct 2006, 23:05
I have no idea what's causing this...
Basically, when the unit tries to fire (which is as soon as it is ordered to, pretty much), Spring crashes.
The Weapon
Unit FBI
Ze Script
Basically, when the unit tries to fire (which is as soon as it is ordered to, pretty much), Spring crashes.
The Weapon
Code: Select all
[4burstSML]
{
name=Missiles;
rendertype=1;
lineofsight=1;
turret=1;
model=smlrocket;
range=600;
reloadtime=3.34;
weapontimer=5;
burst=4;
burstrate=0.25;
soundtrigger=1;
weaponvelocity=540;
startvelocity=450;
weaponacceleration=108;
turnrate=63000;
areaofeffect=48;
metalpershot=0;
soundstart=rockhvy2;
soundhit=xplomed2;
firestarter=70;
smokedelay=.1;
guidance=1;
tracks=1;
selfprop=1;
smoketrail=1;
tolerance=8000;
startsmoke=1;
impulsefactor=0.123;
impulseBoost=0.123;
craterMult=0;
craterBoost=0;
NoSelfDamage=1;
[DAMAGE]
{
default=40;
}
Code: Select all
[UNITINFO]
{
Name=Interdictor;
UnitName=GHE_INTESC;
// Required Tags
BuildCostEnergy=5778;
BuildCostMetal=294;
BuildTime=13294;
Category=GHE ESCORT WEAPON BIGSHIP;
Description=Escort;
FootprintX=3;
FootprintZ=3;
MaxDamage=857;
ObjectName=GHE_INTESC;
Side=ARM;
SoundCategory=GHE_Ships;
TEDClass=VTOL;
// Movement
BrakeRate=4.41;
Acceleration=0.24;
CanMove=1;
MaxVelocity=5.36;
MaxSlope=10;
TurnRate=792;
// Buildings
// Construction
Builder=0;
WorkerTime=0;
// Resources
EnergyMake=0.8;
EnergyStorage=0;
EnergyUse=0.8;
MetalStorage=0;
// Abilities
CanAttack=1;
CanFly=1;
CanGuard=1;
CanPatrol=1;
CanStop=1;
// Sight/Radar
SightDistance=550;
// Misc
CruiseAlt=100;
ExplodeAs=SMALLREACTOR;
dontland=1;
MaxWaterDepth=0;
NoChaseCategory=STRIKECRAFT;
SelfDestructAs=SMALLREACTOR;
SmoothAnim=0;
bmcode=1;
noautofire=0;
firestandorders=1;
standingfireorder=2;
mobilestandorders=1;
standingmoveorder=1;
idleAutoHeal=5;
idleTime=1800;
defaultmissiontype=VTOL_standby;
steeringmode=1;
scale=1;
maneuverleashlength=1280;
bankscale=1;
seismicsignature=0;
shownanoframe=0;
//Weapons
Weapon1=4burstSML;
wpri_badTargetCategory=ESCORT;
// OnlyTargetCategory1=BIGSHIP;
// Weapon2=SMALLEX;
// OnlyTargetCategory2=DOESNTEXIST;
[SFXTypes]
{
explosiongenerator0=custom:SPARKS;
}
}
Code: Select all
// Thank's be to 'Argh' for his script repository.
piece base, prow, bodyp1, bodyp2, bodyp3, SML1fp1, SML1fp2, SML2fp1, SML2fp2, smoke1, smoke2, smoke3;
static-var restore_delay, HealthLevel, fpuse;
#define SIG_AIM1 2
#define SIG_HIT 4
#define SIG_MOVE 8
#include "STANDARD_COMMANDS_GPL.h"
DamageEffects()
{
while(TRUE)
{
sleep 50;
while( get BUILD_PERCENT_LEFT ) //Don't want it sparking and burning whilst it's being built...
{
sleep 400;
}
}
HealthLevel = get HEALTH; //Get a percentage of the unit's health, quite handy for this sort of thing...
if(HealthLevel < 100 || HealthLevel >= 75)
{
sleep 200;
// do nothing if over 75% (three quarters) health
}
if(HealthLevel < 75 || HealthLevel >= 50)
{
emit-sfx 1024+0 from smoke1; //sparks
sleep 200; //If I didn't add this, Spring would spawn smoke every milisecond. Which is a bad idea - much lag
}
if(HealthLevel < 50 || HealthLevel >= 25)
{
emit-sfx 1024+0 from smoke1; //sparks
emit-sfx SFXTYPE_BLACKSMOKE from smoke1; //smoke
emit-sfx SFXTYPE_BLACKSMOKE from smoke2; //smoke
emit-sfx SFXTYPE_THRUST from smoke2; //fire
sleep 200;
}
if(HealthLevel < 50 || HealthLevel >= 25)
{
emit-sfx 1024+0 from smoke1; //sparks
emit-sfx SFXTYPE_BLACKSMOKE from smoke1; //smoke
emit-sfx SFXTYPE_BLACKSMOKE from smoke2; //smoke
emit-sfx SFXTYPE_THRUST from smoke1; //fire
emit-sfx SFXTYPE_THRUST from smoke2; //fire
emit-sfx SFXTYPE_THRUST from smoke3; //fire
emit-sfx SFXTYPE_BLACKSMOKE from smoke3; //smoke
sleep 200;
}
}
Create()
{
restore_delay = 2000;
start-script DamageEffects();
fpuse=0;
HealthLevel=100;
}
SetMaxReloadTime(time)
{
restore_delay = time * 2;
}
HitByWeapon(anglex,anglez) //this makes stuff happen when the ship is hit
{
signal SIG_HIT;
set-signal-mask SIG_HIT;
emit-sfx 1024+0 from smoke1; //sparks
emit-sfx SFXTYPE_THRUST from smoke2; //fire
emit-sfx 1024+0 from smoke3; //more sparks
sleep 150;
}
RestoreAfterDelay()
{
sleep restore_delay;
return 0;
}
SweetSpot (piecenum)
{
piecenum = base;
}
QueryPrimary (piecenum)
{
if(fpuse==0)
{
piecenum = SML1fp1;
}
if(fpuse==1)
{
piecenum = SML1fp2;
}
if(fpuse==2)
{
piecenum = SML2fp1;
}
if(fpuse==3)
{
piecenum = SML2fp1;
}
}
AimFromPrimary (piecenum)
{
piecenum = prow;
}
AimPrimary(heading, pitch)
{
signal SIG_AIM1;
set-signal-mask SIG_AIM1;
start-script RestoreAfterDelay();
return(TRUE);
}
FirePrimary()
{
if(fpuse==0)
{
emit-sfx 1024+2 from SML1fp1; //smoke
fpuse=1;
}
if(fpuse==1)
{
emit-sfx 1024+2 from SML1fp2; //smoke
fpuse=2;
}
if(fpuse==2)
{
emit-sfx 1024+2 from SML2fp1; //smoke
fpuse=3;
}
if(fpuse==3)
{
emit-sfx 1024+2 from SML2fp2; //smoke
fpuse=0;
}
return(0);
}
Killed(severity, corpsetype)
{
if (severity <= 25)
{
corpsetype = 1;
explode prow type SHATTER | FIRE;
emit-sfx 1024+0 from smoke1; //sparks
emit-sfx SFXTYPE_BLACKSMOKE from smoke1; //smoke
emit-sfx SFXTYPE_BLACKSMOKE from smoke2; //smoke
emit-sfx SFXTYPE_THRUST from smoke1; //fire
emit-sfx SFXTYPE_THRUST from smoke2; //fire
emit-sfx SFXTYPE_THRUST from smoke3; //fire
emit-sfx SFXTYPE_BLACKSMOKE from smoke3; //smoke
emit-sfx 2048+1 from prow; //weapon explosion from the prow. Weapon16, so that it is constant for each ship
sleep 500;
explode bodyp1 type SHATTER | FIRE;
emit-sfx 2048+1 from bodyp1;
explode bodyp2 type SHATTER | FIRE;
emit-sfx 2048+1 from bodyp2;
explode bodyp3 type SHATTER | FIRE;
emit-sfx 2048+1 from bodyp3;
emit-sfx 1024+0 from smoke1; //sparks
emit-sfx SFXTYPE_BLACKSMOKE from smoke1; //smoke
emit-sfx SFXTYPE_BLACKSMOKE from smoke2; //smoke
emit-sfx SFXTYPE_THRUST from smoke1; //fire
emit-sfx SFXTYPE_THRUST from smoke2; //fire
emit-sfx SFXTYPE_THRUST from smoke3; //fire
emit-sfx SFXTYPE_BLACKSMOKE from smoke3; //smoke
return(0);
}
return(0);
}