I dont find the bug in this script (only for scripters)

I dont find the bug in this script (only for scripters)

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

User avatar
Optimus Prime
Posts: 755
Joined: 03 Oct 2005, 14:31

I dont find the bug in this script (only for scripters)

Post by Optimus Prime »

Hello,

I need ur help. I have a Unit, which has 3 turrets. One for a torpedo and 2 for Laserbatteries. All look fine in 3doBuilder so it must be a scriptbug.
The problem is, that when turret 2 and 3 (the lasers) are fireing, the laserbeam comes out of turret one (the torpedo). I tried to change the script, but without no effect (both .cab and .bos). I must say, that i m no scripter, so i m a noob on that.

The script is the following:

----------------------------------------------------------------------------------

#define TA // This is a TA script

#include "sfxtype.h"
#include "exptype.h"

piece groundplane, base, turret1, gunb, flare1a, emitterb, flare1b, flare1c,
turret2, barrel2A, barrel2B, barrel2C, sleeve2, flare2A, flare2B, flare2C,
turret3, barrel3A, barrel3B, barrel3C, sleeve3, flare3A, flare3B, flare3C,
boxa, boxb, turreta;

static-var gun_2, gun_3, Static_Var_3, Static_Var_4, Static_Var_5,
Static_Var_6;

// Signal definitions
#define SIG_AIM_2 4
#define SIG_AIM_3 8


RestoreWeaps()
{
while( Static_Var_5 >= 1 )
{
sleep 500;
Static_Var_6 = get HEALTH;
if( Static_Var_6 >= 35 )
{
show turret3;
show barrel3A;
show barrel3B;
show barrel3C;
show sleeve3;
Static_Var_5 = 0;
}
}
}

HitByWeapon()
{
Static_Var_6 = get HEALTH;
if( Static_Var_6 <= 32 AND Static_Var_5 == 0 )
{
Static_Var_5 = 1;
explode turret3 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode sleeve3 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode barrel3A type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode barrel3B type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode barrel3C type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
hide turret3;
hide barrel3A;
hide barrel3B;
hide barrel3C;
hide sleeve3;
}
start-script RestoreWeaps();
}

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 flare1a;
hide flare1b;
hide flare1c;
hide flare2A;
hide flare2B;
hide flare2C;
hide flare3A;
hide flare3B;
hide flare3C;
dont-cache turret3;
dont-cache barrel3A;
dont-cache barrel3B;
dont-cache barrel3C;
dont-cache sleeve3;
Static_Var_5 = 0;
gun_2 = flare1b;
Static_Var_4 = 6;
gun_3 = flare1b;
set ARMORED to 1;
start-script SmokeUnit();
}

RestoreSecondary()
{
sleep 5000;
turn turret2 to y-axis <0.000000> speed <55.000000>;
turn sleeve2 to x-axis <0.000000> speed <30.000000>;
gun_2 = flare1b;
}

RestoreTertiary()
{
sleep 5000;
turn turret3 to y-axis <0.000000> speed <75.000000>;
turn sleeve3 to x-axis <0.000000> speed <30.000000>;
gun_3 = flare1b;
}

AimPrimary(heading, pitch)
{
return (1);
}

AimSecondary(heading, pitch)
{
signal SIG_AIM_2;
set-signal-mask SIG_AIM_2;
turn turret2 to y-axis heading speed <85.000000>;
turn sleeve2 to x-axis <0.000000> - pitch speed <85.000000>;
if( gun_2 == 1 )
{
wait-for-move barrel2A along z-axis;
wait-for-move barrel2B along z-axis;
wait-for-move barrel2C along z-axis;
}
wait-for-turn turret2 around y-axis;
wait-for-turn sleeve2 around x-axis;
start-script RestoreSecondary();
return (1);
}

