Final Frontier Scripting Problem...

Final Frontier Scripting Problem...

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
User avatar
Fanger
Expand & Exterminate Developer
Posts: 1509
Joined: 22 Nov 2005, 22:58

Final Frontier Scripting Problem...

Post by Fanger »

I am redoing all the Arm turrets for Final Frontier.. and I seem to have run into a problem... I have managed to get all the turrets on the models and they all fire however with the exception of 4 units the rest only use one of the barrels on their turret as a firing point, I dont understand why this is so since to my eyes the scripts all seem to be the same... So here is the script of a unit that works as far as firing from all barrels:
#define TA // This is a TA script

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

piece groundplane, base, turret1, Sleeve, Barrel, Flash, Sensor, cap, turbase1, turbase2, turbase3, turret2, sleeve2, barrel2a, flare2a, barrel2b, flare2b, turret3, sleeve3, barrel3a, flare3a, barrel3b, flare3b;

static-var gun_1, gun_2, gun_3, loseweap, shiphealth, RestoreDelay;

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

#define SMOKEPIECE1 base

#include "SmokeUnit.h"

RestoreWeaps()
{
while( loseweap >= 1 )
{
sleep 500;
shiphealth = get HEALTH;
if( shiphealth >= 35 )
{
show turret3;
show sleeve3;
show barrel3a;
show barrel3b;
loseweap = 0;
}
}
}

HitByWeapon()
{
shiphealth = get HEALTH;
if( shiphealth <= 32 AND loseweap == 0 )
{
loseweap = 1;
explode turret3 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode sleeve3 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
hide turret3;
hide sleeve3;
hide barrel3a;
hide barrel3b;
}
start-script RestoreWeaps();
}

RestoreAfterDelay()
{
sleep RestoreDelay;
turn turret1 to y-axis <0.000000> speed <55.000000>;
turn sleeve to x-axis <0.000000> speed <30.000000>;
turn barrel to x-axis <0.000000> speed <30.000000>;
turn turret2 to y-axis <0.000000> speed <55.000000>;
turn sleeve2 to x-axis <0.000000> speed <30.000000>;
turn barrel2a to x-axis <0.000000> speed <30.000000>;
turn barrel2b to x-axis <0.000000> speed <30.000000>;
turn turret3 to y-axis <0.000000> speed <55.000000>;
turn sleeve3 to x-axis <0.000000> speed <30.000000>;
turn barrel3a to x-axis <0.000000> speed <30.000000>;
turn barrel3b to x-axis <0.000000> speed <30.000000>;
gun_1 = 0;
gun_2 = 0;
gun_3 = 0;
}

Create()
{
hide flash;
hide flare2a;
hide flare2b;
hide flare3a;
hide flare3b;
gun_1 = 0;
gun_2 = 0;
gun_3 = 0;
RestoreDelay=5000;
loseweap = 0;
start-script SmokeUnit();
set ARMORED to 1;
while (get BUILD_PERCENT_LEFT > 0)
{
sleep 250;
}
dont-cache sleeve3;
dont-cache turret3;
dont-cache barrel3a;
dont-cache barrel3b;
loseweap=0;
call-script HitByWeapon();
}

//AimWeapon

