sciprt move piece is not following hierarchy
Posted: 20 Feb 2010, 22:10
I have a tank the is told to move barrel back for recoil and its moving the turret back.
The model and script add up piece wise (correct number and spelling) and the hierarchy is turret then under it barrel.
heres the bos
The model and script add up piece wise (correct number and spelling) and the hierarchy is turret then under it barrel.
heres the bos
Code: Select all
#define TA // This is a TA script
#include "sfxtype.h"
#include "exptype.h"
piece base, body, turret, barrel, flare, track3, track2, track1;
static-var bmoving, restore_delay, treadnum;
// Signal definitions
#define SIG_AIM 2
#define SIG_MOVE 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;
}
}
gotracks()
{
while( TRUE )
{
if(bMoving)
{
if(treadnum == 3)
{
show track3;
hide track2;
hide track1;
}
if(treadnum == 2)
{
show track2;
hide track3;
hide track1;
}
if(treadnum == 1)
{
show track1;
hide track2;
hide track3;
}
treadnum = treadnum - 1;
if (treadnum == 0)
{
treadnum = 3;
}
}
sleep 90;
}
}
StartMoving()
{
signal SIG_MOVE;
set-signal-mask SIG_MOVE;
bmoving = 1;
start-script gotracks();
}
StopMoving()
{
signal SIG_MOVE;
bmoving = 0;
}
Create()
{
hide track2;
hide track1;
hide flare;
treadnum = 3;
bmoving = 0;
start-script SmokeUnit();
}
SetMaxReloadTime(Func_Var_1)
{
restore_delay = Func_Var_1 * 2;
}
RestoreAfterDelay()
{
sleep restore_delay;
set-signal-mask 0;
turn turret to y-axis <0> speed <100.071429>;
turn barrel to x-axis <0> speed <100.071429>;
}
AimPrimary(heading, pitch)
{
signal SIG_AIM;
set-signal-mask SIG_AIM;
start-script restoreafterdelay();
turn turret to y-axis heading speed <100.071429>;
turn barrel to x-axis 0 - pitch speed <100.071429>;
wait-for-turn barrel around x-axis;
wait-for-turn turret around y-axis;
return (1);
}
FirePrimary()
{
emit-sfx 1024 from flare; //emit sfx
move barrel to z-axis [-5.000000] speed [200.000000]; //recoil effect
sleep 150;
move barrel to z-axis [0.000000] speed [8.000000];
}
AimFromPrimary(piecenum)
{
piecenum = turret;
}
QueryPrimary(piecenum)
{
piecenum = flare;
}
SweetSpot(piecenum)
{
piecenum = base;
}
Killed(severity, corpsetype)
{
show track3;
hide track2;
hide track1;
if( severity <= 99 )
{
corpsetype = 1;
explode barrel type BITMAPONLY | BITMAP1;
explode body type BITMAPONLY | BITMAP2;
explode track3 type BITMAPONLY | BITMAP3;
explode turret type BITMAPONLY | BITMAP5;
return (0);
}
corpsetype = 3;
explode barrel type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1;
explode body type BITMAPONLY | BITMAP2;
explode track3 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
explode turret type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP5;
return (0);
}