Page 1 of 1

problem scripting an unit

Posted: 09 Apr 2007, 05:16
by lgustavomp
hello ppl.

I'm trying to learn how to script a basic unit on Spring.. but it's not being easy. Cause i don't find any spring BOSes as references.

Here's my try. Is an Enforcer with a Raider cannon.. but both cannons doesn't fire nor aim in game. Only the depthcharges are fired.

I searched the forum for examples to copy script fragments... but i've not found any helpfull things.

What am i doing wrong? The img (with piece names) and BOS are attached. Any help would be greatly apreciated.

Weapon 1 = main original cannon
Weapon 2 = the new raider cannon
Weapon 3 = depthcharge

Image

Code: Select all

#define TA			// This is a TA script

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

piece  flarea1, flarea2, flareb, base, turret, sleeves, wake1, wake2,
       barrel1, barrel2, fp11, fp12, fp31, turretl, sleevel, barrell, flarel;

static-var  fire, restore_delay;


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 flarea1;
	hide flarea2;
	hide flareb;
	hide flarel;
	fire = 0;
	restore_delay = 3000;
	start-script SmokeUnit();
}

SetMaxReloadTime(time)
{
	restore_delay = time * 2;
}

abaim()
{
	sleep 4000;
	signal 8;
}

RestoreAfterDelay()
{
	sleep restore_delay;
	turn turret to y-axis 0 speed <35>;
	turn sleeves to x-axis 0 speed <15>;
	turn turretl to y-axis 0 speed <45>;
	turn sleevel to x-axis 0 speed <25>;
}

StartMoving()
{
	signal 16;
	set-signal-mask 16;
	while( TRUE )
	{
		emit-sfx 2 from wake1;
		emit-sfx 4 from wake2;
		sleep 300;
	}
}

StopMoving()
{
	signal 16;
}

AimPrimary(heading, pitch)
{
	signal 2;
	set-signal-mask 2;
	turn turret to y-axis heading speed <70>;
	turn sleeves to x-axis 0 - pitch speed <40>;
	wait-for-turn turret around y-axis;
	wait-for-turn sleeves around x-axis;
	start-script RestoreAfterDelay();
	return (1);
}

AimTertiary(heading, pitch)
{
	signal 8;
	set-signal-mask 8;
	start-script abaim();
	return (1);
}

TargetCleared(time)
{
	signal 8;
}

FirePrimary()
{
	if( fire == 0 )
	{
		move barrel1 to z-axis [-2.4] speed [500];
		wait-for-move barrel1 along z-axis;
		move barrel1 to z-axis [0] speed [3.0];
		show flarea1;
		sleep 150;
		hide flarea1;
	}
	if( fire == 1 )
	{
		move barrel2 to z-axis [-2.4] speed [500];
		wait-for-move barrel2 along z-axis;
		move barrel2 to z-axis [0] speed [3.0];
		show flarea2;
		sleep 150;
		hide flarea2;
	}
	fire = !fire;
}

FireTertiary()
{
	return (1);
}

AimFromPrimary(piecenum)
{
	piecenum = turret;
}

QueryPrimary(piecenum)
{
	if( fire == 0 )
	{
		piecenum = flarea1;
	}
	if( fire == 1 )
	{
		piecenum = flarea2;
	}
}

AimFromTertiary(piecenum)
{
	piecenum = fp31;
}

QueryTertiary(piecenum)
{
	piecenum = fp31;
}

SweetSpot(piecenum)
{
	piecenum = base;
}

AimSecondary(heading,pitch)
	{
	signal 4;
	set-signal-mask 4;
	turn turretl to y-axis heading speed <90>;
	turn barrell to x-axis (0-pitch) speed <50>;
	wait-for-turn turretl around y-axis;
	wait-for-turn barrell around x-axis;
	start-script RestoreAfterDelay();
	return(1);
	}

FireSecondary()
	{
	show flarel;
	move barrell to z-axis [-2.4] speed [500];
	sleep 150;
	hide flarel;
	wait-for-move barrell along z-axis;
	move barrell to z-axis [0] speed [3.0];
	}