AimWeapon1(heading, pitch)
{
signal SIG_AIM;
set-signal-mask SIG_AIM;
turn turret1 to y-axis heading speed <45.000000>;
turn Sleeve to x-axis <0.000000> - pitch speed <50.000000>;
wait-for-turn turret1 around y-axis;
wait-for-turn Sleeve around x-axis;
if( gun_1 == 0 )
{
wait-for-move Barrel along z-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 <85.000000>;
turn sleeve2 to x-axis <0.000000> - pitch speed <85.000000>;
wait-for-turn turret2 around y-axis;
wait-for-turn sleeve2 around x-axis;
if( gun_2 == 0)
{
wait-for-move barrel2a along z-axis;
wait-for-move barrel2b along z-axis;
}
start-script RestoreAfterDelay();
return (1);
}

AimWeapon3(heading, pitch)
{
signal SIG_AIM_3;
set-signal-mask SIG_AIM_3;
while( loseweap >= 1 )
{
sleep 500;
}
turn turret3 to y-axis heading speed <85.000000>;
turn sleeve2 to x-axis <0.000000> - pitch speed <85.000000>;
wait-for-turn turret3 around y-axis;
wait-for-turn sleeve3 around x-axis;
if( gun_3 == 0 )
{
wait-for-move barrel3a along z-axis;
wait-for-move barrel3b along z-axis;
}
start-script RestoreAfterDelay();
return (1);
}

//FireWeapon

FireWeapon1()
{
show Flash;
move Barrel to z-axis [-1.000000] speed [500.000000];
sleep 250;
hide Flash;
move Barrel to z-axis [0.000000] speed [1.000000];
return (0);
}

FireWeapon2()
{
if( gun_2 == 0 )
{
show flare2a;
move barrel2a to z-axis [-4.000000] speed [500.000000];
sleep 150;
hide flare2a;
move barrel2a to z-axis [0.000000] speed [1.000000];
}
if( gun_2 == 1 )
{
show flare2b;
move barrel2b to z-axis [-4.000000] speed [500.000000];
sleep 150;
hide flare2b;
move barrel2b to z-axis [0.000000] speed [1.000000];
}
gun_2 = gun_2 + 1;
if( gun_2 == 2 )
{
gun_2 = 0;
}
}

FireWeapon3()
{
if( gun_3 == 0 )
{
show flare3a;
move barrel3a to z-axis [-4.000000] speed [500.000000];
sleep 150;
hide flare3a;
move barrel3a to z-axis [0.000000] speed [1.000000];
}
if( gun_3 == 1 )
{
show flare3b;
move barrel3b to z-axis [-4.000000] speed [500.000000];
sleep 150;
hide flare3b;
move barrel3b to z-axis [0.000000] speed [1.000000];
}
gun_3 = gun_3 + 1;
if( gun_3==2 )
{
gun_3=0;
}
}

AimFromWeapon1(piecenum)
{
piecenum = turret1;
}

QueryWeapon1(piecenum)
{
piecenum = Flash;
}

AimFromWeapon2(piecenum)
{
piecenum = turret2;
}

QueryWeapon2(piecenum)
{
if( gun_2 == 0 )
{
piecenum = flare2a;
}
if( gun_2 == 1 )
{
piecenum = flare2b;
}
}

AimFromWeapon3(piecenum)
{
piecenum = turret3;
}

QueryWeapon3(piecenum)
{
if( gun_3 == 0 )
{
piecenum = flare3a;
}
if( gun_3 == 1 )
{
piecenum = flare3b;
}
}

SweetSpot(piecenum)
{
piecenum = base;
}

Killed(severity, corpsetype)
{
hide Flash;
hide flare2a;
hide flare2b;
hide flare3a;
hide flare3b;
if( severity <= 40 )
{
corpsetype = 1;
explode base type BITMAPONLY | BITMAP1;
return (0);
}
corpsetype = 3;
explode base type SHATTER | EXPLODE_ON_HIT | BITMAP5;
explode cap type SHATTER | EXPLODE_ON_HIT | BITMAP3;
}
That unit functions correctly, however this one does not yet I do not see much if any difference in the script:
#define TA // This is a TA script

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

piece groundplane, base, turret1, sleeve1, barrel1a, flare1a, barrel1b, flare1b, turret2, sleeve2, barrel2a, flare2a, barrel2b, flare2b, turret3, sleeve3, barrel3a, flare3a, barrel3b, flare3b, barrel3c, flare3c, turret4, sleeve4, barrel4a, flare4a, barrel4b, flare4b, barrel4c, flare4c, turbase1, turbase2, turbase3, turbase4, hull, Box08, Box03, Box05, Box14, Box13, Box10, Box04, Box01, Box09, Box11, Box12, Box02, Box06, Box07;

static-var gun_1, gun_2, gun_3, gun_4, loseweap, shiphealth, RestoreDelay;

// Signal definitions
#define SIG_AIM 2
#define SIG_AIM_2 4
#define SIG_AIM_3 8
#define SIG_AIM_4 16

#define SMOKEPIECE1 base

#include "SmokeUnit.h"

RestoreWeaps()
{
while( loseweap >= 1 )
{
sleep 500;
shiphealth = get HEALTH;
if( shiphealth >= 35 )
{
show turret2;
show barrel2a;
show barrel2b;
show sleeve2;
loseweap = 2;
}
if( shiphealth >= 40 )
{
show box12;
show box11;
loseweap = 1;
}
if( shiphealth >= 50 )
{
show box14;
show box13;
loseweap = 0;
}
}
}

HitByWeapon()
{
shiphealth = get HEALTH;
if( shiphealth <= 45 AND loseweap == 0 )
{
loseweap = 1;
explode box11 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode box13 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
hide box11;
hide box12;
}
if( shiphealth <= 38 AND loseweap == 1 )
{
loseweap = 2;
explode box12 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode box14 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
hide box13;
hide box14;
}
if( shiphealth <= 32 AND loseweap == 2 )
{
loseweap = 3;
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 turret2;
hide barrel2a;
hide barrel2b;
hide sleeve2;
}
start-script RestoreWeaps();
}

RestoreAfterDelay()
{
sleep RestoreDelay;
turn turret1 to y-axis <0.000000> speed <55.000000>;
turn barrel1a to x-axis <0.000000> speed <30.000000>;
turn barrel1b to x-axis <0.000000> speed <30.000000>;
turn turret2 to y-axis <0.000000> speed <55.000000>;
turn barrel2a to x-axis <0.000000> speed <30.000000>;
turn barrel2b to x-axis <0.000000> speed <30.000000>;
turn turret3 to y-axis <0.000000> speed <55.000000>;
turn barrel3a to x-axis <0.000000> speed <30.000000>;
turn barrel3b to x-axis <0.000000> speed <30.000000>;
turn barrel3c to x-axis <0.000000> speed <30.000000>;
turn turret4 to y-axis <0.000000> speed <55.000000>;
turn barrel4a to x-axis <0.000000> speed <30.000000>;
turn barrel4b to x-axis <0.000000> speed <30.000000>;
turn barrel4c to x-axis <0.000000> speed <30.000000>;
gun_1 = 0;
gun_2 = 0;
gun_3 = 0;
gun_4 = 0;
}


Create()
{
hide flare1a;
hide flare1b;
hide flare2a;
hide flare2b;
hide flare3a;
hide flare3b;
hide flare3c;
hide flare4a;
hide flare4b;
hide flare4c;

gun_2 = 0;
gun_1 = 0;
gun_3 = 0;
RestoreDelay=5000;
loseweap = 0;
start-script SmokeUnit();
set ARMORED to 1;
while (get BUILD_PERCENT_LEFT > 0)
{
sleep 250;
}
dont-cache turret2;
dont-cache barrel2a;
dont-cache barrel2b;
dont-cache sleeve2;
dont-cache box11;
dont-cache box12;
dont-cache box13;
dont-cache box14;
loseweap=0;
call-script HitByWeapon();
}

//AimWeapon

AimWeapon1(heading, pitch)
{
signal SIG_AIM;
set-signal-mask SIG_AIM;
turn turret1 to y-axis heading speed <85.000000>;
turn sleeve1 to x-axis <0.000000> - pitch speed <85.000000>;
wait-for-turn turret1 around y-axis;
wait-for-turn sleeve1 around x-axis;
if( gun_1 == 1 )
{
wait-for-move barrel1a along z-axis;
wait-for-move barrel1b along z-axis;
}
start-script RestoreAfterDelay();
return (1);
}

AimWeapon2(heading, pitch)
{
signal SIG_AIM_2;
set-signal-mask SIG_AIM_2;
while( loseweap >= 3 )
{
sleep 500;
}
turn turret2 to y-axis heading speed <125.000000>;
turn sleeve2 to x-axis <0.000000> - pitch speed <125.000000>;
wait-for-turn turret2 around y-axis;
wait-for-turn sleeve2 around x-axis;
if( gun_2 == 1 )
{
wait-for-move barrel2a along z-axis;
wait-for-move barrel2b along z-axis;
}
start-script RestoreAfterDelay();
return (1);
}

AimWeapon3(heading, pitch)
{
signal SIG_AIM_3;
set-signal-mask SIG_AIM_3;
turn turret3 to y-axis heading speed <125.000000>;
turn sleeve3 to x-axis <0.000000> - pitch speed <125.000000>;
wait-for-turn turret3 around y-axis;
wait-for-turn sleeve3 around x-axis;
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;
}
start-script RestoreAfterDelay();
return (1);
}

