unknown bug for tll + xta

unknown bug for tll + xta

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
Noruas
XTA Developer
Posts: 1269
Joined: 24 Feb 2005, 02:58

unknown bug for tll + xta

Post by Noruas »

Code: Select all

#define TA			// This is a TA script

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

piece  base, rupleg1, rupleg2, rupleg3, lupleg1, lupleg2, lupleg3, lleg3,
       lleg2, lleg1, rleg3, rleg2, rleg1, body, rdoor, ldoor,
       flare1, flare2;

static-var  Static_Var_1, Static_Var_2, bMoving, bAiming, Static_Var_5,
            restore_delay, Static_Var_7, gun_1, statechg_DesiredState, statechg_StateChanging;

// Signal definitions
#define SIG_AIM				2


walk()
{
	if( bMoving )
	{
		turn base to x-axis <2.098901> now;
		turn base to x-axis <0.000000> speed <14.197802>;
		turn base to y-axis <1.098901> now;
		turn base to y-axis <0.697802> speed <2.395604>;
		turn rupleg1 to y-axis <27.395604> now;
		turn rupleg1 to y-axis <7.697802> speed <132.197802>;
		turn rupleg2 to y-axis <-13.395604> now;
		turn rupleg2 to z-axis <0.000000> now;
		turn rupleg2 to z-axis <27.395604> speed <184.098901>;
		turn rupleg3 to y-axis <27.796703> now;
		turn rupleg3 to y-axis <7.395604> speed <136.895604>;
		turn lupleg1 to y-axis <21.395604> now;
		turn lupleg1 to z-axis <0.000000> now;
		turn lupleg1 to z-axis <-24.598901> speed <165.197802>;
		turn lupleg2 to y-axis <-14.395604> now;
		turn lupleg2 to y-axis <-0.697802> speed <92.000000>;
		turn lupleg2 to z-axis <-7.395604> now;
		turn lupleg2 to z-axis <0.000000> speed <49.598901>;
		turn lupleg3 to y-axis <13.395604> now;
		turn lupleg3 to z-axis <0.000000> now;
		turn lupleg3 to z-axis <-45.395604> speed <304.395604>;
		turn lleg3 to z-axis <0.000000> now;
		turn lleg3 to z-axis <35.500000> speed <238.395604>;
		turn lleg2 to z-axis <0.000000> now;
		turn lleg2 to z-axis <-12.000000> speed <80.197802>;
		turn lleg1 to z-axis <0.000000> now;
		turn lleg1 to z-axis <11.598901> speed <77.895604>;
		turn rleg3 to z-axis <0.000000> now;
		turn rleg3 to z-axis <8.395604> speed <56.598901>;
		turn rleg2 to z-axis <0.000000> now;
		turn rleg2 to z-axis <-34.796703> speed <233.598901>;
		turn rleg1 to z-axis <0.000000> now;
		turn rleg1 to z-axis <9.500000> speed <63.697802>;
		sleep 149;
	}
	if( bMoving )
	{
		turn base to x-axis <-1.098901> speed <7.000000>;
		turn base to y-axis <-0.395604> speed <7.000000>;
		turn rupleg1 to y-axis <-13.000000> speed <138.296703>;
		turn rupleg2 to y-axis <8.796703> speed <147.697802>;
		turn rupleg2 to z-axis <54.197802> speed <178.197802>;
		turn rupleg3 to y-axis <-14.395604> speed <145.296703>;
		turn lupleg1 to y-axis <1.395604> speed <133.598901>;
		turn lupleg1 to z-axis <-64.697802> speed <267.296703>;
		turn lupleg2 to y-axis <20.697802> speed <143.000000>;
		turn lupleg3 to y-axis <-10.197802> speed <157.098901>;
		turn lupleg3 to z-axis <-76.000000> speed <204.000000>;
		turn lleg3 to z-axis <63.598901> speed <187.500000>;
		turn lleg2 to z-axis <0.000000> speed <79.697802>;
		turn lleg1 to z-axis <66.500000> speed <365.697802>;
		turn rleg3 to z-axis <0.000000> speed <56.296703>;
		turn rleg2 to z-axis <-63.598901> speed <192.197802>;
		turn rleg1 to z-axis <0.000000> speed <63.296703>;
		sleep 150;
	}
	if( bMoving )
	{
		turn base to x-axis <-1.395604> speed <2.296703>;
		turn base to y-axis <-1.098901> speed <4.697802>;
		turn rupleg1 to y-axis <-20.000000> speed <46.598901>;
		turn rupleg2 to y-axis <17.197802> speed <55.895604>;
		turn rupleg2 to z-axis <8.395604> speed <302.697802>;
		turn rupleg3 to y-axis <-20.000000> speed <37.296703>;
		turn lupleg1 to y-axis <-10.500000> speed <79.197802>;
		turn lupleg1 to z-axis <-14.395604> speed <333.000000>;
		turn lupleg2 to y-axis <31.296703> speed <69.895604>;
		turn lupleg3 to y-axis <-15.796703> speed <37.296703>;
		turn lupleg3 to z-axis <-10.895604> speed <430.796703>;
		turn lleg3 to z-axis <17.895604> speed <302.697802>;
		turn lleg1 to z-axis <10.500000> speed <370.296703>;
		turn rleg2 to z-axis <-9.796703> speed <356.296703>;
		sleep 151;
	}
	if( bMoving )
	{
		turn base to x-axis <-0.697802> speed <4.697802>;
		turn base to y-axis <0.000000> speed <7.000000>;
		turn rupleg1 to y-axis <-13.000000> speed <46.895604>;
		turn rupleg1 to z-axis <39.395604> speed <262.598901>;
		turn rupleg2 to y-axis <11.296703> speed <39.895604>;
		turn rupleg2 to z-axis <-2.098901> speed <70.296703>;
		turn rupleg3 to y-axis <-3.197802> speed <112.500000>;
		turn rupleg3 to z-axis <28.500000> speed <189.895604>;
		turn lupleg1 to y-axis <-0.395604> speed <68.000000>;
		turn lupleg1 to z-axis <2.098901> speed <110.197802>;
		turn lupleg2 to y-axis <19.697802> speed <77.395604>;
		turn lupleg2 to z-axis <-40.796703> speed <271.895604>;
		turn lupleg3 to y-axis <-7.395604> speed <56.296703>;
		turn lupleg3 to z-axis <4.197802> speed <100.796703>;
		turn lleg3 to z-axis <0.000000> speed <119.598901>;
		turn lleg2 to z-axis <32.697802> speed <218.000000>;
		turn lleg1 to z-axis <0.000000> speed <70.296703>;
		turn rleg3 to z-axis <-17.598901> speed <117.197802>;
		turn rleg2 to z-axis <0.000000> speed <65.598901>;
		turn rleg1 to z-axis <-19.697802> speed <131.296703>;
		sleep 150;
	}
	if( bMoving )
	{
		turn base to x-axis <0.697802> speed <9.395604>;
		turn base to y-axis <1.395604> speed <9.395604>;
		turn rupleg1 to y-axis <8.098901> speed <140.697802>;
		turn rupleg1 to z-axis <52.697802> speed <89.098901>;
		turn rupleg2 to y-axis <0.000000> speed <75.000000>;
		turn rupleg3 to y-axis <15.796703> speed <126.598901>;
		turn rupleg3 to z-axis <48.197802> speed <131.296703>;
		turn lupleg1 to y-axis <9.500000> speed <65.598901>;
		turn lupleg2 to y-axis <3.895604> speed <105.500000>;
		turn lupleg2 to z-axis <-68.598901> speed <185.197802>;
		turn lupleg3 to y-axis <1.796703> speed <61.000000>;
		turn lleg3 to z-axis <-10.197802> speed <68.000000>;
		turn lleg2 to z-axis <64.395604> speed <211.000000>;
		turn lleg1 to z-axis <-6.000000> speed <39.895604>;
		turn rleg3 to z-axis <-52.395604> speed <232.098901>;
		turn rleg2 to z-axis <3.500000> speed <23.395604>;
		turn rleg1 to z-axis <-50.598901> speed <206.296703>;
		sleep 150;
	}
	if( bMoving )
	{
		turn base to x-axis <1.395604> speed <4.697802>;
		turn base to y-axis <1.796703> speed <2.296703>;
		turn rupleg1 to y-axis <16.500000> speed <56.296703>;
		turn rupleg1 to z-axis <39.395604> speed <89.098901>;
		turn rupleg2 to y-axis <-11.296703> speed <75.000000>;
		turn rupleg3 to y-axis <24.598901> speed <58.598901>;
		turn rupleg3 to z-axis <28.500000> speed <131.296703>;
		turn lupleg1 to y-axis <20.000000> speed <70.296703>;
		turn lupleg2 to y-axis <-3.895604> speed <51.598901>;
		turn lupleg2 to z-axis <-40.796703> speed <185.197802>;
		turn lupleg3 to y-axis <18.296703> speed <110.197802>;
		turn lleg3 to z-axis <0.000000> speed <68.000000>;
		turn lleg2 to z-axis <37.598901> speed <178.197802>;
		turn lleg1 to z-axis <0.000000> speed <39.895604>;
		turn rleg3 to z-axis <-17.598901> speed <232.098901>;
		turn rleg2 to z-axis <0.000000> speed <23.395604>;
		turn rleg1 to z-axis <-23.895604> speed <178.197802>;
		sleep 150;
	}
	sleep 150;
}