AimFromSecondary(piecenum)
	{
	piecenum=turretl;
	}

QuerySecondary(piecenum)
	{
	piecenum=flarel;
	}
	
Killed(severity, corpsetype)
{
	hide flarea1;
	hide flarea2;
	hide flareb;
	hide flarel;
	if( severity <= 25 )
	{
		corpsetype = 1;
		explode barrel1 type BITMAPONLY | BITMAP1;
		explode barrel2 type BITMAPONLY | BITMAP2;
		explode base type BITMAPONLY | BITMAP3;
		explode flarea1 type BITMAPONLY | BITMAP4;
		explode flarea2 type BITMAPONLY | BITMAP5;
		explode flareb type BITMAPONLY | BITMAP5;
		explode sleeves type BITMAPONLY | BITMAP5;
		explode turret type BITMAPONLY | BITMAP1;
		explode wake1 type BITMAPONLY | BITMAP3;
		explode wake2 type BITMAPONLY | BITMAP4;
		return (0);
	}
	if( severity <= 50 )
	{
		corpsetype = 2;
		explode barrel1 type FALL | BITMAP1;
		explode barrel2 type FALL | BITMAP2;
		explode base type BITMAPONLY | BITMAP3;
		explode flarea1 type FALL | BITMAP4;
		explode flarea2 type FALL | BITMAP5;
		explode flareb type FALL | BITMAP5;
		explode sleeves type BITMAPONLY | BITMAP5;
		explode turret type BITMAPONLY | BITMAP1;
		explode wake1 type FALL | BITMAP3;
		explode wake2 type FALL | BITMAP4;
		return (0);
	}
	if( severity <= 99 )
	{
		corpsetype = 3;
		explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1;
		explode barrel2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
		explode base type BITMAPONLY | BITMAP3;
		explode flarea1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
		explode flarea2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP5;
		explode flareb type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP5;
		explode sleeves type BITMAPONLY | BITMAP5;
		explode turret type BITMAPONLY | BITMAP1;
		explode wake1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
		explode wake2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
		return (0);
	}
	corpsetype = 3;
	explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1;
	explode barrel2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
	explode base type BITMAPONLY | BITMAP3;
	explode flarea1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
	explode flarea2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP5;
	explode flareb type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP5;
	explode sleeves type BITMAPONLY | BITMAP5;
	explode turret type BITMAPONLY | BITMAP1;
	explode wake1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
	explode wake2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
}

Posted: 09 Apr 2007, 08:50
by smoth
we would need the FBI also.


and: http://www.planetannihilation.com/tadc/ ... t_01_2.asp

Try starting here first. it is a walk through on a tank.

Posted: 09 Apr 2007, 09:01
by lgustavomp
Thank you for the tut smoth

here's the FBI

Code: Select all