AimWeapon4(heading, pitch)
{
signal SIG_AIM_4;
set-signal-mask SIG_AIM_4;
turn turret4 to y-axis heading speed <125.000000>;
turn sleeve4 to x-axis <0.000000> - pitch speed <125.000000>;
wait-for-turn turret4 around y-axis;
wait-for-turn sleeve4 around x-axis;
if( gun_4 == 1 )
{
wait-for-move barrel4a along z-axis;
wait-for-move barrel4b along z-axis;
wait-for-move barrel4c along z-axis;
}
start-script RestoreAfterDelay();
return (1);
}

//FireWeapon

FireWeapon1()
{
if( gun_1 == 1 )
{
show flare1a;
move barrel1a to z-axis [-4.000000] now;
sleep 150;
hide flare1a;
move barrel1a to z-axis [0.000000] speed [1.000000];
return (0);
}
if( gun_1 == 2 )
{
show flare1b;
move barrel1b to z-axis [-4.000000] now;
sleep 150;
hide flare1b;
move barrel1b to z-axis [0.000000] speed [1.000000];
return (0);
}
gun_1 = gun_1 + 1;
if( gun_1==3 )
{
gun_1=1;
}
}

FireWeapon2()
{
if( gun_2 == 1 )
{
show flare2a;
move barrel2a to z-axis [-4.000000] now;
sleep 150;
hide flare2a;
move barrel2a to z-axis [0.000000] speed [1.000000];
return (0);
}
if( gun_2 == 2 )
{
show flare2b;
move barrel2b to z-axis [-4.000000] now;
sleep 150;
hide flare2b;
move barrel2b to z-axis [0.000000] speed [1.000000];
return (0);
}
gun_2 = gun_2 + 1;
if( gun_2==3 )
{
gun_2=1;
}
}

FireWeapon3()
{
if( gun_3 == 1 )
{
show flare3a;
move barrel3a to z-axis [-4.000000] now;
sleep 150;
hide flare3a;
move barrel3a to z-axis [0.000000] speed [1.000000];
return (0);
}
if( gun_3 == 2 )
{
show flare3b;
move barrel3b to z-axis [-4.000000] now;
sleep 150;
hide flare3b;
move barrel3b to z-axis [0.000000] speed [1.000000];
return (0);
}
if( gun_3 == 3 )
{
show flare3c;
move barrel3c to z-axis [-4.000000] now;
sleep 150;
hide flare3c;
move barrel3c to z-axis [0.000000] speed [1.000000];
return (0);
}
gun_3 = gun_3 + 1;
if( gun_3==4 )
{
gun_3=1;
}
}

FireWeapon4()
{
if( gun_4 == 1 )
{
show flare4a;
move barrel4a to z-axis [-4.000000] now;
sleep 150;
hide flare4a;
move barrel4a to z-axis [0.000000] speed [1.000000];
return (0);
}
if( gun_4 == 2 )
{
show flare4b;
move barrel4b to z-axis [-4.000000] now;
sleep 150;
hide flare4b;
move barrel4b to z-axis [0.000000] speed [1.000000];
return (0);
}
if( gun_4 == 3 )
{
show flare4c;
move barrel4c to z-axis [-4.000000] now;
sleep 150;
hide flare4c;
move barrel4c to z-axis [0.000000] speed [1.000000];
return (0);
}
gun_4 = gun_4 + 1;
if( gun_4==4 )
{
gun_4=1;
}
}

//AimFromWeapon

AimFromWeapon1(piecenum)
{
piecenum = turret1;
}

QueryWeapon1(piecenum)
{
if( gun_1 == 1 )
{
piecenum = flare1a;
}
if( gun_1 == 2 )
{
piecenum = flare1b;
}
}

AimFromWeapon2(piecenum)
{
piecenum = turret2;
}

QueryWeapon2(piecenum)
{
if( gun_2 == 1 )
{
piecenum = flare2a;
}
if( gun_2 == 2 )
{
piecenum = flare2b;
}
}

AimFromWeapon3(piecenum)
{
piecenum = turret3;
}

QueryWeapon3(piecenum)
{
if( gun_3 == 1 )
{
piecenum = flare3a;
}
if( gun_3 == 2 )
{
piecenum = flare3b;
}
if( gun_3 == 3 )
{
piecenum = flare3c;
}
}

AimFromWeapon4(piecenum)
{
piecenum = turret4;
}

