Help with a Ta Script

Everything related to the code /
Tout ce qui touche au code
Post Reply
Flashbang232
Posts: 155
Joined: Tue Aug 03, 2010 6:59 pm
Location: Behind LOIC

Help with a Ta Script

Post by Flashbang232 » Mon Jan 31, 2011 3:10 am

Code: Select all

#define ta //this is a ta script

piece BASE, torso, sleeveR, rightarm, flareR, pelvis, lthigh, rthigh, lleg, rleg, rfoot, lfoot;
static-var bmoving, baiming, bfiring;
static-var gun;

#define SIG_MOVEMENT	2
#define SIG_AIM		4


#define	ANIM_VARIABLE   bMoving
#undef	ANIM_VARIABLE

#define SMOKEPIECE1 torso
#include "smokeunit.h"

/* SmokeUnit.h -- Process unit smoke when damaged */
/* Modified by KhlavKalash */

#ifndef SMOKE_H_
#define SMOKE_H_

#include "SFXtype.h"
#include "EXPtype.h"


#ifdef TAK

SmokeControl()
{

	var healthpercent, smoketype, sleeptime;

#if MAX_DAMAGE_FLAMES > 1
	var x;
#endif

	while( get BUILD_PERCENT_LEFT )
	{
		sleep 400;
	}

	while( TRUE )
	{
		healthpercent = get HEALTH;
#if MAX_DAMAGE_FLAMES > 0
		if( healthpercent < 66 )
		{
			smoketype = ( 256 | 1 );
			if( healthpercent < Rand(1,66) )
			{
				smoketype = ( 256 | 2 );
			}
#if MAX_DAMAGE_FLAMES == 1
			emit-sfx smoketype from damage1;
#else
			x = Rand(0,MAX_DAMAGE_FLAMES);
			if( x == 0 )
			{
				emit-sfx smoketype from damage1;
			}
			else if( x == 1 )
			{
				emit-sfx smoketype from damage2;
			}
#if MAX_DAMAGE_FLAMES > 2
			else if( x == 2 )
			{
				emit-sfx smoketype from damage3;
			}
#if MAX_DAMAGE_FLAMES > 3
			else if( x == 3 )
			{
				emit-sfx smoketype from damage4;
			}
#if MAX_DAMAGE_FLAMES > 4
			else if( x == 4 )
			{
				emit-sfx smoketype from damage5;
			}
#if MAX_DAMAGE_FLAMES > 5
			else if( x == 5 )
			{
				emit-sfx smoketype from damage6;
			}
#if MAX_DAMAGE_FLAMES > 6
			else if( x == 6 )
			{
				emit-sfx smoketype from damage7;
			}
#if MAX_DAMAGE_FLAMES > 7
			else if( x == 7 )
			{
				emit-sfx smoketype from damage8;
			}
#if MAX_DAMAGE_FLAMES > 8
			else if( x == 8 )
			{
				emit-sfx smoketype from damage9;
			}
#endif // end if MAX_DAMAGE_FLAMES > 8
#endif // end if MAX_DAMAGE_FLAMES > 7
#endif // end if MAX_DAMAGE_FLAMES > 6
#endif // end if MAX_DAMAGE_FLAMES > 5
#endif // end if MAX_DAMAGE_FLAMES > 4
#endif // end if MAX_DAMAGE_FLAMES > 3
#endif // end if MAX_DAMAGE_FLAMES > 2
#endif // end if MAX_DAMAGE_FLAMES == 1
		}
#endif // end if MAX_DAMAGE_FLAMES > 0
		sleeptime = ( ( healthpercent * 50 ) + Rand(0,( 1000 / MAX_SMOKE_PUFFS_PER_SECOND )) );
		if( sleeptime < ( 1000 / MAX_SMOKE_PUFFS_PER_SECOND ) )
		{
			sleeptime = ( 1000 / MAX_SMOKE_PUFFS_PER_SECOND );
		}
		sleep sleeptime;
	}
}


#else // #ifdef TA

// Figure out how many smoking pieces are defined

#ifdef SMOKEPIECE4
	#define NUM_SMOKE_PIECES 4
#else
	#ifdef SMOKEPIECE3
		#define NUM_SMOKE_PIECES 3
	#else
		#ifdef SMOKEPIECE2
			#define NUM_SMOKE_PIECES 2
		#else
			#define NUM_SMOKE_PIECES 1
			#ifndef SMOKEPIECE1
				#define SMOKEPIECE1 SMOKEPIECE
			#endif
		#endif
	#endif
#endif