[UNITINFO]
{
	//************************************************************
	//  Unit Description
	//********************
	side=Core;
	name=Enforcer;
	description=- Destroyer;
	icontype=sea;

	//************************************************************
	//  Categories
	//**************
	category=CORE SHIP LEVEL2 WEAPON ANTISUB NOTAIR NOTSUB CTRL_W;
	tedclass=SHIP;

	//************************************************************
	//  External Specs
	//******************
	unitname=core_enforcer;
	unitnumber=131;
	objectname=core_enforcer.3do;
	corpse=core_enforcer_dead;
	buildpic=core_enforcer.DDS;
	soundcategory=CORE_SHIP;

	//************************************************************
	//  Health/Cost/Size
	//********************
	maxdamage=4300;
	healtime=30;
	buildcostmetal=1183;
	buildcostenergy=6007;
	buildtime=13368;
	footprintx=4;
	footprintz=4;

	//************************************************************
	//  Resources
	//*************
	metalstorage=0;
	energymake=1.9;
	energyuse=1.9;
	energystorage=0;

	//************************************************************
	//  Building
	//************
	buildangle=16384;
	activatewhenbuilt=1;

	//************************************************************
	//  Constructor
	//***************
	builder=0;
	workertime=0;

	//************************************************************
	//  Abilities
	//*************
	canattack=1;
	candgun=1;
	canguard=1;
	canmove=1;
	canpatrol=1;
	canstop=1;
	floater=1;

	//************************************************************
	//  Movement
	//************
	movementclass=BOATS4;
	turnrate=384;
	acceleration=0.027;
	brakerate=0.0183106;
	maxvelocity=2.93;
	minwaterdepth=12;

	//************************************************************
	//  Sight/Radar/Sonar
	//*********************
	sightdistance=495;
	radardistance=0;
	sonardistance=405;

	//************************************************************
	//  Weapons
	//***********
	weapon1=CORE_ROY;
	weapon2=CORE_LIGHTCANNON;
	weapon3=ARMDEPTHCHARGE;
	nochasecategory=VTOL;
	badtargetcategory=VTOL;
	wpri_badtargetcategory=VTOL;
	wspe_badtargetcategory=NOTSUB;
	explodeas=SMALL_UNITEX;
	selfdestructas=SMALL_UNIT;

	//************************************************************
	//  Orders
	//**********
	noautofire=0;
	firestandorders=1;
	mobilestandorders=1;
	standingfireorder=2;
	standingmoveorder=1;
	defaultmissiontype=Standby;

	//************************************************************
	//  Miscellaneous
	//*****************
	bmcode=1;
	designation=SA-AS4;
	downloadable=1;
	maneuverleashlength=640;
	scale=0.6;
	shootme=1;
	steeringmode=1;
	threed=1;
	version=1.2;
	zbuffer=1;

	//************************************************************
	//  To be removed
	//*****************

}

Posted: 09 Apr 2007, 09:34
by smoth
I cleaned it up a bit for you... note the functions that I said should be deleted. See if my changing the number conventions helped. Also it is useful to group similar functions as I have so you can find things when debugging.

Code: Select all

#define TA         // This is a TA script

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

piece  flarea1, flarea2, flareb, base, turret, sleeves, wake1, wake2,
       barrel1, barrel2, fp11, fp12, fp31, turretl, sleevel, barrell, flarel;

static-var  fire, restore_delay;


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


StartMoving()
{
   signal 16;
   set-signal-mask 16;
   while( TRUE )
   {
      emit-sfx 2 from wake1;
      emit-sfx 4 from wake2;
      sleep 300;
   }
}

StopMoving()
{   signal 16;	}


Create()
{
   hide flarea1;
   hide flarea2;
   hide flareb;
   hide flarel;
   fire = 0;
   restore_delay = 3000;
   start-script SmokeUnit();
}

//aim points

AimFromWeapon1(piecenum)
{   piecenum = turret;	}

AimFromWeapon2(piecenum)
{   piecenum=turretl;   }

AimFromWeapon3(piecenum)
{   piecenum = fp31;	}

//where the projectile emits from

QueryWeapon1(piecenum)
{
   if( fire == 0 )
   {  piecenum = flarea1;   }

   if( fire == 1 )
   {  piecenum = flarea2;   }
}

QueryWeapon2(piecenum)
{   piecenum=flarel;   }

QueryWeapon3(piecenum)
{   piecenum = fp31;	}

/*delete this 


-------spring does not use it!---------
SweetSpot(piecenum)
{   piecenum = base;	}



-------spring does not use it!---------
SetMaxReloadTime(time)
{   restore_delay = time * 2;	}



-------you are not using it!---------
TargetCleared(time)
{   signal 8;	}

*/

//anim resets
abaim()
{
   sleep 4000;
   signal 8;
}

RestoreAfterDelay()
{
   sleep restore_delay;
   turn turret to y-axis 0 speed <35>;
   turn sleeves to x-axis 0 speed <15>;
   turn turretl to y-axis 0 speed <45>;
   turn sleevel to x-axis 0 speed <25>;
}