QueryWeapon4(piecenum)
{
if( gun_4 == 1 )
{
piecenum = flare4a;
}
if( gun_4 == 2 )
{
piecenum = flare4b;
}
if( gun_4 == 3 )
{
piecenum = flare4c;
}
}

SweetSpot(piecenum)
{
piecenum = base;
}

Killed(severity, corpsetype)
{
hide flare1a;
hide flare1b;
hide flare2a;
hide flare2b;
hide flare3a;
hide flare3b;
hide flare3c;
hide flare4a;
hide flare4b;
hide flare4c;
if( severity <= 25 )
{
corpsetype = 1;
explode base type BITMAPONLY | BITMAP1;
return (0);
}
corpsetype = 3;
explode Box07 type SHATTER | EXPLODE_ON_HIT | BITMAP3;
explode Box06 type SHATTER | EXPLODE_ON_HIT | BITMAP3;
explode Box02 type SHATTER | EXPLODE_ON_HIT | BITMAP3;
explode Box03 type SHATTER | EXPLODE_ON_HIT | BITMAP1;
}

Any assistance would be appreciated, I realize i should probably replace the pieces with numbers but that confuses me..
User avatar
Optimus Prime
Posts: 755
Joined: 03 Oct 2005, 14:31

Post by Optimus Prime »

I think i have the Problem.

In the First Script, you create the Weapons with the value 0 (gun_x = 0; ) and later in the FireWeaponX function you start with if gun_x == 0. Thats correct and works,
but in the second script,
you create the Weapons with the value 0 (gun_x = 0; ) and later in the FireWeaponX function you start with if gun_x == 1. So the weapons should never fire correctly and than it uses the corpse at weapon and fires out of its middle i think. So no weapon works, but it seems that one weapon works because they all fire out of the middle.
(and you should create gun_4 = 0 too i think - you only created 3 guns (look at the create function)).

I hope that was it.
User avatar
Fanger
Expand & Exterminate Developer
Posts: 1509
Joined: 22 Nov 2005, 22:58

Post by Fanger »

No I dont think that was the problem, however I do think I found it.

If you look at the 2nd scripts weapon firing stuff youll notice after each fire it has return(0); after each weapon firing, this means it fires that weapon then turns gun=x to 0 again which I think is why it wasnt using the rest of the barrels, it just kept calling gun=0 over and over again.


Yes that was the problem it fixed all of them, now im just looking over the Missile cruisers..
Sean Mirrsen
Posts: 578
Joined: 19 Aug 2004, 17:38

Post by Sean Mirrsen »

You got the problem correctly, but the reason wrong. When you called return (0) in the fire scripts, the scripts ended before the last section incrementing the gun_x could execute. So the controlling variable is never changed, and the gun always fires from the same barrel. It is, however, correct to have return 0's in fire scripts like that, only you have to set the variable explicitly in each part of the script and omit the last incremention part entirely.
User avatar
Fanger
Expand & Exterminate Developer
Posts: 1509
Joined: 22 Nov 2005, 22:58

Post by Fanger »

Ok we have another problem again.. the longbow and the prowler missile ships are supposed to look like they are actually firing off rockets. So as they fire 3d models on the ship are hidden to look like ammunition is being spent. Then once all the shots have been fired the ship is supposed to wait a certain amount of time and the models reappear to indicate reloading.. and it can fire again... while it is waiting for the missiles to reload it doesnt fire. The problem we have is that the script I cooked up to get this to happen doesnt seem to be consistant, it seems to reload immediatly once the unit stops attacking something and goes to idle, yet when its fighting it only seems to reload after a long period of time, and also sometimes it doesnt reload at all... here is the script, perhaps someone can help me get the effect i want which is that when the ship starts off it fires its weapon normally until all ammo is expended then it waits X time and then reloads and begins firing again, no matter if its idle or not...

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

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

piece groundplane, base, turret2, sleeve2, barrel2a, flare2a, barrel2b, flare2b, turret3,
sleeve3, barrel3a, flare3a, barrel3b, flare3b, turbase1, msl1, msl2, msl3,
msl4, msl5, msl6, msl7, msl8, msl9, msl10, msl11,
msl12, msl13, msl14, msl15, msl16;

static-var RestoreDelay, gun_1, gun_2, gun_3, mfired, loseweap,
shiphealth;

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


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;
}
}

RestoreWeaps()
{
while( loseweap >= 1 )
{
sleep 500;
shiphealth = get HEALTH;
if( shiphealth >= 35 )
{
show turret3;
show sleeve3;
show barrel3a;
show barrel3b;
loseweap = 0;
}
}
}

HitByWeapon()
{
shiphealth = get HEALTH;
if( shiphealth <= 32 AND loseweap == 0 )
{
loseweap = 1;
explode turret3 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode sleeve3 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
hide turret3;
hide sleeve3;
hide barrel3a;
hide barrel3b;
}
start-script RestoreWeaps();
}