SmokeUnit()
{
	var healthpercent, sleeptime, smoketype;

#if NUM_SMOKE_PIECES > 1
	var choice;
#endif

	// Wait until the unit is actually built
	while (get BUILD_PERCENT_LEFT)
	{
		sleep 400;
	}

	// Smoke loop
	while (TRUE)
	{
		// How is the unit doing?
		healthpercent = get HEALTH;

		if (healthpercent < 66)
		{
			// Emit a puff of smoke

			smoketype = SFXTYPE_BLACKSMOKE;

			if (rand( 1, 66 ) < healthpercent)
			{
				smoketype = SFXTYPE_WHITESMOKE;
			}

		 	// Figure out which piece the smoke will emit from, and spit it out

#if NUM_SMOKE_PIECES == 1
			emit-sfx smoketype from SMOKEPIECE1;
#else
			choice = rand( 1, NUM_SMOKE_PIECES );

			if (choice == 1)
			{	emit-sfx smoketype from SMOKEPIECE1; }
			if (choice == 2)
			{	emit-sfx smoketype from SMOKEPIECE2; }
 #if NUM_SMOKE_PIECES >= 3
			if (choice == 3)
			{	emit-sfx smoketype from SMOKEPIECE3; }
  #if NUM_SMOKE_PIECES >= 4
			if (choice == 4)
			{	emit-sfx smoketype from SMOKEPIECE4; }
  #endif
 #endif
#endif
		}

		// Delay between puffs

		sleeptime = healthpercent * 50;
		if (sleeptime < 200)
		{
			sleeptime = 200;	// Fastest rate is five times per second
		}

		sleep sleeptime;
	}
}

// Clean up pre-processor
#undef NUM_SMOKE_PIECES


#endif // #ifdef TA

#endif // if SMOKE_H_

/*
** SFXtype.h -- Special Effects Type information for scripts
**
** Copyright 1997 Cavedog Entertainment
*/

#ifndef __SFXTYPE_H_
#define __SFXTYPE_H_

/*
Special Effect Particles referenced in the scripting language
with the command "emit-sfx".  This file is included by any
scripts that use the command, as well as TAObjScr.cpp in the game,
so it can start the proper effect.
*/

// IMPORTANT:	If you change these defines, copy the file to
//				v:\totala\cdimage\scripts so the scripts have
//				access to the proper data, and recompile them.


// Vector-based special effects

#define SFXTYPE_VTOL			0
#define SFXTYPE_THRUST			1
#define	SFXTYPE_WAKE1			2
#define	SFXTYPE_WAKE2			3
#define	SFXTYPE_REVERSEWAKE1	4
#define	SFXTYPE_REVERSEWAKE2	5



// Point-based (piece origin) special effects

#define SFXTYPE_POINTBASED	256

#define SFXTYPE_WHITESMOKE	(SFXTYPE_POINTBASED | 1)
#define SFXTYPE_BLACKSMOKE	(SFXTYPE_POINTBASED | 2)
#define SFXTYPE_SUBBUBBLES	
// New in TA:K
#define SFXTYPE_SMALLDAMAGEFLAME	(SFXTYPE_POINTBASED | 4)
#define SFXTYPE_MEDIUMDAMAGEFLAME	(SFXTYPE_POINTBASED | 5)
#define SFXTYPE_LARGEDAMAGEFLAME	(SFXTYPE_POINTBASED | 6)


// Sound priorities in TA:K
#define PLAYSOUND_PRIORITY_BATTLE		4


// SFX Occupy States
#define SFXOCCUPY_AIR		5

#endif

/*
** EXPtype.h -- Explosion Type information for scripts
**
** Copyright 1997 Cavedog Entertainment
*/

#ifndef EXPTYPE_H
#define EXPTYPE_H

/*
Special Effect Particles referenced in the scripting language
with the command emit-sfx.  This file is included by any scripts
that use the command, as well as TAObjScr.cpp in the game, so
it can start the proper effect.
*/

/*
Exploding pieces are activated in the scripting language with
the command "explode".  This file is included by any scripts
that use the command, as well as TAObjScr.cpp in the game, so
it can create the proper effect.
*/

// IMPORTANT:	If you change these defines, copy the file to
//				v:\totala\cdimage\scripts so the scripts have
//				access to the proper data, and recompile them.

#define SHATTER			1		// The piece will shatter instead of remaining whole
#define EXPLODE_ON_HIT		2		// The piece will explode when it hits the ground
#define FALL			4		// The piece will fall due to gravity instead of just flying off
#define SMOKE			8		// A smoke trail will follow the piece through the air
#define FIRE			16		// A fire trail will follow the piece through the air
#define BITMAPONLY		32		// The piece will not fly off or shatter or anything.  Only a bitmap explosion will be rendered.


// Bitmap Explosion Types (these will be changed eventually)

#define BITMAP1			256
#define BITMAP2			512
#define BITMAP3			1024
#define BITMAP4			2048
#define BITMAP5			4096
#define BITMAPNUKE		8192

#define BITMAPMASK		16128	// Mask of the possible bitmap bits

// New in TA:K
#define EXPTYPE_SMALLEXPLOSION	256
#define EXPTYPE_MEDIUMEXPLOSION	512
#define EXPTYPE_LARGEEXPLOSION	1024
#define EXPTYPE_XLARGEEXPLOSION	2048
#define EXPTYPE_BLOODEXPLOSION	4096
#define EXPTYPE_SMALLSMOKE		8192
#define EXPTYPE_MEDIUMSMOKE		16384
#define EXPTYPE_XLARGESMOKE		65536


// Damage types in TA:K
#define DT_FIRE					2
#define DT_EXPLOSION			3
#define DT_PARALYZER			4


// Indices for set/get value
#define ACTIVATION			1	// set or get
#define STANDINGMOVEORDERS	2	// set or get
#define STANDINGFIREORDERS	3	// set or get
#define HEALTH				4	// get (0-100%)
#define INBUILDSTANCE		5	// set or get
#define BUSY				6	// set or get (used by misc. special case missions like transport ships)
#define PIECE_XZ			7	// get
#define PIECE_Y				8	// get
#define UNIT_XZ				9	// get
#define	UNIT_Y				10	// get
#define UNIT_HEIGHT			11	// get
#define XZ_ATAN				12	// get atan of packed x,z coords
#define XZ_HYPOT			13	// get hypot of packed x,z coords
#define ATAN				14	// get ordinary two-parameter atan
#define HYPOT				15	// get ordinary two-parameter hypot
#define GROUND_HEIGHT		16	// get
#define BUILD_PERCENT_LEFT	17	// get 0 = unit is built and ready, 1-100 = How much is left to build
#define YARD_OPEN			18	// set or get (change which plots we occupy when building opens and closes)
#define BUGGER_OFF			19	// set or get (ask other units to clear the area)
#define ARMORED				20	// set or get
// New in TA:K
#define WEAPON_AIM_ABORTED	21
#define WEAPON_READY		22
#define WEAPON_LAUNCH_NOW	23
#define FINISHED_DYING		26
#define ORIENTATION			27
#define IN_WATER			28
#define CURRENT_SPEED		29
#define MAGIC_DEATH			31
#define VETERAN_LEVEL		32
#define ON_ROAD				34

#endif // EXPTYPE_H




walk()
{
    if( anim_variable )
    {
    move pelvis to y-axis <-0.450000> now;
    move rleg to y-axis <0.00000> now;
    move lleg to z-axis <0.00000> now;
    move rfoot to z-axis <0.00000> now;
    move lfoot to z-axis <0.00000> now;
    move head to y-axis <0.00000> now;
    move rightarm to x-axis <0.00000> now;
    move rightarm to x-axis <0.00000> now;
    move rightarm to z-axis <0.00000> now;
    move rightarm to x-axis <0.00000> now;
    move rightarm to y-axis <0.00000> now;
    move rightarm to z-axis <0.00000> now;
    move flareR to x-axis <0.00000> now;
    turn torso to x-axis <12.659341> now;
    turn lthigh to x-axis <12.00> now;
    turn rthigh to x-axis <-48.00> now;
    turn rleg to x-axis <-4.00> now;
    turn rfoot to x-axis <46.945055> now;
	turn lleg to x-axis <61.010989> now;
	turn lfoot to x-axis <-50.395604> now;
	sleep 60;
} 
	if( ANIM_VARIABLE )
	{
		move pelvis to y-axis [-0.400000] now;
		turn pelvis to x-axis <-3.098901> now;
		turn torso to x-axis <12.659341> now;
		turn lthigh to x-axis <34.098901> now;
		turn rthigh to x-axis <-27.901099> now;
		turn rleg to x-axis <-6.642857> now;
		turn rfoot to x-axis <37.642857> now;
		turn lleg to x-axis <33.626374> now;
		turn lfoot to x-axis <-24.615385> now;
		sleep 60;
	}
	if( ANIM_VARIABLE )
	{
		move pelvis to y-axis [-0.300000] now;
		turn pelvis to x-axis <-4.868132> now;
		turn torso to x-axis <12.659341> now;
		turn lthigh to x-axis <28.758242> now;
		turn rthigh to x-axis <-19.043956> now;
		turn rleg to x-axis <-4.428571> now;
		turn rfoot to x-axis <27.901099> now;
		turn lleg to x-axis <13.736264> now;
		turn lfoot to x-axis <-25.994505> now;
		sleep 60;
	}
	if( ANIM_VARIABLE )
	{
		move pelvis to y-axis [-0.100000] now;
		turn pelvis to x-axis <-6.197802> now;
		turn torso to x-axis <12.659341> now;
		turn lthigh to x-axis <12.824176> now;
		turn rthigh to x-axis <0.000000> now;
		turn rleg to x-axis <3.098901> now;
		turn rfoot to x-axis <2.214286> now;
		turn lleg to x-axis <-12.346154> now;
		turn lfoot to x-axis <7.659341> now;
		sleep 60;
	}
	if( ANIM_VARIABLE )
	{
		move pelvis to y-axis [0.000000] now;
		turn pelvis to x-axis <-4.868132> now;
		turn torso to x-axis <12.307692> now;
		turn lthigh to x-axis <-19.483516> now;
		turn rthigh to x-axis <1.769231> now;
		turn rleg to x-axis <8.412088> now;
		turn rfoot to x-axis <-6.197802> now;
		turn lleg to x-axis <-16.829670> now;
		turn lfoot to x-axis <42.516484> now;
		sleep 60;
	}
	if( ANIM_VARIABLE )
	{
		move pelvis to y-axis [-0.350000] now;
		turn pelvis to x-axis <-3.098901> now;
		turn torso to x-axis <12.307692> now;
		turn lthigh to x-axis <-32.329670> now;
		turn rthigh to x-axis <13.285714> now;
		turn rleg to x-axis <23.170330> now;
		turn rfoot to x-axis <-33.186813> now;
		turn lfoot to x-axis <7.362637> now;
		sleep 60;
	}
	if( ANIM_VARIABLE )
	{
		move pelvis to y-axis [-0.400000] now;
		turn pelvis to x-axis <-0.439560> now;
		turn torso to x-axis <12.659341> now;
		turn lthigh to x-axis <-36.318681> now;
		turn rleg to x-axis <43.582418> now;
		turn rfoot to x-axis <-43.153846> now;
		turn lleg to x-axis <-10.093407> now;
		turn lfoot to x-axis <28.241758> now;
		sleep 60;
	}
	if( ANIM_VARIABLE )
	{
		move pelvis to y-axis [-0.450000] now;
		turn pelvis to x-axis <-0.439560> now;
		turn torso to x-axis <12.659341> now;
		turn lthigh to x-axis <-42.071429> now;
		turn rthigh to x-axis <12.840659> now;
		turn rleg to x-axis <60.697802> now;
		turn rfoot to x-axis <-44.835165> now;
		turn lleg to x-axis <-4.428571> now;
		turn lfoot to x-axis <46.945055> now;
		sleep 60;
	}
	if( ANIM_VARIABLE )
	{
		move pelvis to y-axis [-0.400000] now;
		turn pelvis to x-axis <-3.098901> now;
		turn torso to x-axis <12.659341> now;
		turn lthigh to x-axis <-32.774725> now;
		turn rthigh to x-axis <34.098901> now;
		turn rleg to x-axis <23.626374> now;
		turn rfoot to x-axis <-10.802198> now;
		turn lleg to x-axis <-5.752747> now;
		turn lfoot to x-axis <42.516484> now;
		sleep 60;
	}
	if( ANIM_VARIABLE )
	{
		move pelvis to y-axis [-0.300000] now;
		turn pelvis to x-axis <-4.868132> now;
		turn torso to x-axis <12.659341> now;
		turn lthigh to x-axis <-25.241758> now;
		turn rthigh to x-axis <28.785714> now;
		turn rleg to x-axis <10.532967> now;
		turn rfoot to x-axis <-20.994505> now;
		turn lleg to x-axis <-3.983516> now;
		turn lfoot to x-axis <33.659341> now;
		sleep 60;
	}
	if( ANIM_VARIABLE )
	{
		move pelvis to y-axis [-0.099994] now;
		turn pelvis to x-axis <-6.197802> now;
		turn torso to x-axis <12.659341> now;
		turn lthigh to x-axis <-12.401099> now;
		turn rthigh to x-axis <-0.439560> now;
		turn rleg to x-axis <-11.670330> now;
		turn rfoot to x-axis <22.989011> now;
		turn lleg to x-axis <4.126374> now;
		turn lfoot to x-axis <14.027473> now;
		sleep 60;
	}
	if( ANIM_VARIABLE )
	{
		move pelvis to y-axis [0.000000] now;
		turn pelvis to x-axis <-4.868132> now;
		turn lthigh to x-axis <0.000000> now;
		turn rthigh to x-axis <-19.483516> now;
		turn rleg to x-axis <-20.318681> now;
		turn rfoot to x-axis <23.450549> now;
		turn lleg to x-axis <24.208791> now;
		turn lfoot to x-axis <-20.747253> now;
		sleep 60;
	}
	if( ANIM_VARIABLE )
	{
		move pelvis to y-axis [-0.350000] now;
		turn pelvis to x-axis <-3.098901> now;
		turn lthigh to x-axis <9.296703> now;
		turn rthigh to x-axis <-28.785714> now;
		turn rleg to x-axis <-25.241758> now;
		turn rfoot to x-axis <26.126374> now;
		turn lleg to x-axis <31.884615> now;
		turn lfoot to x-axis <-37.642857> now;
		sleep 60;
	}
	move pelvis to y-axis [-0.400000] now;
	turn pelvis to x-axis <-0.439560> now;
	turn torso to x-axis <12.659341> now;
	turn lthigh to x-axis <11.071429> now;
	turn rthigh to x-axis <-37.203297> now;
	turn rleg to x-axis <-9.296703> now;
	turn rfoot to x-axis <6.115385> now;
	turn lleg to x-axis <47.620879> now;
	turn lfoot to x-axis <-47.428571> now;
	sleep 60;
}
walklegs()
{
	if( ANIM_VARIABLE )
	{
		move pelvis to y-axis [-0.450000] now;
		move rleg to y-axis [0.000000] now;
		move rleg to z-axis [0.000000] now;
		move rfoot to z-axis [0.000000] now;
		move lleg to y-axis [0.000000] now;
		move lleg to z-axis [0.000000] now;
		move lfoot to z-axis [0.000000] now;
		move head to y-axis [0.000000] now;
		move sleeveR to x-axis [0.000000] now;
		move SLEEVER to y-axis [0.000000] now;
		move SLEEVER to z-axis [0.000000] now;
		move rightarm to x-axis [0.000000] now;
		move rightarm to y-axis [0.000000] now;
		move rightarm to z-axis [0.000000] now;
        MOVE FLARER TO X-AXIS [0.000000] NOW;
        turn pelvis to x-axis <-0.439560> now;
		turn lthigh to x-axis <11.071429> now;
		turn rthigh to x-axis <-42.071429> now;
		turn rleg to x-axis <-4.868132> now;
		turn rfoot to x-axis <46.945055> now;
		turn lleg to x-axis <61.010989> now;
		turn lfoot to x-axis <-50.395604> now;
		sleep 60;
	}
	if( ANIM_VARIABLE )
	{
		move pelvis to y-axis [-0.400000] now;
		turn pelvis to x-axis <-3.098901> now;
		turn lthigh to x-axis <34.098901> now;
		turn rthigh to x-axis <-27.901099> now;
		turn rleg to x-axis <-6.642857> now;
		turn rfoot to x-axis <37.642857> now;
		turn lleg to x-axis <33.626374> now;
		turn lfoot to x-axis <-24.615385> now;
		sleep 60;
	}
	if( ANIM_VARIABLE )
	{
		move pelvis to y-axis [-0.300000] now;
		turn pelvis to x-axis <-4.868132> now;
		turn lthigh to x-axis <28.758242> now;
		turn rthigh to x-axis <-19.043956> now;
		turn rleg to x-axis <-4.428571> now;
		turn rfoot to x-axis <27.901099> now;
		turn lleg to x-axis <13.736264> now;
		turn lfoot to x-axis <-25.994505> now;
		sleep 60;
	}
	if( ANIM_VARIABLE )
	{
		move pelvis to y-axis [-0.100000] now;
		turn pelvis to x-axis <-6.197802> now;
		turn lthigh to x-axis <12.824176> now;
		turn rthigh to x-axis <0.000000> now;
		turn rleg to x-axis <3.098901> now;
		turn rfoot to x-axis <2.214286> now;
		turn lleg to x-axis <-12.346154> now;
		turn lfoot to x-axis <7.659341> now;
		sleep 60;
	}
	if( ANIM_VARIABLE )
	{
		move pelvis to y-axis [0.000000] now;
		turn pelvis to x-axis <-4.868132> now;
		turn lthigh to x-axis <-19.483516> now;
		turn rthigh to x-axis <1.769231> now;
		turn rleg to x-axis <8.412088> now;
		turn rfoot to x-axis <-6.197802> now;
		turn lleg to x-axis <-16.829670> now;
		turn lfoot to x-axis <42.516484> now;
		sleep 60;
	}
	if( ANIM_VARIABLE )
	{
		move pelvis to y-axis [-0.350000] now;
		turn pelvis to x-axis <-3.098901> now;
		turn lthigh to x-axis <-32.329670> now;
		turn rthigh to x-axis <13.285714> now;
		turn rleg to x-axis <23.170330> now;
		turn rfoot to x-axis <-33.186813> now;
		turn lfoot to x-axis <7.362637> now;
		sleep 60;
	}
	if( ANIM_VARIABLE )
	{
		move pelvis to y-axis [-0.400000] now;
		turn pelvis to x-axis <-0.439560> now;
		turn lthigh to x-axis <-36.318681> now;
		turn rleg to x-axis <43.582418> now;
		turn rfoot to x-axis <-43.153846> now;
		turn lleg to x-axis <-10.093407> now;
		turn lfoot to x-axis <28.241758> now;
		sleep 60;
	}
	if( ANIM_VARIABLE )
	{
		move pelvis to y-axis [-0.450000] now;
		turn pelvis to x-axis <-0.439560> now;
		turn lthigh to x-axis <-42.071429> now;
		turn rthigh to x-axis <12.840659> now;
		turn rleg to x-axis <60.697802> now;
		turn rfoot to x-axis <-44.835165> now;
		turn lleg to x-axis <-4.428571> now;
		turn lfoot to x-axis <46.945055> now;
		sleep 60;
	}
	if( ANIM_VARIABLE )
	{
		move pelvis to y-axis [-0.400000] now;
		turn pelvis to x-axis <-3.098901> now;
		turn lthigh to x-axis <-32.774725> now;
		turn rthigh to x-axis <34.098901> now;
		turn rleg to x-axis <23.626374> now;
		turn rfoot to x-axis <-10.802198> now;
		turn lleg to x-axis <-5.752747> now;
		turn lfoot to x-axis <42.516484> now;
		sleep 60;
	}
	if( ANIM_VARIABLE )
	{
		move pelvis to y-axis [-0.300000] now;
		turn pelvis to x-axis <-4.868132> now;
		turn lthigh to x-axis <-25.241758> now;
		turn rthigh to x-axis <28.785714> now;
		turn rleg to x-axis <10.532967> now;
		turn rfoot to x-axis <-20.994505> now;
		turn lleg to x-axis <-3.983516> now;
		turn lfoot to x-axis <33.659341> now;
		sleep 60;
	}
	if( ANIM_VARIABLE )
	{
		move pelvis to y-axis [-0.099994] now;
		turn pelvis to x-axis <-6.197802> now;
		turn lthigh to x-axis <-12.401099> now;
		turn rthigh to x-axis <-0.439560> now;
		turn rleg to x-axis <-11.670330> now;
		turn rfoot to x-axis <22.989011> now;
		turn lleg to x-axis <4.126374> now;
		turn lfoot to x-axis <14.027473> now;
		sleep 60;
	}
	if( ANIM_VARIABLE )
	{
		move pelvis to y-axis [0.000000] now;
		turn pelvis to x-axis <-4.868132> now;
		turn lthigh to x-axis <0.000000> now;
		turn rthigh to x-axis <-19.483516> now;
		turn rleg to x-axis <-20.318681> now;
		turn rfoot to x-axis <23.450549> now;
		turn lleg to x-axis <24.208791> now;
		turn lfoot to x-axis <-20.747253> now;
		sleep 60;
	}
	if( ANIM_VARIABLE )
	{
		move pelvis to y-axis [-0.350000] now;
		turn pelvis to x-axis <-3.098901> now;
		turn lthigh to x-axis <9.296703> now;
		turn rthigh to x-axis <-28.785714> now;
		turn rleg to x-axis <-25.241758> now;
		turn rfoot to x-axis <26.126374> now;
		turn lleg to x-axis <31.884615> now;
		turn lfoot to x-axis <-37.642857> now;
		sleep 60;
	}
	move pelvis to y-axis [-0.400000] now;
	turn pelvis to x-axis <-0.439560> now;
	turn lthigh to x-axis <11.071429> now;
	turn rthigh to x-axis <-37.203297> now;
	turn rleg to x-axis <-9.296703> now;
	turn rfoot to x-axis <6.115385> now;
	turn lleg to x-axis <47.620879> now;
	turn lfoot to x-axis <-47.428571> now;
	sleep 60;
}
MotionControl()
	{
	var	moving, aiming, just_moved;

	// So the stand will get reset
	just_moved = TRUE;

	while (TRUE)
		{
		moving = bMoving;
		aiming = bAiming;

		if (moving)
			{
			if (aiming)
				{
				bCanAim = TRUE;
				call-script walklegs();
				}
				
					if (NOT aiming)
				{
				bCanAim = FALSE;
				call-script walk();
				}

			just_moved = TRUE;
			}

		if (NOT moving)
			{
			bCanAim = TRUE;

			if (just_moved)
				{
				#define RESTORESPEED <200>
		
				MOVE PELVIS TO Y-AXIS 0 SPEED [1];
				TURN RTHIGH TO X-AXIS 0 SPEED RESTORESPEED;
				TURN RLEG TO X-AXIS 0 SPEED RESTORESPEED;
				TURN RFOOT TO X-AXIS 0 SPEED RESTORESPEED;
				TURN LTHIGH TO X-AXIS 0 SPEED RESTORESPEED;
				TURN LLEG TO X-AXIS 0 SPEED RESTORESPEED;
				TURN LFOOT TO X-AXIS 0 SPEED RESTORESPEED;
				
		    if (NOT aiming)
					{
					turn torso to y-axis 0 speed <90>;
					TURN RIGHTARM TO X-AXIS 0 SPEED RESTORESPEED;
					TURN SLEEVER TO X-AXIS 0 SPEED RESTORESPEED;
					}
					#UNDEF RESTORESPEED
					
					JUST_MOVED = FALSE;
					}

				sleep 100;
			}
		}
	}

Create()
	{
	HIDE FLARER;
		bMoving = FALSE;
	bAiming = FALSE;
	bCanAim = TRUE;

	gun = 0;

	// Motion control system
	start-script MotionControl();
	start-script SmokeUnit();
	}
	StartMoving()
	{
	bMoving = TRUE;
	}

StopMoving()
	{
	bMoving = FALSE;
	}

SweetSpot(piecenum)
	{
	piecenum=0;
	}

RestoreAfterDelay()
	{
	// Wait for something to happen
	sleep 2750;
	
	//RESTORE THE STANDARD POSITION
	
	TURN TORSO TO Y-AXIS 0 SPEED <90>;
	TURN RIGHTARM TO X-AXIS 0 SPEED <45>;
	TURN SLEEVER TO X-AXIS 0 SPEED <45>;
	
    WAIT-FOR-TURN TORSO AROUND Y-AXIS;
    WAIT-FOR-TURN RIGHTARM AROUND X-AXIS;
    WAIT-FOR-TURN SLEEVER AROUND X-AXIS;
    
    BAIMING = FALSE;
    }
AimFromPrimary(piecenum)
	{
	piecenum=0;		// Aim from the torso
	}
QueryPrimary(piecenum)
	{
	if (gun == 0)
		{
		piecenum=3;
		}
	if (gun == 1)
		{
		piecenum=4;
		}
	}

AimPrimary(heading,pitch)
	{
	signal SIG_AIM;					// kill off other aim scripts
	set-signal-mask SIG_AIM;		// so other scripts can kill us

	// Announce that we would like to aim, and wait until we can
	bAiming = TRUE;
	while (NOT bCanAim)
		{
		sleep 100;
		}

	// Aim
QueryPrimary(piecenum)
	{
	if (gun == 0)
		{
		piecenum=3;
		}
	if (gun == 1)
		{
		piecenum=4;
		}
	}

AimPrimary(heading,pitch)
	{
	signal SIG_AIM;					// kill off other aim scripts
	set-signal-mask SIG_AIM;		// so other scripts can kill us

	// Announce that we would like to aim, and wait until we can
	bAiming = TRUE;
	while (NOT bCanAim)
		{
		sleep 100;
		}

	// Aim
QueryPrimary(piecenum)
	{
	if (gun == 0)
		{
		piecenum=3;
		}
	if (gun == 1)
		{
		piecenum=4;
		}
	}

AimPrimary(heading,pitch)
	{
	signal SIG_AIM;					// kill off other aim scripts
	set-signal-mask SIG_AIM;		// so other scripts can kill us

	// Announce that we would like to aim, and wait until we can
	bAiming = TRUE;
	while (NOT bCanAim)
		{
		sleep 100;
		}

	// Aim
	TURN SLEEVER TO X-AXIS (0 - PITCH) SPEED <45>;
	TURN RIGHTARM TO X-AXIS (0 - PITCH) SPEED <45>;
	
	wait-for-turn torso around y-axis;
	wait-for-turn SLEEVER around x-axis;
	wait-for-turn RIGHTARM around x-axis;
	
		// Start a script that will wait, and restore the standard position if
	// nothing happens after a while.  It inherits the SIG_AIM mask, so
	// it will be killed if a re-aim occurrs
	start-script RestoreAfterDelay();

	return( TRUE );
	}

FirePrimary()
	{
	if (gun = 0)
		{
		// Muzzle flash
        SHOW FLARER;
        SLEEP 100;
        HIDE FLARER;
        }
    }
    
#include "EXPtype.h"


KILLED( SEVERITY, CORPSETYPE)
    {
    HIDE FLARER;
    IF (SEVERITY <=35)
        {
        CORPSETYPE = 1;
        EXPLODE TORSO TYPE BITMAPONLY | BITMAP1;
        EXPLODE GUN TYPE  BITMAPONLY |BITMAP1;
        EXPLODE LLEG TYPE BITMAPONLY |BITMAP1;
        EXPLODE RLEG TYPE BITMAPONLY |BITMAP1;
        EXPLODE SLEEVER TYPE BITMAPONLY |BITMAP1;
        EXPLODE FLARER TYPE BITMAPONLY |BITMAP1;
        EXPLODE RIGHTARM TYPE BITMAPONLY| BITMAP1;
        EXPLODE RTHIGH TYPE BITMAPONLY| BITMAP1;
        EXPLODE LTHIGH TYPE BITMAPONLY| BITMAP1;
        EXPLODE RFOOT TYPE BITMAPONLY|BITMAP1;
        EXPLODE LFOOT TYPE BITMAPONLY|BITMAP1;
        RETURN( 0 );
        }
    IF (SEVERITY <=70)
        {
        CORPSETYPE = 2;
        EXPLODE TORSO TYPE SHATTER|FIRE|SMOKE|EXPLODE_ON_HIT|BITMAP1;
        EXPLODE GUN TYPE FALL|SHATTER|FIRE|SMOKE|EXPLODE_ON_HIT|BITMAP4;
        EXPLODE RIGHTARM TYPE FALL|SHATTER|SMOKE|EXPLODE_ON_HIT|BITMAP4;
        EXPLODE SLEEVER TYPE FALL|SHATTER|SMOKE|EXPLODE_ON_HIT|BITMAP4;
        EXPLODE FLARER TYPE FALL|SHATTER|SMOKE|EXPLODE_ON_HIT|BITMAP5;
        EXPLODE RTHIGH TYPE FALL|SMOKE|FIRE|EXPLODE_ON_HIT|BITMAP1;
        EXPLODE LTHIGH TYPE FALL|SMOKE|FIRE|EXPLODE_ON_HIT|BITMAP1;
        EXPLODE LLEG TYPE FALL|SMOKE|FIRE|EXPLODE_ON_HIT|BITMAP1;
        EXPLODE RLEG TYPE FALL|SMOKE|FIRE|EXPLODE_ON_HIT|BITMAP1;
        EXPLODE RFOOT FALL|SMOKE|FIRE|EXPLODE_ON_HIT|BITMAP1;
        EXPLODE LFOOT FALL|SMOKE|FIRE|EXPLODE_ON_HIT|BITMAP1;
        EXPLODE  BASE TYPE SHATTER|FIRE|SMOKE|EXPLODE_ON_HIT|BITMAP1;
        RETURN( 0 );
        }
    IF (SEVERITY <= 140)
        {
        EXPLODE BASE TYPE SHATTER|FIRE|SMOKE|EXPLODE_ON_HIT|BITMAP1;
        EXPLODE TORSO TYPE SHATTER|FIRE|SMOKE|EXPLODE_ON_HIT|BITMAP1;
        EXPLODE GUN TYPE FALL|SHATTER|FIRE|SMOKE|EXPLODE_ON_HIT|BITMAP4;
        EXPLODE RIGHTARM TYPE FALL|SHATTER|SMOKE|EXPLODE_ON_HIT|BITMAP4;
        EXPLODE SLEEVER TYPE FALL|SHATTER|SMOKE|EXPLODE_ON_HIT|BITMAP4;
        EXPLODE FLARER TYPE FALL|SHATTER|SMOKE|EXPLODE_ON_HIT|BITMAP5;
        EXPLODE RTHIGH TYPE FALL|SMOKE|FIRE|EXPLODE_ON_HIT|BITMAP1;
        EXPLODE LTHIGH TYPE FALL|SMOKE|FIRE|EXPLODE_ON_HIT|BITMAP1;
        EXPLODE LLEG TYPE FALL|SMOKE|FIRE|EXPLODE_ON_HIT|BITMAP1;
        EXPLODE RLEG TYPE FALL|SMOKE|FIRE|EXPLODE_ON_HIT|BITMAP1;
        EXPLODE RFOOT FALL|SMOKE|FIRE|EXPLODE_ON_HIT|BITMAP1;
        EXPLODE LFOOT FALL|SMOKE|FIRE|EXPLODE_ON_HIT|BITMAP1;
        RETURN( 0 );
        }
        
    CORPSETYPE = 3;
    EXPLODE BASE TYPE SHATTER|FIRE|SMOKE|EXPLODE_ON_HIT|BITMAP1;
    EXPLODE TORSO TYPE SHATTER|FIRE|SMOKE|EXPLODE_ON_HIT|BITMAP1;
    EXPLODE GUN TYPE FALL|SHATTER|FIRE|SMOKE|EXPLODE_ON_HIT|BITMAP4;
    EXPLODE RIGHTARM TYPE FALL|SHATTER|SMOKE|EXPLODE_ON_HIT|BITMAP4;
    EXPLODE SLEEVER TYPE FALL|SHATTER|SMOKE|EXPLODE_ON_HIT|BITMAP4;
    EXPLODE FLARER TYPE FALL|SHATTER|SMOKE|EXPLODE_ON_HIT|BITMAP5;
    EXPLODE RTHIGH TYPE FALL|SMOKE|FIRE|EXPLODE_ON_HIT|BITMAP1;
    EXPLODE LTHIGH TYPE FALL|SMOKE|FIRE|EXPLODE_ON_HIT|BITMAP1;
    EXPLODE LLEG TYPE FALL|SMOKE|FIRE|EXPLODE_ON_HIT|BITMAP1;
    EXPLODE RLEG TYPE FALL|SMOKE|FIRE|EXPLODE_ON_HIT|BITMAP1;
    EXPLODE RFOOT FALL|SMOKE|FIRE|EXPLODE_ON_HIT|BITMAP1;
    EXPLODE LFOOT FALL|SMOKE|FIRE|EXPLODE_ON_HIT|BITMAP1;
    RETURN( 0 );
    }

        
	
	
	
	
					
Created today. Took me 5 hours. doesnt work right.
Anything wrong with it? Typos? I figured you guys could help because you all are good with coding. :)
I hate how i tried so hard, and yet failed so epicly. :(
at least the game didn't crash....
Also, if there is a typo, will ta3d find it/crash?
Is it too much scripting for ta3d? :(
Pessimistic/depressive mood........ :(
When you cannot trust your government to lead the nation to better times is when you know the ship is sinking

Durand
Posts: 74
Joined: Thu Nov 04, 2010 11:13 am

Re: Help with a Ta Script

Post by Durand » Mon Jan 31, 2011 8:46 am

What go wrong ?

What Scriptor say ?

Put all your "includes" just after the "#define ta" line.

Why "ifndef" ?


========

Wel, Scriptor don't see anything wrong, at least.

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Re: Help with a Ta Script

Post by zuzuf » Mon Jan 31, 2011 1:53 pm

TA3D won't run a BOS script, it has to be compiled to COB first. If a COB script try to use an unknown byte code or an unknown function TA3D reports it in its log file. Normally TA3D should support all COB files supported by TA (at least without extensions DLLs).

If there is something wrong with it in TA3D, I'd be glad to fix it :)
=>;-D Penguin Powered

Flashbang232
Posts: 155
Joined: Tue Aug 03, 2010 6:59 pm
Location: Behind LOIC

Re: Help with a Ta Script

Post by Flashbang232 » Sat Feb 05, 2011 6:41 pm

I compiled the Cob file, it doesnt work in ta. :p
Scriptor says its fine after i included sfxtype.h, smokeunit.h, and exptype.h

#ifndef is a typo. its supposed to be #ifundef
When you cannot trust your government to lead the nation to better times is when you know the ship is sinking

User avatar
Manimal
Posts: 6
Joined: Tue Mar 15, 2011 9:56 pm
Location: France

Re: Help with a Ta Script

Post by Manimal » Tue Mar 15, 2011 10:40 pm

it seems there are missing closing brackets.
see the duplicates of AimPrimary(heading,pitch) @ line 862 and @ line 887...

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Re: Help with a Ta Script

Post by zuzuf » Tue Mar 15, 2011 11:09 pm

You're right there is definitely something wrong with a couple of duplicates of the header of the AimPrimary function.
=>;-D Penguin Powered

User avatar
Manimal
Posts: 6
Joined: Tue Mar 15, 2011 9:56 pm
Location: France

Re: Help with a Ta Script

Post by Manimal » Tue Mar 15, 2011 11:12 pm

Thanks to NotePad ++ which is a very usefull and light weighted Editor with syntax highlighting :-)

Flashbang232
Posts: 155
Joined: Tue Aug 03, 2010 6:59 pm
Location: Behind LOIC

Re: Help with a Ta Script

Post by Flashbang232 » Mon Mar 28, 2011 4:39 am

Meh, why even bother, theres really nothing to look forward to anymore, so f*** it.
When you cannot trust your government to lead the nation to better times is when you know the ship is sinking

Post Reply

Who is online

Users browsing this forum: No registered users and 36 guests