stand()
{
	sleep 200;
}

activatescr()
{
	if( TRUE )
	{
	}
	sleep 9;
}

deactivatescr()
{
	if( TRUE )
	{
	}
	sleep 10;
}

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 body;
		}
		sleeptime = healthpercent * 50;
		if( sleeptime < 200 )
		{
			sleeptime = 200;
		}
		sleep sleeptime;
	}
}

Go()
{
	call-script activatescr();
	Static_Var_2 = 1;
}

Stop()
{
	Static_Var_2 = 0;
	call-script deactivatescr();
}

InitState()
{
	statechg_DesiredState = TRUE;
	statechg_StateChanging = FALSE;
}

RequestState(requestedstate, currentstate)
{
	if( statechg_StateChanging )
	{
		statechg_DesiredState = requestedstate;
		return (0);
	}
	statechg_StateChanging = TRUE;
	currentstate = statechg_DesiredState;
	statechg_DesiredState = requestedstate;
	while( statechg_DesiredState != currentstate )
	{
		if( statechg_DesiredState == 0 )
		{
			call-script Go();
			currentstate = 0;
		}
		if( statechg_DesiredState == 1 )
		{
			call-script Stop();
			currentstate = 1;
		}
	}
	statechg_StateChanging = FALSE;
}

MotionControl(moving, aiming, justmoved)
{
	justmoved = TRUE;
	while( TRUE )
	{
		moving = bMoving;
		aiming = bAiming;
		if( moving )
		{
			if( aiming )
			{
				Static_Var_5 = 1;
				call-script walk();
			}
			if( !aiming )
			{
				Static_Var_5 = 0;
				call-script walk();
			}
			justmoved = TRUE;
		}
		if( !moving )
		{
			aiming = TRUE;
			if( justmoved )
			{
				call-script stand();
				justmoved = FALSE;
			}
			sleep 100;
		}
	}
}