loadmiss()
{
while( mfired == 1 )
{
sleep 8000;
if( gun_1 == 16 )
{
show msl1;
move msl1 to z-axis [0.000000] speed [2.000000];
}
if( gun_1 == 16 )
{
show msl9;
move msl9 to z-axis [0.000000] speed [2.000000];
}
if( gun_1 == 16 )
{
show msl2;
move msl2 to z-axis [0.000000] speed [2.000000];
}
if( gun_1 == 16 )
{
show msl10;
move msl10 to z-axis [0.000000] speed [2.000000];
}
if( gun_1 == 16 )
{
show msl3;
move msl3 to z-axis [0.000000] speed [2.000000];
}
if( gun_1 == 16 )
{
show msl11;
move msl11 to z-axis [0.000000] speed [2.000000];
}
if( gun_1 == 16 )
{
show msl4;
move msl4 to z-axis [0.000000] speed [2.000000];
}
if( gun_1 == 16 )
{
show msl12;
move msl12 to z-axis [0.000000] speed [2.000000];
}
if( gun_1 == 16 )
{
show msl5;
move msl5 to z-axis [0.000000] speed [2.000000];
}
if( gun_1 == 16 )
{
show msl13;
move msl13 to z-axis [0.000000] speed [2.000000];
}
if( gun_1 == 16 )
{
show msl6;
move msl6 to z-axis [0.000000] speed [2.000000];
}
if( gun_1 == 16 )
{
show msl14;
move msl14 to z-axis [0.000000] speed [2.000000];
}
if( gun_1 == 16 )
{
show msl7;
move msl7 to z-axis [0.000000] speed [2.000000];
}
if( gun_1 == 16 )
{
show msl15;
move msl15 to z-axis [0.000000] speed [2.000000];
}
if( gun_1 == 16 )
{
show msl8;
move msl8 to z-axis [0.000000] speed [2.000000];
}
if( gun_1 == 16 )
{
show msl16;
move msl16 to z-axis [0.000000] speed [2.000000];
}
mfired = 0;
gun_1 = 0;
}
}

Create()
{
set ARMORED to 1;
RestoreDelay = 5000;
gun_1 = 0;
gun_2 = 0;
gun_3 = 0;
hide flare2a;
hide flare2b;
hide flare3a;
hide flare3b;
dont-cache turret3;
dont-cache sleeve3;
dont-cache barrel3a;
dont-cache barrel3b;
loseweap = 0;
mfired = 0;
start-script SmokeUnit();
}

SetMaxReloadTime(Func_Var_1)
{
RestoreDelay = Func_Var_1 * 2;
}

RestoreAfterDelay()
{
sleep RestoreDelay;
turn turret2 to y-axis <0.000000> speed <80.000000>;
turn barrel2a to x-axis <0.000000> speed <30.000000>;
turn barrel2b to x-axis <0.000000> speed <30.000000>;
turn turret3 to y-axis <0.000000> speed <80.000000>;
turn barrel3a to x-axis <0.000000> speed <30.000000>;
turn barrel3b to x-axis <0.000000> speed <30.000000>;
gun_2 = 0;
gun_3 = 0;
}

//Weapon1

AimWeapon1(heading, pitch)
{
signal SIG_AIM;
set-signal-mask SIG_AIM;
while( heading >= 9000 AND heading <= 60000 )
{
sleep 150;
}
if( gun_1 == 0 )
{
turn msl1 to y-axis heading now;
turn msl1 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 1 )
{
turn msl9 to y-axis heading now;
turn msl9 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 2 )
{
turn msl2 to y-axis heading now;
turn msl2 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 3 )
{
turn msl10 to y-axis heading now;
turn msl10 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 4 )
{
turn msl3 to y-axis heading now;
turn msl3 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 5 )
{
turn msl11 to y-axis heading now;
turn msl11 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 6 )
{
turn msl4 to y-axis heading now;
turn msl4 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 7 )
{
turn msl12 to y-axis heading now;
turn msl12 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 8 )
{
turn msl5 to y-axis heading now;
turn msl5 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 9 )
{
turn msl13 to y-axis heading now;
turn msl13 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 10 )
{
turn msl6 to y-axis heading now;
turn msl6 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 11 )
{
turn msl14 to y-axis heading now;
turn msl14 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 12 )
{
turn msl7 to y-axis heading now;
turn msl7 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 13 )
{
turn msl15 to y-axis heading now;
turn msl15 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 14 )
{
turn msl8 to y-axis heading now;
turn msl8 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 15 )
{
turn msl16 to y-axis heading now;
turn msl16 to x-axis <0.000000> - pitch now;
}
if( gun_1 >= 16 )
{
call-script loadmiss();
mfired = 1;
}
return (1);
}

FireWeapon1()
{
if( gun_1 == 0 )
{
hide msl1;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl1;
}
if( gun_1 == 1 )
{
hide msl9;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl9;
}
if( gun_1 == 2 )
{
hide msl2;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl2;
}
if( gun_1 == 3 )
{
hide msl10;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl10;
}
if( gun_1 == 4 )
{
hide msl3;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl13;
}
if( gun_1 == 5 )
{
hide msl11;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl11;
}
if( gun_1 == 6 )
{
hide msl4;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl4;
}
if( gun_1 == 7 )
{
hide msl12;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl12;
}
if( gun_1 == 8 )
{
hide msl5;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl5;
}
if( gun_1 == 9 )
{
hide msl13;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl13;
}
if( gun_1 == 10 )
{
hide msl6;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl6;
}
if( gun_1 == 11 )
{
hide msl14;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl14;
}
if( gun_1 == 12 )
{
hide msl7;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl7;
}
if( gun_1 == 13 )
{
hide msl15;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl15;
}
if( gun_1 == 14 )
{
hide msl8;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl8;
}
if( gun_1 == 15 )
{
hide msl16;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl6;
}
gun_1= gun_1 + 1;
if( gun_1 == 16 )
{
gun_1=16;
}
}

AimFromWeapon1(piecenum)
{
if( gun_1 == 0 )
{
piecenum = msl1;
}
if( gun_1 == 1 )
{
piecenum = msl9;
}
if( gun_1 == 2 )
{
piecenum = msl2;
}
if( gun_1 == 3 )
{
piecenum = msl10;
}
if( gun_1 == 4 )
{
piecenum = msl3;
}
if( gun_1 == 5 )
{
piecenum = msl11;
}
if( gun_1 == 6 )
{
piecenum = msl4;
}
if( gun_1 == 7 )
{
piecenum = msl12;
}
if( gun_1 == 8 )
{
piecenum = msl5;
}
if( gun_1 == 9 )
{
piecenum = msl13;
}
if( gun_1 == 10 )
{
piecenum = msl6;
}
if( gun_1 == 11 )
{
piecenum = msl14;
}
if( gun_1 == 12 )
{
piecenum = msl7;
}
if( gun_1 == 13 )
{
piecenum = msl15;
}
if( gun_1 == 14 )
{
piecenum = msl8;
}
if( gun_1 == 15 )
{
piecenum = msl16;
}
}