//aiming and positioning of "turret(s)"
AimWeapon1(heading, pitch)
{
   signal 2;
   set-signal-mask 2;
   turn turret to y-axis heading speed <70>;
   turn sleeves to x-axis 0 - pitch speed <40>;
   wait-for-turn turret around y-axis;
   wait-for-turn sleeves around x-axis;
   start-script RestoreAfterDelay();
   return (1);
}

AimWeapon3(heading, pitch)
{
   signal 8;
   set-signal-mask 8;
   start-script abaim();
   return (1);
}

AimWeapon2(heading,pitch)
   {
   signal 4;
   set-signal-mask 4;
   turn turretl to y-axis heading speed <90>;
   turn barrell to x-axis (0-pitch) speed <50>;
   wait-for-turn turretl around y-axis;
   wait-for-turn barrell around x-axis;
   start-script RestoreAfterDelay();
   return(1);
   }

//firing anim
FireWeapon1()
{
   if( fire == 0 )
   {
      move barrel1 to z-axis [-2.4] speed [500];
      wait-for-move barrel1 along z-axis;
      move barrel1 to z-axis [0] speed [3.0];
      show flarea1;
      sleep 150;
      hide flarea1;
   }
   if( fire == 1 )
   {
      move barrel2 to z-axis [-2.4] speed [500];
      wait-for-move barrel2 along z-axis;
      move barrel2 to z-axis [0] speed [3.0];
      show flarea2;
      sleep 150;
      hide flarea2;
   }
   fire = !fire;
}

FireWeapon2()
{
   show flarel;
   move barrell to z-axis [-2.4] speed [500];
   sleep 150;
   hide flarel;
   wait-for-move barrell along z-axis;
   move barrell to z-axis [0] speed [3.0];
}

FireWeapon3()
{
   return (1);
}

   
Killed(severity, corpsetype)
{
   hide flarea1;
   hide flarea2;
   hide flareb;
   hide flarel;
   if( severity <= 25 )
   {
      corpsetype = 1;
      explode barrel1 type BITMAPONLY | BITMAP1;
      explode barrel2 type BITMAPONLY | BITMAP2;
      explode base type BITMAPONLY | BITMAP3;
      explode flarea1 type BITMAPONLY | BITMAP4;
      explode flarea2 type BITMAPONLY | BITMAP5;
      explode flareb type BITMAPONLY | BITMAP5;
      explode sleeves type BITMAPONLY | BITMAP5;
      explode turret type BITMAPONLY | BITMAP1;
      explode wake1 type BITMAPONLY | BITMAP3;
      explode wake2 type BITMAPONLY | BITMAP4;
      return (0);
   }
   if( severity <= 50 )
   {
      corpsetype = 2;
      explode barrel1 type FALL | BITMAP1;
      explode barrel2 type FALL | BITMAP2;
      explode base type BITMAPONLY | BITMAP3;
      explode flarea1 type FALL | BITMAP4;
      explode flarea2 type FALL | BITMAP5;
      explode flareb type FALL | BITMAP5;
      explode sleeves type BITMAPONLY | BITMAP5;
      explode turret type BITMAPONLY | BITMAP1;
      explode wake1 type FALL | BITMAP3;
      explode wake2 type FALL | BITMAP4;
      return (0);
   }
   if( severity <= 99 )
   {
      corpsetype = 3;
      explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1;
      explode barrel2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
      explode base type BITMAPONLY | BITMAP3;
      explode flarea1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
      explode flarea2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP5;
      explode flareb type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP5;
      explode sleeves type BITMAPONLY | BITMAP5;
      explode turret type BITMAPONLY | BITMAP1;
      explode wake1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
      explode wake2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
      return (0);
   }
   corpsetype = 3;
   explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1;
   explode barrel2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
   explode base type BITMAPONLY | BITMAP3;
   explode flarea1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
   explode flarea2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP5;
   explode flareb type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP5;
   explode sleeves type BITMAPONLY | BITMAP5;
   explode turret type BITMAPONLY | BITMAP1;
   explode wake1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
   explode wake2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
}