Create()
{
	bMoving = FALSE;
	bAiming = FALSE;
	Static_Var_5 = 1;
	Static_Var_2 = 0;
	gun_1 = base;
	restore_delay = 200;
	call-script InitState();
	start-script MotionControl();
	start-script SmokeUnit();
}

SetMaxReloadTime(Func_Var_1)
{
	restore_delay = Func_Var_1;
}

StartMoving()
{
	bMoving = TRUE;
}

StopMoving()
{
	bMoving = FALSE;
}

RestoreAfterDelay()
{
	sleep restore_delay;
	move rdoor to x-axis [0.000000] speed [5.000000];
	move ldoor to x-axis [0.000000] speed [5.000000];
	sleep 250;
	move rdoor to y-axis [0.000000] speed [5.000000];
	move ldoor to y-axis [0.000000] speed [5.000000];
	sleep 10;
	bAiming = FALSE;
}

AimPrimary(heading, pitch)
{
	start-script RequestState(0);
	signal SIG_AIM;
	set-signal-mask SIG_AIM;
	bAiming = TRUE;
	while( bMoving )
	{
	}
	move rdoor to y-axis [2.000000] speed [5.000000];
	move ldoor to y-axis [2.000000] speed [5.000000];
	move rdoor to x-axis [2.000000] speed [5.000000];
	move ldoor to x-axis [-2.000000] speed [5.000000];
	sleep 493;
	start-script RestoreAfterDelay();
	return (1);
}