QueryWeapon1(piecenum)
{
if( gun_1 == 0 )
{
piecenum = msl1;
}
if( gun_1 == 1 )
{
piecenum = msl9;
}
if( gun_1 == 2 )
{
piecenum = msl2;
}
if( gun_1 == 3 )
{
piecenum = msl10;
}
if( gun_1 == 4 )
{
piecenum = msl3;
}
if( gun_1 == 5 )
{
piecenum = msl11;
}
if( gun_1 == 6 )
{
piecenum = msl4;
}
if( gun_1 == 7 )
{
piecenum = msl12;
}
if( gun_1 == 8 )
{
piecenum = msl5;
}
if( gun_1 == 9 )
{
piecenum = msl13;
}
if( gun_1 == 10 )
{
piecenum = msl6;
}
if( gun_1 == 11 )
{
piecenum = msl14;
}
if( gun_1 == 12 )
{
piecenum = msl7;
}
if( gun_1 == 13 )
{
piecenum = msl15;
}
if( gun_1 == 14 )
{
piecenum = msl8;
}
if( gun_1 == 15 )
{
piecenum = msl16;
}
}



//AimWeapon

AimWeapon2(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>;
wait-for-turn turret2 around y-axis;
wait-for-turn sleeve2 around x-axis;
if( gun_2 == 0 )
{
wait-for-move barrel2a along z-axis;
wait-for-move barrel2b along z-axis;
}
start-script RestoreAfterDelay();
return (1);
}

AimWeapon3(heading, pitch)
{
signal SIG_AIM_3;
set-signal-mask SIG_AIM_3;
while( loseweap >= 1 )
{
sleep 500;
}
turn turret3 to y-axis heading speed <85.000000>;
turn sleeve3 to x-axis <0.000000> - pitch speed <85.000000>;
wait-for-turn turret3 around y-axis;
wait-for-turn sleeve3 around x-axis;
if( gun_3 == 0 )
{
wait-for-move barrel3a along z-axis;
wait-for-move barrel3b along z-axis;
}
start-script RestoreAfterDelay();
return (1);
}

//FireWeapon

FireWeapon2()
{
if( gun_2 == 0 )
{
show flare2a;
move barrel2a to z-axis [-4.000000] speed [500.000000];
sleep 150;
hide flare2a;
move barrel2a to z-axis [0.000000] speed [1.000000];
}
if( gun_2 == 1 )
{
show flare2b;
move barrel2b to z-axis [-4.000000] speed [500.000000];
sleep 150;
hide flare2b;
move barrel2b to z-axis [0.000000] speed [1.000000];
}
gun_2 = gun_2 + 1;
if( gun_2 == 2 )
{
gun_2=0;
}
}

FireWeapon3()
{
if( gun_3 == 0 )
{
show flare3a;
move barrel3a to z-axis [-4.000000] speed [500.000000];
sleep 150;
hide flare3a;
move barrel3a to z-axis [0.000000] speed [1.000000];
}
if( gun_3 == 1 )
{
show flare3b;
move barrel3b to z-axis [-4.000000] speed [500.000000];
sleep 150;
hide flare3b;
move barrel3b to z-axis [0.000000] speed [1.000000];
}
gun_3 = gun_3 + 1;
if( gun_3 == 2 )
{
gun_3=0;
}
}

//AimFromWeapon

AimFromWeapon2(piecenum)
{
piecenum = turret2;
}

QueryWeapon2(piecenum)
{
if( gun_2 == 0 )
{
piecenum = flare2a;
}
if( gun_2 == 1 )
{
piecenum = flare2b;
}
}

AimFromWeapon3(piecenum)
{
piecenum = turret3;
}

QueryWeapon3(piecenum)
{
if( gun_3 == 0 )
{
piecenum = flare3a;
}
if( gun_3 == 1 )
{
piecenum = flare3b;
}
}

SweetSpot(piecenum)
{
piecenum = base;
}

Killed(severity, corpsetype)
{
hide flare2a;
hide flare2b;
hide flare3a;
hide flare3b;
if( severity <= 50 )
{
corpsetype = 1;
explode groundplane type BITMAPONLY | BITMAP1;
return (0);
}
corpsetype = 3;
explode groundplane type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
explode base type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP5;
explode turret2 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
explode sleeve2 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
explode turret3 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
explode sleeve3 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
explode turbase1 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
}
Archangel of Death
Posts: 854
Joined: 28 Jan 2005, 18:15

Post by Archangel of Death »

Ok, first off, you might want to replace

Code: Select all

while( heading >= 9000 AND heading <= 60000 ) 
{ 
sleep 150; 
} 
with the maxangle fbi tags, as they are far superior to scripted angle limits.
Or rather, replace the heading checks with (gun_1 >= 16), as this will stop your ship from firing missiles while it should be reloading them.
Alternately it looks like you could use (mfired == 1) as your check. However, I don't see a reason to have mfired and the while(mfired == 1) check in loadmiss(). Also, it looks like you could, and possibly should, remove all those if(gun_1 == 16)'s from loadmiss() as well.

Now, lastly, I'd like you to describe to me fully what you would like the missiles to do, as they fire, after they fire, if they stop firing (like if the last target is destroyed) before they are done firing through the whole set, etc, as well as their reload rate.
User avatar
Fanger
Expand & Exterminate Developer
Posts: 1509
Joined: 22 Nov 2005, 22:58