AimTertiary(heading, pitch)
{
signal SIG_AIM_3;
set-signal-mask SIG_AIM_3;
while( Static_Var_5 >= 1 )
{
sleep 500;
}
turn turret3 to y-axis heading speed <85.000000>;
turn sleeve2 to x-axis <0.000000> - pitch speed <85.000000>;
if( gun_3 == 1 )
{
wait-for-move barrel3A along z-axis;
wait-for-move barrel3B along z-axis;
wait-for-move barrel3C along z-axis;
}
wait-for-turn turret3 around y-axis;
wait-for-turn sleeve3 around x-axis;
start-script RestoreTertiary();
return (1);
}

FirePrimary()
{
show flare1a;
sleep 120;
hide flare1a;
}

FireSecondary()
{
if( gun_2 == 1 )
{
show flare2A;
gun_2 = flare1c;
move barrel2A to z-axis [-2.200000] now;
sleep 150;
hide flare2A;
move barrel2A to z-axis [0.000000] speed [1.000000];
return (0);
}
if( gun_2 == 2 )
{
show flare2B;
gun_2 = flare2A;
move barrel2B to z-axis [-2.200000] now;
sleep 150;
hide flare2B;
move barrel2B to z-axis [0.000000] speed [1.000000];
return (0);
}
if( gun_2 == 3 )
{
show flare2C;
gun_2 = flare1b;
move barrel2C to z-axis [-2.200000] now;
sleep 150;
hide flare2C;
move barrel2C to z-axis [0.000000] speed [1.000000];
return (0);
}
}

FireTertiary()
{
if( gun_3 == 1 )
{
show flare3A;
gun_3 = flare1c;
move barrel3A to z-axis [-2.200000] now;
sleep 150;
hide flare3A;
move barrel3A to z-axis [0.000000] speed [1.000000];
return (0);
}
if( gun_3 == 2 )
{
show flare3B;
gun_3 = flare2A;
move barrel3B to z-axis [-2.200000] now;
sleep 150;
hide flare3B;
move barrel3B to z-axis [0.000000] speed [1.000000];
return (0);
}
if( gun_3 == 3 )
{
show flare3C;
gun_3 = flare1b;
move barrel3C to z-axis [-2.200000] now;
sleep 150;
hide flare3C;
move barrel3C to z-axis [0.000000] speed [1.000000];
return (0);
}
}

AimFromPrimary(piecenum)
{
piecenum = turret1;
}

QueryPrimary(piecenum)
{
piecenum = flare1a;
}

AimFromSecondary(piecenum)
{
piecenum = turret2;
}

QuerySecondary(piecenum)
{
if( gun_2 == 1 )
{
piecenum = barrel2A;
}
if( gun_2 == 2 )
{
piecenum = barrel2B;
}
if( gun_2 == 3 )
{
piecenum = barrel2C;
}
}

AimFromTertiary(piecenum)
{
piecenum = turret3;
}

QueryTertiary(piecenum)
{
if( gun_3 == 1 )
{
piecenum = barrel3A;
}
if( gun_3 == 2 )
{
piecenum = barrel3B;
}
if( gun_3 == 3 )
{
piecenum = barrel3C;
}
}

SweetSpot(piecenum)
{
piecenum = base;
}

Killed(severity, corpsetype)
{
if( severity <= 40 )
{
corpsetype = 1;
explode groundplane type BITMAPONLY | BITMAP1;
explode base type BITMAPONLY | BITMAP1;
return (0);
}
corpsetype = 3;
explode groundplane type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
explode base type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP5;
}
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Post by yuritch »

You need to change 2 lines in Create():
from
gun_2 = flare1b;
gun_3 = flare1b;

to
gun_2 = 1;
gun_3 = 1;

Then it will probably work.
User avatar
Optimus Prime
Posts: 755
Joined: 03 Oct 2005, 14:31

Post by Optimus Prime »