FirePrimary()
{
	gun_1 = !gun_1;
}

AimFromPrimary(piecenum)
{
	piecenum = body;
}

QueryPrimary(piecenum)
{
	if( gun_1 )
	{
		piecenum = flare1;
	}
	if( !gun_1 )
	{
		piecenum = flare2;
	}
}

SweetSpot(piecenum)
{
	piecenum = base;
}

Killed(severity, corpsetype)
{
	if( severity <= 25 )
	{
		corpsetype = 1;
		explode rupleg1 type BITMAPONLY | BITMAP3;
		explode rleg2 type BITMAPONLY | BITMAP2;
		explode body type BITMAPONLY | BITMAP5;
		explode lleg1 type BITMAPONLY | BITMAP2;
		explode lleg2 type BITMAPONLY | BITMAP2;
		explode lleg3 type BITMAPONLY | BITMAP3;
		explode lupleg1 type BITMAPONLY | BITMAP4;
		explode lupleg2 type BITMAPONLY | BITMAP4;
		explode body type BITMAPONLY | BITMAP5;
		return (0);
	}
	if( severity <= 50 )
	{
		corpsetype = 2;
		explode rdoor type FALL | BITMAP3;
		explode ldoor type FALL | BITMAP2;
		explode lupleg1 type FALL | BITMAP2;
		explode rupleg2 type FALL | BITMAP2;
		explode body type SHATTER | BITMAP5;
		return (0);
	}
	if( severity <= 99 )
	{
		corpsetype = 3;
		explode rdoor type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
		explode ldoor type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
		explode body type FALL | SMOKE | FIRE | BITMAP5;
		explode lupleg1 type BITMAPONLY | BITMAP1;
		explode rupleg1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
		explode rleg2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
		explode rleg1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
		explode lupleg3 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
		explode body type SHATTER | BITMAP5;
		return (0);
	}
	corpsetype = 3;
	explode lupleg1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
	explode rleg2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
	explode rleg3 type FALL | SMOKE | FIRE | BITMAP5;
	explode lleg1 type BITMAPONLY | BITMAP1;
	explode rleg1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
	explode rupleg2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
	explode body type SHATTER | EXPLODE_ON_HIT | BITMAP5;
}
You can find this in TLL AND XTA and I cannot find where it crashes but its somwhere in aiming/firing that causes the crash on tll tech 2 kbots, the tic unit.Its the only one i seem to be having problems with at the current moment. Scriptor passes it along ok.
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

gun_1 = base;
?
User avatar
rcdraco
Posts: 781
Joined: 22 Nov 2006, 02:50

well

Post by rcdraco »

I think I may have found a slight issue, I'm not sure if it has to be changed but:
FirePrimary()
{
gun_1 = !gun_1;
}

AimFromPrimary(piecenum)
{
piecenum = body;
}

QueryPrimary(piecenum)
{
if( gun_1 )
{
piecenum = flare1;
}
if( !gun_1 )
{
piecenum = flare2;
}
}
Do you have the old script, and or, any logs for this? There must be a specific error.
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Post by Peet »

Draco, that's just to alternate firing points.

Code: Select all

   while( bMoving ) 
   { 
   }
Is the problem. Assuming you actually want it to not be able to fire while it's moving, just put the whole function within a if( !bMoving ) conditional.
Snipawolf wrote:
gun_1 = base;
?
That's probably just the script decompiler being idiotic..just replace it with 0.
User avatar
Noruas
XTA Developer
Posts: 1269
Joined: 24 Feb 2005, 02:58

Post by Noruas »

Its also possible that an idiot was using an decompiler, thx for teh help it probably will work now, but i havent tried it. *Aka Faith in Lord Peet*
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

while(bMoving) is valid, just needs a sleep in that loop and of course the signal stuff before the loop.
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Post by Peet »

Yeah, works either way.
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

This is why cavedog scripts fail hard.
Post Reply

Return to “Game Development”