Post by Fanger »

Yes I agree with the fbi tag thing.. thats actually already done..

ok I want it to work like this.. the ship has 16 missile objects (pieces of the 3do file) each one of these is a small cone sticking out of the front of the ship lined up with a texture set to look like a missile rack, there are 8 missiles on each side. now when the unit is told to attack, i want it to turn so that it is facing the target, and proceed to fire of missiles in a rapid succession at the target until its destroyed or the ship runs of of missiles (ie all the 16 3do pieces have disappeared). Once it has run out of missiles... (if it still has some left after destroying the target it should still not reload) it will wait X amount of time most likely 30 seconds in game and then reload all 16 3do pieces by having them reappear, pause for a second then begin firing again if it is still targeting something or if it was not or was told to stop just have the missiles reload and wait for an attack command to begin firing...
User avatar
TheRegisteredOne
Posts: 398
Joined: 10 Dec 2005, 21:39

Post by TheRegisteredOne »

make a variable count, say missileNum down the number of missiles you have, every time the missile fires, make missileNum--, and add this to the script:

create(){
missileNum = 16;
}

missileReload(){
sleep 3000;
/*missile reload animation*/
missileNum = 16;
}

AimPrimary(heading, pitch)
{
if (missileNum == 0){
start-script missileReload();
}
signal SIG_AIM;
set-signal-mask SIG_AIM;
/*aiming animation*/
return(1);
}
Archangel of Death
Posts: 854
Joined: 28 Jan 2005, 18:15

Post by Archangel of Death »

Spring calls the Aim functions several times per second, so that would both keep calling the reload function (making it start back at the top, the delay), and you need to put in code to prevent aimweapon1 from finishing aiming. I'd suggest putting the call in fireweapon1, and having a while( missileNum == 0) in Aimweapon1. That is if you use TRO's script idea, which is a good one. I wanted to suggest something similar, except with constant reloading, except you don't want it to function like that.
User avatar
Fanger
Expand & Exterminate Developer
Posts: 1509
Joined: 22 Nov 2005, 22:58

Post by Fanger »

Here is the modified script so far
#define TA // This is a TA script

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

piece groundplane, base, turret2, sleeve2, barrel2a, flare2a, barrel2b, flare2b, turret3,
sleeve3, barrel3a, flare3a, barrel3b, flare3b, turbase1, msl1, msl2, msl3,
msl4, msl5, msl6, msl7, msl8, msl9, msl10, msl11,
msl12, msl13, msl14, msl15, msl16;

static-var RestoreDelay, gun_1, gun_2, gun_3, missileNum, loseweap,
shiphealth;

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


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;
}
}

RestoreWeaps()
{
while( loseweap >= 1 )
{
sleep 500;
shiphealth = get HEALTH;
if( shiphealth >= 35 )
{
show turret3;
show sleeve3;
show barrel3a;
show barrel3b;
loseweap = 0;
}
}
}

HitByWeapon()
{
shiphealth = get HEALTH;
if( shiphealth <= 32 AND loseweap == 0 )
{
loseweap = 1;
explode turret3 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode sleeve3 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
hide turret3;
hide sleeve3;
hide barrel3a;
hide barrel3b;
}
start-script RestoreWeaps();
}

missileReload()
{
sleep 10000;
show msl1;
move msl1 to z-axis [0.000000] speed [2.000000];
show msl9;
move msl9 to z-axis [0.000000] speed [2.000000];
show msl2;
move msl2 to z-axis [0.000000] speed [2.000000];
show msl10;
move msl10 to z-axis [0.000000] speed [2.000000];
show msl3;
move msl3 to z-axis [0.000000] speed [2.000000];
show msl11;
move msl11 to z-axis [0.000000] speed [2.000000];
show msl4;
move msl4 to z-axis [0.000000] speed [2.000000];
show msl12;
move msl12 to z-axis [0.000000] speed [2.000000];
show msl5;
move msl5 to z-axis [0.000000] speed [2.000000];
show msl13;
move msl13 to z-axis [0.000000] speed [2.000000];
show msl6;
move msl6 to z-axis [0.000000] speed [2.000000];
show msl14;
move msl14 to z-axis [0.000000] speed [2.000000];
show msl7;
move msl7 to z-axis [0.000000] speed [2.000000];
show msl15;
move msl15 to z-axis [0.000000] speed [2.000000];
show msl8;
move msl8 to z-axis [0.000000] speed [2.000000];
show msl16;
move msl16 to z-axis [0.000000] speed [2.000000];
sleep 200;
missileNum = 16;
}

Create()
{
set ARMORED to 1;
RestoreDelay = 5000;
gun_1 = 0;
gun_2 = 0;
gun_3 = 0;
hide flare2a;
hide flare2b;
hide flare3a;
hide flare3b;
dont-cache turret3;
dont-cache sleeve3;
dont-cache barrel3a;
dont-cache barrel3b;
loseweap = 0;
missileNum = 16;
start-script SmokeUnit();
}

RestoreAfterDelay()
{
sleep RestoreDelay;
turn turret2 to y-axis <0.000000> speed <80.000000>;
turn barrel2a to x-axis <0.000000> speed <30.000000>;
turn barrel2b to x-axis <0.000000> speed <30.000000>;
turn turret3 to y-axis <0.000000> speed <80.000000>;
turn barrel3a to x-axis <0.000000> speed <30.000000>;
turn barrel3b to x-axis <0.000000> speed <30.000000>;
gun_2 = 0;
gun_3 = 0;
}

//Weapon1