hm.. no that does nothing :(
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Post by yuritch »

Do the same in RestoreSecondary() and RestoreTertiary(), then recompile.
What happens there is firepoint switching script (QuerySecondary, QueryTertiary) expects gun_2 and gun_3 to have values 1, 2 or 3, but they are being assigned a value outside that range, so Query functuions return nothing. Then probably return value of QueryPrimary is used for secondary and tertiary as well, so all weapons fire from Primary firepoint.
User avatar
Optimus Prime
Posts: 755
Joined: 03 Oct 2005, 14:31

Post by Optimus Prime »

hm.. no that doesnt helps too.
Sean Mirrsen
Posts: 578
Joined: 19 Aug 2004, 17:38

Post by Sean Mirrsen »

Post me the whole unit here (or just point out which one it is... it seems like a TAFF cruiser of some sort). I'll look at it.
User avatar
Optimus Prime
Posts: 755
Joined: 03 Oct 2005, 14:31

Post by Optimus Prime »

its the cordh (filename) (deathhand is its in game name) from the mod Final Frontier...
Archangel of Death
Posts: 854
Joined: 28 Jan 2005, 18:15

Post by Archangel of Death »

Edit: Right, nevermind. I found it.

Ok, in that script it is using piecenames to allocate values, because in TA those actually mean numbers. What numbers they equal are determined by the pieces position in list of pieces. As you can see, those no longer equal usable numbers (flare1b is 7, and not 1), and why a bunch of freak programers choose to do that instead of just using numbers is beyond me. Go through, line by line, changing all those instances to equalling numbers instead of pieces. Make sure your putting good values, just look in the fire code (eg. firesecondary) if() statements to see what it is expecting.
User avatar
Optimus Prime
Posts: 755
Joined: 03 Oct 2005, 14:31

Post by Optimus Prime »

can u please make one clear example what to do now? That would be very helpfull.
Sean Mirrsen
Posts: 578
Joined: 19 Aug 2004, 17:38

Post by Sean Mirrsen »

Actually, it's not freak programmers, it's the Scriptor's DeScript feature that puts piece names instead of usual values (since they are normally stored as numbers, in lines like piecename=xxx). I presume that whoever needed to edit the scripts DeScripted them and forgot to account for that feature.
User avatar
Optimus Prime
Posts: 755
Joined: 03 Oct 2005, 14:31

Post by Optimus Prime »

sorry, but that helps me not more than the post above it. I only want to know, what i need to change into what. Thx
User avatar
Fanger
Expand & Exterminate Developer
Posts: 1509
Joined: 22 Nov 2005, 22:58

Post by Fanger »

Yes could you post the script with the neccesary changes or be more explicit since me and Optimus know next to nothing about scripting and your post was a little vague to us...
Sean Mirrsen
Posts: 578
Joined: 19 Aug 2004, 17:38

Post by Sean Mirrsen »

Ok, I'll explain clearer.

You need to see where the script uses piece names as variable values.
More importantly, the gun_2 and gun_3 variables.
I can understand what happens now.
The Create script sets the Gun_2 and 3 to a large number, that the Fire scripts are unable to use afterwards.
The Query scripts try to get the piecenames for the firing piece, but since the values are off-range, the piecename is 0, which is the base object.
You need to look for lines where these variables are set non-number values, and change them to appropriate numbers.
When you do that, everything should work.
User avatar
Optimus Prime
Posts: 755
Joined: 03 Oct 2005, 14:31

Post by Optimus Prime »

you mean for example:
FireSecondary()
{
if( gun_2 == 1 )
{
show flare2A;
gun_2 = flare1c;
move barrel2A to z-axis [-2.200000] now;
sleep 150;
hide flare2A;
move barrel2A to z-axis [0.000000] speed [1.000000];
return (0);
}
shall be replaced with this code?

FireSecondary()
{
if( gun_2 == 1 )
{
show flare2A;
gun_2 = 2; ?????
move barrel2A to z-axis [-2.200000] now;
sleep 150;
hide flare2A;
move barrel2A to z-axis [0.000000] speed [1.000000];
return (0);
}

is "2" the right number for gun_2? If no, where do i get the number?
Thanks for your help!
Sean Mirrsen
Posts: 578
Joined: 19 Aug 2004, 17:38

Post by Sean Mirrsen »

Aye, thou art correct.

These variables control which barrel to fire from, and range 1 to 3. So in each of the fire scripts, you must change them like so - gun_x=2 in the first IF clause, =3 in the second, and =1 in the third. Also, change the lines in the Create scripts, so that they are set to 1.
User avatar
Optimus Prime
Posts: 755
Joined: 03 Oct 2005, 14:31

Post by Optimus Prime »

hm that makes nothing too :(
u can call me an idiot, but i made all u told me and it doesnt helped.

Here is the changed script:
#define TA // This is a TA script

#include "sfxtype.h"
#include "exptype.h"

piece groundplane, base, turret1, gunb, flare1a, emitterb, flare1b, flare1c,
turret2, barrel2A, barrel2B, barrel2C, sleeve2, flare2A, flare2B, flare2C,
turret3, barrel3A, barrel3B, barrel3C, sleeve3, flare3A, flare3B, flare3C,
boxa, boxb, turreta;

static-var gun_2, gun_3, Static_Var_3, Static_Var_4, Static_Var_5,
Static_Var_6;

// Signal definitions
#define SIG_AIM_2 4
#define SIG_AIM_3 8


RestoreWeaps()
{
while( Static_Var_5 >= 1 )
{
sleep 500;
Static_Var_6 = get HEALTH;
if( Static_Var_6 >= 35 )
{
show turret3;
show barrel3A;
show barrel3B;
show barrel3C;
show sleeve3;
Static_Var_5 = 0;
}
}
}

HitByWeapon()
{
Static_Var_6 = get HEALTH;
if( Static_Var_6 <= 32 AND Static_Var_5 == 0 )
{
Static_Var_5 = 1;
explode turret3 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode sleeve3 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode barrel3A type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode barrel3B type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode barrel3C type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
hide turret3;
hide barrel3A;
hide barrel3B;
hide barrel3C;
hide sleeve3;
}
start-script RestoreWeaps();
}

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 flare1a;
hide flare1b;
hide flare1c;
hide flare2A;
hide flare2B;
hide flare2C;
hide flare3A;
hide flare3B;
hide flare3C;
dont-cache turret3;
dont-cache barrel3A;
dont-cache barrel3B;
dont-cache barrel3C;
dont-cache sleeve3;
Static_Var_5 = 0;
gun_2 = 1; //flare1b;
Static_Var_4 = 6;
gun_3 = 1; //flare1b;
set ARMORED to 1;
start-script SmokeUnit();
}

RestoreSecondary()
{
sleep 5000;
turn turret2 to y-axis <0.000000> speed <55.000000>;
turn sleeve2 to x-axis <0.000000> speed <30.000000>;
gun_2 = 1 // flare1b;
}

RestoreTertiary()
{
sleep 5000;
turn turret3 to y-axis <0.000000> speed <75.000000>;
turn sleeve3 to x-axis <0.000000> speed <30.000000>;
gun_3 = 1 // flare1b;
}

AimPrimary(heading, pitch)
{
return (1);
}

AimSecondary(heading, pitch)
{
signal SIG_AIM_2;
set-signal-mask SIG_AIM_2;
turn turret2 to y-axis heading speed <85.000000>;
turn sleeve2 to x-axis <0.000000> - pitch speed <85.000000>;
if( gun_2 == 1 )
{
wait-for-move barrel2A along z-axis;
wait-for-move barrel2B along z-axis;
wait-for-move barrel2C along z-axis;
}
wait-for-turn turret2 around y-axis;
wait-for-turn sleeve2 around x-axis;
start-script RestoreSecondary();
return (1);
}

AimTertiary(heading, pitch)
{
signal SIG_AIM_3;
set-signal-mask SIG_AIM_3;
while( Static_Var_5 >= 1 )
{
sleep 500;
}
turn turret3 to y-axis heading speed <85.000000>;
turn sleeve2 to x-axis <0.000000> - pitch speed <85.000000>;
if( gun_3 == 1 )
{
wait-for-move barrel3A along z-axis;
wait-for-move barrel3B along z-axis;
wait-for-move barrel3C along z-axis;
}
wait-for-turn turret3 around y-axis;
wait-for-turn sleeve3 around x-axis;
start-script RestoreTertiary();
return (1);
}

FirePrimary()
{
show flare1a;
sleep 120;
hide flare1a;
}

FireSecondary()
{
if( gun_2 == 1 )
{
show flare2A;
gun_2 = 2; // flare1c;
move barrel2A to z-axis [-2.200000] now;
sleep 150;
hide flare2A;
move barrel2A to z-axis [0.000000] speed [1.000000];
return (0);
}
if( gun_2 == 2 )
{
show flare2B;
gun_2 = 3; // flare2A;
move barrel2B to z-axis [-2.200000] now;
sleep 150;
hide flare2B;
move barrel2B to z-axis [0.000000] speed [1.000000];
return (0);
}
if( gun_2 == 3 )
{
show flare2C;
gun_2 = 1; // flare1b;
move barrel2C to z-axis [-2.200000] now;
sleep 150;
hide flare2C;
move barrel2C to z-axis [0.000000] speed [1.000000];
return (0);
}
}

FireTertiary()
{
if( gun_3 == 1 )
{
show flare3A;
gun_3 = 2; // flare1c;
move barrel3A to z-axis [-2.200000] now;
sleep 150;
hide flare3A;
move barrel3A to z-axis [0.000000] speed [1.000000];
return (0);
}
if( gun_3 == 2 )
{
show flare3B;
gun_3 = 3; // flare2A;
move barrel3B to z-axis [-2.200000] now;
sleep 150;
hide flare3B;
move barrel3B to z-axis [0.000000] speed [1.000000];
return (0);
}
if( gun_3 == 3 )
{
show flare3C;
gun_3 = 1; // flare1b;
move barrel3C to z-axis [-2.200000] now;
sleep 150;
hide flare3C;
move barrel3C to z-axis [0.000000] speed [1.000000];
return (0);
}
}

AimFromPrimary(piecenum)
{
piecenum = turret1;
}

QueryPrimary(piecenum)
{
piecenum = flare1a;
}

AimFromSecondary(piecenum)
{
piecenum = turret2;
}

QuerySecondary(piecenum)
{
if( gun_2 == 1 )
{
piecenum = barrel2A;
}
if( gun_2 == 2 )
{
piecenum = barrel2B;
}
if( gun_2 == 3 )
{
piecenum = barrel2C;
}
}

AimFromTertiary(piecenum)
{
piecenum = turret3;
}

QueryTertiary(piecenum)
{
if( gun_3 == 1 )
{
piecenum = barrel3A;
}
if( gun_3 == 2 )
{
piecenum = barrel3B;
}
if( gun_3 == 3 )
{
piecenum = barrel3C;
}
}

SweetSpot(piecenum)
{
piecenum = base;
}

Killed(severity, corpsetype)
{
if( severity <= 40 )
{
corpsetype = 1;
explode groundplane type BITMAPONLY | BITMAP1;
explode base type BITMAPONLY | BITMAP1;
return (0);
}
corpsetype = 3;
explode groundplane type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
explode base type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP5;
}
Archangel of Death
Posts: 854
Joined: 28 Jan 2005, 18:15

Post by Archangel of Death »

Hmm, looks right. It should work. Maybe check your scriptor's compile settings, make sure the cob is in the right location and everything.
User avatar
Optimus Prime
Posts: 755
Joined: 03 Oct 2005, 14:31

Post by Optimus Prime »

Hmm, looks right. It should work. Maybe check your scriptor's compile settings, make sure the cob is in the right location and everything.
yes all should be ok, cause i just overwrited the old file.
Perhaps u can try to fix this script yourself? Its in the actual FF version. The name of the file is cordh.cob.
Sean Mirrsen
Posts: 578
Joined: 19 Aug 2004, 17:38

Post by Sean Mirrsen »

I made the same changes, and it works like a charm now. Make sure you do overwrite the original file, and that there are no copies of the original anywhere in the Spring folder.
Sean Mirrsen
Posts: 578
Joined: 19 Aug 2004, 17:38

Post by Sean Mirrsen »

Code: Select all

#define TA			// This is a TA script

#include "sfxtype.h"
#include "exptype.h"

piece  groundplane, base, turret1, gunb, flare1a, emitterb, flare1b, flare1c,
       turret2, barrel2A, barrel2B, barrel2C, sleeve2, flare2A, flare2B, flare2C,
       turret3, barrel3A, barrel3B, barrel3C, sleeve3, flare3A, flare3B, flare3C,
       boxa, boxb, turreta;

static-var  gun_2, gun_3, Static_Var_3, Static_Var_4, Static_Var_5,
            Static_Var_6;

// Signal definitions
#define SIG_AIM_2			4
#define SIG_AIM_3			8


RestoreWeaps()
{
	while( Static_Var_5 >= 1 )
	{
		sleep 500;
		Static_Var_6 = get HEALTH;
		if( Static_Var_6 >= 35 )
		{
			show turret3;
			show barrel3A;
			show barrel3B;
			show barrel3C;
			show sleeve3;
			Static_Var_5 = 0;
		}
	}
}

HitByWeapon()
{
	Static_Var_6 = get HEALTH;
	if( Static_Var_6 <= 32 AND Static_Var_5 == 0 )
	{
		Static_Var_5 = 1;
		explode turret3 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
		explode sleeve3 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
		explode barrel3A type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
		explode barrel3B type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
		explode barrel3C type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
		hide turret3;
		hide barrel3A;
		hide barrel3B;
		hide barrel3C;
		hide sleeve3;
	}
	start-script RestoreWeaps();
}

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 flare1a;
	hide flare1b;
	hide flare1c;
	hide flare2A;
	hide flare2B;
	hide flare2C;
	hide flare3A;
	hide flare3B;
	hide flare3C;
	dont-cache turret3;
	dont-cache barrel3A;
	dont-cache barrel3B;
	dont-cache barrel3C;
	dont-cache sleeve3;
	Static_Var_5 = 0;
	gun_2 = 1;
	Static_Var_4 = 6;
	gun_3 = 1;
	set ARMORED to 1;
	set ACTIVATION to 1;
	start-script SmokeUnit();
}

RestoreSecondary()
{
	sleep 5000;
	turn turret2 to y-axis <0.000000> speed <55.000000>;
	turn sleeve2 to x-axis <0.000000> speed <30.000000>;
	gun_2 = flare1b;
}

RestoreTertiary()
{
	sleep 5000;
	turn turret3 to y-axis <0.000000> speed <75.000000>;
	turn sleeve3 to x-axis <0.000000> speed <30.000000>;
	gun_3 = flare1b;
}

AimPrimary(heading, pitch)
{
	return (1);
}

AimSecondary(heading, pitch)
{
	signal SIG_AIM_2;
	set-signal-mask SIG_AIM_2;
	turn turret2 to y-axis heading speed <85.000000>;
	turn sleeve2 to x-axis <0.000000> - pitch speed <85.000000>;
	if( gun_2 == 1 )
	{
		wait-for-move barrel2A along z-axis;
		wait-for-move barrel2B along z-axis;
		wait-for-move barrel2C along z-axis;
	}
	wait-for-turn turret2 around y-axis;
	wait-for-turn sleeve2 around x-axis;
	start-script RestoreSecondary();
	return (1);
}

AimTertiary(heading, pitch)
{
	signal SIG_AIM_3;
	set-signal-mask SIG_AIM_3;
	while( Static_Var_5 >= 1 )
	{
		sleep 500;
	}
	turn turret3 to y-axis heading speed <85.000000>;
	turn sleeve2 to x-axis <0.000000> - pitch speed <85.000000>;
	if( gun_3 == 1 )
	{
		wait-for-move barrel3A along z-axis;
		wait-for-move barrel3B along z-axis;
		wait-for-move barrel3C along z-axis;
	}
	wait-for-turn turret3 around y-axis;
	wait-for-turn sleeve3 around x-axis;
	start-script RestoreTertiary();
	return (1);
}

FirePrimary()
{
	dont-cache gunb;
	sleep 500;
	cache gunb;
}

FireSecondary()
{
	if( gun_2 == 1 )
	{
		show flare2A;
		gun_2 = 2;
		move barrel2A to z-axis [-2.200000] now;
		sleep 150;
		hide flare2A;
		move barrel2A to z-axis [0.000000] speed [1.000000];
		return (0);
	}
	if( gun_2 == 2 )
	{
		show flare2B;
		gun_2 = 3;
		move barrel2B to z-axis [-2.200000] now;
		sleep 150;
		hide flare2B;
		move barrel2B to z-axis [0.000000] speed [1.000000];
		return (0);
	}
	if( gun_2 == 3 )
	{
		show flare2C;
		gun_2 = 1;
		move barrel2C to z-axis [-2.200000] now;
		sleep 150;
		hide flare2C;
		move barrel2C to z-axis [0.000000] speed [1.000000];
		return (0);
	}
}

FireTertiary()
{
	if( gun_3 == 1 )
	{
		show flare3A;
		gun_3 = 2;
		move barrel3A to z-axis [-2.200000] now;
		sleep 150;
		hide flare3A;
		move barrel3A to z-axis [0.000000] speed [1.000000];
		return (0);
	}
	if( gun_3 == 2 )
	{
		show flare3B;
		gun_3 = 3;
		move barrel3B to z-axis [-2.200000] now;
		sleep 150;
		hide flare3B;
		move barrel3B to z-axis [0.000000] speed [1.000000];
		return (0);
	}
	if( gun_3 == 3 )
	{
		show flare3C;
		gun_3 = 1;
		move barrel3C to z-axis [-2.200000] now;
		sleep 150;
		hide flare3C;
		move barrel3C to z-axis [0.000000] speed [1.000000];
		return (0);
	}
}

AimFromPrimary(piecenum)
{
	piecenum = turret1;
}

QueryPrimary(piecenum)
{
	piecenum = flare1a;
}

AimFromSecondary(piecenum)
{
	piecenum = turret2;
}

QuerySecondary(piecenum)
{
	if( gun_2 == 1 )
	{
		piecenum = barrel2A;
	}
	if( gun_2 == 2 )
	{
		piecenum = barrel2B;
	}
	if( gun_2 == 3 )
	{
		piecenum = barrel2C;
	}
}

AimFromTertiary(piecenum)
{
	piecenum = turret3;
}

QueryTertiary(piecenum)
{
	if( gun_3 == 1 )
	{
		piecenum = barrel3A;
	}
	if( gun_3 == 2 )
	{
		piecenum = barrel3B;
	}
	if( gun_3 == 3 )
	{
		piecenum = barrel3C;
	}
}

SweetSpot(piecenum)
{
	piecenum = base;
}

Killed(severity, corpsetype)
{
	if( severity <= 40 )
	{
		corpsetype = 1;
		explode groundplane type BITMAPONLY | BITMAP1;
		explode base type BITMAPONLY | BITMAP1;
		return (0);
	}
	corpsetype = 3;
	explode groundplane type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
	explode base type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP5;
}
Here's my BOS. See if this one works for you.
Post Reply

Return to “Engine”