Posted: 09 Apr 2007, 14:17
by FLOZi
Spring does use SetMaxReloadTime

Posted: 09 Apr 2007, 14:53
by smoth
really? what does it use it for? I have stripped it out of my mod for the most part.

Posted: 09 Apr 2007, 17:54
by FLOZi
Same thing as OTA... allows you to set restore_delay relative to the longest reload time of any weapon on the unit - prevents turrets starting to restore to position before firing the next round.

Posted: 09 Apr 2007, 18:24
by KDR_11k
Spring calls AimWeapon so often you can use a delay of a second or so.

Posted: 09 Apr 2007, 22:40
by zwzsg
You could remove the abaim() and the TargetCleared(time) (and the starting of abaim()), in your script they're pointless: signal 8 would kill AimTertiary, but if abaim() gets past 4sec or if TargetCleared is called, it means AimTertiary is already on its way to destruction.

AimPrimary and AimSecondary start the same RestoreAfterDelay(). I wouldn't have dared to do that, and would have given each its own "Restore" function. In TA having two instances of the same function running at once leads to disasters. Maybe Spring support its, but would still be cleaner to have two independant "Restore", one for Primary one for secondary.

Otherwise the script seems correct.

I hope you won't take offence if I ask, but you did compiled your BOS into a COB, right?

Posted: 10 Apr 2007, 05:37
by lgustavomp
Thanks guys.

smoth and zwzsg. I'm working on those things that you pointed. And yes.. i compiled.. cause if i've not, the Weapon1 would work i think (i have not changed anything on it). And it isn't. Only the Weapon3 (depthcharge) is working.

Posted: 10 Apr 2007, 06:41
by lgustavomp
grr.. not worked. Damn guys, can't be possible. I lost hours and hours searching for stuff here.. on smoth forum.. changing litter things here and there... did what you guys told me... and absolutely NOTHING diferent happens. Everytime is the same: i order the unit to attack and, it fires only the depthcharge (weapon3). The turrets remain stactic.

Someone has a BOS of an unit with 3 weapons that can share? (a naval unit would be better to understand better the 'signal' thing)

here's the updated BOS

Code: Select all

#define TA			// This is a TA script

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

piece  flarea1, flarea2, flareb, base, turret, sleeves, wake1, wake2, barrel1,
		barrel2,fp11, fp12, fp31, turretl, sleevel, barrell, flarel;

static-var  fire, restore_delay;


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 flarea1;
	hide flarea2;
	hide flareb;
	hide flarel;
	fire = 0;
	restore_delay = 3000;
	start-script SmokeUnit();
}

//anim resets 
RestoreAfterDelay1() 
{ 
   sleep restore_delay; 
   turn turret to y-axis 0 speed <35>; 
   turn sleeves to x-axis 0 speed <15>; 
} 

RestoreAfterDelay2() 
{ 
   sleep restore_delay; 
   turn turretl to y-axis 0 speed <45>; 
   turn sleevel to x-axis 0 speed <25>; 
} 

RestoreAfterDelay3() 
{ 
   sleep restore_delay; 
} 

//moving
StartMoving()
{
	signal 16;
	set-signal-mask 16;
	while( TRUE )
	{
		emit-sfx 2 from wake1;
		emit-sfx 4 from wake2;
		sleep 300;
	}
}

StopMoving()
{
	signal 16;
}

//aim points
AimFromWeapon1(piecenum) 
	{   
	piecenum = turret;   
	} 

AimFromWeapon2(piecenum) 
	{   
	piecenum= turretl;   
	} 

AimFromWeapon3(piecenum) 
	{   
	piecenum = fp31;
	} 

