Script/Model bug in FF

Script/Model bug in FF

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

Script/Model bug in FF

Post by Fanger »

I dont know if anyone has noticed this yet.. since FF is not that popular and its hard to tell that its happening in the OTA version but the DeathHand battleship for the Core is bugged. It fires its weapons yes but not from the proper places. If you build one you will notice this instantly.. the two turreted lasers on the dorsal side of the ship do not fire from there.. instead they seem to fire from the middle of the baseplate for the unit which is several units below it in the middle of space. Needless to say this looks bloody fricking retarded. I have checked the model in 3DO and for what I can see found nothing wrong.. the turrets are all there and set up exactly like they are on other ships that work. This has led me to believe that it must be an error in the script.. I was hoping someone who has more experience than me with TA scripting could take a look at the script for this unit and tell me what is wrong. I do not have the knowledge to see the mistake in the scripting to figure out what the problem is so if someone could help me id be grateful.
#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;
}
Notes: for anyone looking at this script, turret1 is the torpedo launcher on the front of the ship which seems to work fine, turrets 2&3 are the two laser turrets which are bugged.. as far as I can tell there isnt a problem that I can see but perhaps somone will see something I dont...
User avatar
Targ Collective
Posts: 202
Joined: 12 Nov 2005, 14:16

Post by Targ Collective »

I don't know anything about scripting either, but for what it's worth it could be an engine bug. Try shrinking your unit to half size and see if that fixes it. If so the Spring engine has problems with huge units.
Sean Mirrsen
Posts: 578
Joined: 19 Aug 2004, 17:38

Post by Sean Mirrsen »

Make sure the flare pieces are set up correctly. Their model can be anywhere, but what counts is the origin position. There is nothing wrong in the script, but I'd need to see the model to tell if the problem's there.
User avatar
Fanger
Expand & Exterminate Developer
Posts: 1509
Joined: 22 Nov 2005, 22:58

Post by Fanger »

Well the model is in Optimus Primes version on File Universe.. just have to upack the sdz file and take a look at it.. as far as I can tell though it looked like the flares were all in the right place..
Archangel of Death
Posts: 854
Joined: 28 Jan 2005, 18:15

Post by Archangel of Death »

Multiple threads bad :| http://spring.clan-sy.com/phpbb/viewtopic.php?t=2956
Copy/paste of my post there:
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 »

@archangel: can u explain what to do now in detail? My english is to bad to understand what exactly to do now with that script. Where stand that flare1b is 7? I cant find it in the script.
Post Reply

Return to “Game Development”