Page 1 of 1

sciprt move piece is not following hierarchy

Posted: 20 Feb 2010, 22:10
by bobthedinosaur
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

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

Re: sciprt move piece is not following hierarchy

Posted: 20 Feb 2010, 22:42
by LordMuffe
tried it with the model and your script without changing anything... moved the barrel not the turret.

Re: sciprt move piece is not following hierarchy

Posted: 21 Feb 2010, 00:32
by bobthedinosaur
thanks for the feed back muffe.

i guess it may be something effecting it mod wise?

edit:
also what spring version are you using?

Re: sciprt move piece is not following hierarchy

Posted: 21 Feb 2010, 10:48
by LordMuffe
i was using 0.81.1.3 . Don┬┤t know about a way that other files in your mod could change the way the script animates the recoil-animation. Well, besides some LUA maybe ;)

Re: sciprt move piece is not following hierarchy

Posted: 22 Feb 2010, 01:22
by SeanHeron
Ah shit - I must have not made it clear recently: I recently was under the impression that that unit is loading the lua animation file (even though that's been moved to a subfolder). Sorry I didn't convey that well enough (or fix it up myself) :( .

Thanks from me as well for testing, LordMuffe!

Edit: Durr - just checked the unitdef, and we're not referring to the animation (which has not only been moved, but also renamed). Why the hell would it still be loaded ? I'm commenting out the whole lua animation file bob, I reckon that should switch it off for sure...