AimWeapon1(heading, pitch)
{
while( missileNum == 0 )
{
sleep 150;
}
signal SIG_AIM;
set-signal-mask SIG_AIM;
if( gun_1 == 0 )
{
turn msl1 to y-axis heading now;
turn msl1 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 1 )
{
turn msl9 to y-axis heading now;
turn msl9 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 2 )
{
turn msl2 to y-axis heading now;
turn msl2 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 3 )
{
turn msl10 to y-axis heading now;
turn msl10 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 4 )
{
turn msl3 to y-axis heading now;
turn msl3 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 5 )
{
turn msl11 to y-axis heading now;
turn msl11 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 6 )
{
turn msl4 to y-axis heading now;
turn msl4 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 7 )
{
turn msl12 to y-axis heading now;
turn msl12 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 8 )
{
turn msl5 to y-axis heading now;
turn msl5 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 9 )
{
turn msl13 to y-axis heading now;
turn msl13 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 10 )
{
turn msl6 to y-axis heading now;
turn msl6 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 11 )
{
turn msl14 to y-axis heading now;
turn msl14 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 12 )
{
turn msl7 to y-axis heading now;
turn msl7 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 13 )
{
turn msl15 to y-axis heading now;
turn msl15 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 14 )
{
turn msl8 to y-axis heading now;
turn msl8 to x-axis <0.000000> - pitch now;
}
if( gun_1 == 15 )
{
turn msl16 to y-axis heading now;
turn msl16 to x-axis <0.000000> - pitch now;
}
return (1);
}



FireWeapon1()
{
if( gun_1 == 0 )
{
hide msl1;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl1;
missileNum = 15;
}
if( gun_1 == 1 )
{
hide msl9;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl9;
missileNum = 14;
}
if( gun_1 == 2 )
{
hide msl2;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl2;
missileNum = 13;
}
if( gun_1 == 3 )
{
hide msl10;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl10;
missileNum = 12;
}
if( gun_1 == 4 )
{
hide msl3;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl13;
missileNum = 11;
}
if( gun_1 == 5 )
{
hide msl11;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl11;
missileNum = 10;
}
if( gun_1 == 6 )
{
hide msl4;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl4;
missileNum = 9;
}
if( gun_1 == 7 )
{
hide msl12;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl12;
missileNum = 8;
}
if( gun_1 == 8 )
{
hide msl5;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl5;
missileNum = 7;
}
if( gun_1 == 9 )
{
hide msl13;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl13;
missileNum = 6;
}
if( gun_1 == 10 )
{
hide msl6;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl6;
missileNum = 5;
}
if( gun_1 == 11 )
{
hide msl14;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl14;
missileNum = 4;
}
if( gun_1 == 12 )
{
hide msl7;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl7;
missileNum = 3;
}
if( gun_1 == 13 )
{
hide msl15;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl15;
missileNum = 2;
}
if( gun_1 == 14 )
{
hide msl8;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl8;
missileNum = 1;
}
if( gun_1 == 15 )
{
hide msl16;
move msl1 to z-axis [-3.000000] now;
emit-sfx 256 | 1 from msl6;
missileNum = 0;
}
gun_1= gun_1 + 1;
if( gun_1 == 16 )
{
start-script missileReload();
gun_1=0;
}
}

AimFromWeapon1(piecenum)
{
if( gun_1 == 0 )
{
piecenum = msl1;
}
if( gun_1 == 1 )
{
piecenum = msl9;
}
if( gun_1 == 2 )
{
piecenum = msl2;
}
if( gun_1 == 3 )
{
piecenum = msl10;
}
if( gun_1 == 4 )
{
piecenum = msl3;
}
if( gun_1 == 5 )
{
piecenum = msl11;
}
if( gun_1 == 6 )
{
piecenum = msl4;
}
if( gun_1 == 7 )
{
piecenum = msl12;
}
if( gun_1 == 8 )
{
piecenum = msl5;
}
if( gun_1 == 9 )
{
piecenum = msl13;
}
if( gun_1 == 10 )
{
piecenum = msl6;
}
if( gun_1 == 11 )
{
piecenum = msl14;
}
if( gun_1 == 12 )
{
piecenum = msl7;
}
if( gun_1 == 13 )
{
piecenum = msl15;
}
if( gun_1 == 14 )
{
piecenum = msl8;
}
if( gun_1 == 15 )
{
piecenum = msl16;
}
}

QueryWeapon1(piecenum)
{
if( gun_1 == 0 )
{
piecenum = msl1;
}
if( gun_1 == 1 )
{
piecenum = msl9;
}
if( gun_1 == 2 )
{
piecenum = msl2;
}
if( gun_1 == 3 )
{
piecenum = msl10;
}
if( gun_1 == 4 )
{
piecenum = msl3;
}
if( gun_1 == 5 )
{
piecenum = msl11;
}
if( gun_1 == 6 )
{
piecenum = msl4;
}
if( gun_1 == 7 )
{
piecenum = msl12;
}
if( gun_1 == 8 )
{
piecenum = msl5;
}
if( gun_1 == 9 )
{
piecenum = msl13;
}
if( gun_1 == 10 )
{
piecenum = msl6;
}
if( gun_1 == 11 )
{
piecenum = msl14;
}
if( gun_1 == 12 )
{
piecenum = msl7;
}
if( gun_1 == 13 )
{
piecenum = msl15;
}
if( gun_1 == 14 )
{
piecenum = msl8;
}
if( gun_1 == 15 )
{
piecenum = msl16;
}
}
that is up the end of the the weapon1 lines, it functions but the reload time is still messed up in that its very short..
Archangel of Death
Posts: 854
Joined: 28 Jan 2005, 18:15

Post by Archangel of Death »

/me looks through scripts
Ah, ok. A seconds is 1000, so 30 seconds is 30,000. Also note that if the reload speed of the weapon your using is fast your missile launchers may fire to many times occassionally. But if your script doesn't have this problem, be sure to tell me :-)
Post Reply

Return to “Game Development”