//aiming and positioning of "turret(s)" 
AimWeapon1(heading, pitch) 
	{ 
   signal 2; 
   set-signal-mask 2; 
   turn turret to y-axis heading speed <70>; 
   turn sleeves to x-axis (0 - pitch) speed <40>; 
   wait-for-turn turret around y-axis; 
   wait-for-turn sleeves around x-axis; 
   start-script RestoreAfterDelay1(); 
   return (1); 
	} 

AimWeapon2(heading,pitch) 
   { 
   signal 4; 
   set-signal-mask 4; 
   turn turretl to y-axis heading speed <90>; 
   turn sleevel to x-axis (0 - pitch) speed <50>; 
   wait-for-turn turretl around y-axis; 
   wait-for-turn sleevel around x-axis; 
   start-script RestoreAfterDelay2(); 
   return(1); 
   } 

AimWeapon3(heading, pitch) 
	{ 
	signal 8; 
	set-signal-mask 8; 
	start-script RestoreAfterDelay3(); 
	return (1); 
	} 

//where the projectile emits from 
QueryWeapon1(piecenum) 
{ 
   if( fire == 0 ) 
   {  piecenum = flarea1;   } 

   if( fire == 1 ) 
   {  piecenum = flarea2;   } 
} 

QueryWeapon2(piecenum) 
{   piecenum=flarel;   } 

QueryWeapon3(piecenum) 
{   piecenum = fp31;   } 

//firing anim 
FireWeapon1() 
{ 
   if( fire == 0 ) 
   { 
      move barrel1 to z-axis [-2.4] speed [500]; 
      wait-for-move barrel1 along z-axis; 
      move barrel1 to z-axis [0] speed [3.0]; 
      show flarea1; 
      sleep 150; 
      hide flarea1; 
   } 
   if( fire == 1 ) 
   { 
      move barrel2 to z-axis [-2.4] speed [500]; 
      wait-for-move barrel2 along z-axis; 
      move barrel2 to z-axis [0] speed [3.0]; 
      show flarea2; 
      sleep 150; 
      hide flarea2; 
   } 
   fire = !fire; 
} 

FireWeapon2() 
{ 
   show flarel; 
   move barrell to z-axis [-2.4] speed [500]; 
   sleep 150; 
   hide flarel; 
   wait-for-move barrell along z-axis; 
   move barrell to z-axis [0] speed [3.0]; 
} 

FireWeapon3() 
{ 
   return (1); 
} 

Killed(severity, corpsetype)
{
	hide flarea1;
	hide flarea2;
	hide flareb;
	hide flarel;
	if( severity <= 25 )
	{
		corpsetype = 1;
		explode barrel1 type BITMAPONLY | BITMAP1;
		explode barrel2 type BITMAPONLY | BITMAP2;
		explode base type BITMAPONLY | BITMAP3;
		explode flarea1 type BITMAPONLY | BITMAP4;
		explode flarea2 type BITMAPONLY | BITMAP5;
		explode flareb type BITMAPONLY | BITMAP5;
		explode sleeves type BITMAPONLY | BITMAP5;
		explode turret type BITMAPONLY | BITMAP1;
		explode wake1 type BITMAPONLY | BITMAP3;
		explode wake2 type BITMAPONLY | BITMAP4;
		return (0);
	}
	if( severity <= 50 )
	{
		corpsetype = 2;
		explode barrel1 type FALL | BITMAP1;
		explode barrel2 type FALL | BITMAP2;
		explode base type BITMAPONLY | BITMAP3;
		explode flarea1 type FALL | BITMAP4;
		explode flarea2 type FALL | BITMAP5;
		explode flareb type FALL | BITMAP5;
		explode sleeves type BITMAPONLY | BITMAP5;
		explode turret type BITMAPONLY | BITMAP1;
		explode wake1 type FALL | BITMAP3;
		explode wake2 type FALL | BITMAP4;
		return (0);
	}
	if( severity <= 99 )
	{
		corpsetype = 3;
		explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1;
		explode barrel2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
		explode base type BITMAPONLY | BITMAP3;
		explode flarea1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
		explode flarea2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP5;
		explode flareb type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP5;
		explode sleeves type BITMAPONLY | BITMAP5;
		explode turret type BITMAPONLY | BITMAP1;
		explode wake1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
		explode wake2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
		return (0);
	}
	corpsetype = 3;
	explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1;
	explode barrel2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
	explode base type BITMAPONLY | BITMAP3;
	explode flarea1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
	explode flarea2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP5;
	explode flareb type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP5;
	explode sleeves type BITMAPONLY | BITMAP5;
	explode turret type BITMAPONLY | BITMAP1;
	explode wake1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
	explode wake2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP4;
}

Posted: 10 Apr 2007, 07:49
by KDR_11k
What happens when you go into FPS mode?

Posted: 10 Apr 2007, 08:20
by lgustavomp
The turrets reamain stactic and only the depthcharge is fired

Posted: 10 Apr 2007, 08:41
by Archangel of Death
hmm... have you checked the values on your cob constants lately? There are a few normal things you can do that tend to erase those from your system's registry, like opening up more than one scriptor window. (I am assuming you are using scriptor here). They should definitaly not be 0, Angular should be 182 and Linear should be 163840.

Posted: 10 Apr 2007, 21:47
by VonGratz
Try it............

VonGratz :wink:
#define TA // This is a TA script

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

piece flarea1, flarea2, flareb, base, turret, sleeves, wake1, wake2, barrel1,
barrel2,fp11, fp12, fp31, turretl, sleevel, barrell, flarel;

static-var fire, restore_delay;
// Signal definitions

#define SIGNAL1 2
#define SIGNAL2 4
#define SIGNAL3 8
#define SIGNAL4 16



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 flarea1;
hide flarea2;
hide flareb;
hide flarel;
fire = 0;
restore_delay = 3000;
start-script SmokeUnit();
}

//anim resets
RestoreAfterDelay1()
{
sleep restore_delay;
turn turret to y-axis 0 speed <35>;
turn sleeves to x-axis 0 speed <15>;
}

RestoreAfterDelay2()
{
sleep restore_delay;
turn turretl to y-axis 0 speed <45>;
turn sleevel to x-axis 0 speed <25>;
}

RestoreAfterDelay3()
{
sleep restore_delay;
}

//moving
StartMoving()
{
SIGNAL4;
set-signal-mask SIGNAL4;
while( TRUE )
{
emit-sfx 2 from wake1;
emit-sfx 4 from wake2;
sleep 300;
}
}

StopMoving()
{
SIGNAL4;
}

//aim points
AimFromWeapon1(piecenum)
{
piecenum = turret;
}

AimFromWeapon2(piecenum)
{
piecenum= turretl;
}

AimFromWeapon3(piecenum)
{
piecenum = fp31;
}

//aiming and positioning of "turret(s)"
AimWeapon1(heading, pitch)
{
SIGNAL1;
set-signal-mask SIGNAL1;
turn turret to y-axis heading speed <70>;
turn sleeves to x-axis (0 - pitch) speed <40>;
wait-for-turn turret around y-axis;
wait-for-turn sleeves around x-axis;
start-script RestoreAfterDelay1();
return (1);
}

AimWeapon2(heading,pitch)
{
SIGNAL2;
set-signal-mask SIGNAL2;
turn turretl to y-axis heading speed <90>;
turn sleevel to x-axis (0 - pitch) speed <50>;
wait-for-turn turretl around y-axis;
wait-for-turn sleevel around x-axis;
start-script RestoreAfterDelay2();
return(1);
}

AimWeapon3(heading, pitch)
{
SIGNAL3;
set-signal-mask SIGNAL3;
start-script RestoreAfterDelay3();
return (1);
}
//* BLAH BLAH BLAH *\\
:lol: Another Brazilian?

Posted: 10 Apr 2007, 22:23
by lgustavomp
Thank you everyone.
Archangel of Death wrote:They should definitaly not be 0, Angular should be 182 and Linear should be 163840.
That is exaclty what was happening. Both values was 0. I'ts working fine now.

:mrgreen: