the guns. they won't fire . ..

the guns. they won't fire . ..

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

User avatar
MrSpontaneous
Posts: 242
Joined: 09 Sep 2005, 22:39

the guns. they won't fire . ..

Post by MrSpontaneous »

alrighty, I have a unit, with 5 weapons, I am using AimWeapon1 etc. I have custom weapons for them (displayed below). the unit will not fire or aim its weapons and I am unsure of why. Help is appriciated, thanks

Skript

Code: Select all

#define TA			// This is a TA script

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

piece base, pad, nano, swivle, mturret, maingunpoint, smbase1, pivot1, smgun1, fp1;
piece smbase2, pivot2, smgun2, fp2,smbase3, pivot3, smgun3, fp3,smbase4, pivot4, smgun4, fp4;

static-var  Static_Var_1, statechg_DesiredState, statechg_StateChanging;
// Signal definitions
#define SIG_ACTIVATE  2			
#define SIG_AIM1  2
#define SIG_AIM2  4
#define SIG_AIM3  6
#define SIG_AIM4  8
#define SIG_AIM5  10
#define SIG_RESTORE1  1
#define SIG_RESTORE2  3
#define SIG_RESTORE3  5
#define SIG_RESTORE4  7
#define SIG_RESTORE5  9




OpenYard()
{
	set YARD_OPEN to 1;
	while( !get YARD_OPEN )
	{
		set BUGGER_OFF to 1;
		sleep 1500;
		set YARD_OPEN to 1;
	}
	set BUGGER_OFF to 0;
	return (0);
}

CloseYard()
{
	set YARD_OPEN to 0;
	while( get YARD_OPEN )
	{
		set BUGGER_OFF to 1;
		sleep 10000;
		set YARD_OPEN to 0;
	}
	set BUGGER_OFF to 0;
	return (0);
}

activatescr()
{
	if( TRUE )
	{
		sleep 1820;
	}
	return (0);
}

deactivatescr()
{
	if( TRUE )
	{
		sleep 1820;
	} 
	return (0);
}

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;
	}
	return (0);
}

Go()
{
	call-script activatescr();
	call-script OpenYard();
	set INBUILDSTANCE to 1;
	return (0);
}

Stop() 
{
	set INBUILDSTANCE to 0;
	call-script CloseYard();
	call-script deactivatescr();
	return (0);
}

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

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;
	return (0);
} 


Create()
{
	Static_Var_1 = 0;
	call-script InitState();
	start-script SmokeUnit();
}

QueryNanoPiece(piecenum)
{
	piecenum = nano;
	return (0);
}


Activate()
{
	signal SIG_ACTIVATE;
	start-script RequestState(0);
	return (0);
}

Deactivate()
{
	signal SIG_ACTIVATE;
	set-signal-mask SIG_ACTIVATE;
	set-signal-mask 0;
	start-script RequestState(1);
	return (0);
}

StartBuilding()
{
	return (0);
}

StopBuilding()
{
	return (0);
}

QueryBuildInfo(piecenum)
{
	piecenum = pad;
	return (0);
}

SweetSpot(piecenum)
{
	piecenum = base;
	return (0);
}

RestoreAfterDelay1()
	{
	signal SIG_RESTORE1;
   	set-signal-mask SIG_RESTORE1;
	sleep 500;
	turn pivot1 to y-axis <0.0> speed <200.0>;
	turn pivot1 to x-axis <0.0> speed <200.0>;
	return 0;
}

RestoreAfterDelay2()
	{
	signal SIG_RESTORE2;
   	set-signal-mask SIG_RESTORE2;
	sleep 500;
	turn pivot2 to y-axis <0.0> speed <200.0>;
	turn pivot2 to x-axis <0.0> speed <200.0>;
	return 0;
}



RestoreAfterDelay3()
	{
	signal SIG_RESTORE3;
   	set-signal-mask SIG_RESTORE3;
	sleep 500;
	turn pivot3 to y-axis <0.0> speed <200.0>;
	turn pivot3 to x-axis <0.0> speed <200.0>;
	return 0;
}

RestoreAfterDelay4()
	{
	signal SIG_RESTORE4;
   	set-signal-mask SIG_RESTORE4;
	sleep 500;
	turn pivot4 to y-axis <0.0> speed <200.0>;
	turn pivot4 to x-axis <0.0> speed <200.0>;
	return 0;
}

RestoreAfterDelay5()
	{
	signal SIG_RESTORE5;
   	set-signal-mask SIG_RESTORE5;
	sleep 700;
	turn swivle to y-axis <0.0> speed <100.0>;
	return 0;
}



AimWeapon1(heading,pitch)
{
	signal SIG_AIM1;
    set-signal-mask SIG_AIM1;
    turn pivot1 to y-axis heading speed <200>;
    turn pivot1 to x-axis (0-pitch) speed <200>;
    wait-for-turn pivot1 around y-axis;
    wait-for-turn pivot1 around x-axis;
    start-script RestoreAfterDelay1();
    return(TRUE);
 }
 
 AimWeapon2(heading,pitch)
{
	signal SIG_AIM2;
    set-signal-mask SIG_AIM2;
    turn pivot2 to y-axis heading speed <200>;
    turn pivot2 to x-axis (0-pitch) speed <200>;
    wait-for-turn pivot2 around y-axis;
    wait-for-turn pivot2 around x-axis;
    start-script RestoreAfterDelay2();
    return(TRUE);
 }

AimWeapon3(heading,pitch)
{
	signal SIG_AIM3;
    set-signal-mask SIG_AIM3;
    turn pivot3 to y-axis heading speed <200>;
    turn pivot3 to x-axis (0-pitch) speed <200>;
    wait-for-turn pivot3 around y-axis;
    wait-for-turn pivot3 around x-axis;
    start-script RestoreAfterDelay3();
    return(TRUE);
 }

AimWeapon4(heading,pitch)
{
	signal SIG_AIM4;
    set-signal-mask SIG_AIM4;
    turn pivot4 to y-axis heading speed <200>;
    turn pivot4 to x-axis (0-pitch) speed <200>;
    wait-for-turn pivot4 around y-axis;
    wait-for-turn pivot4 around x-axis;
    start-script RestoreAfterDelay4();
    return(TRUE);
 }


AimWeapon5(heading,pitch)
{
    signal SIG_AIM5;
    set-signal-mask SIG_AIM5;
    turn swivle to y-axis heading speed <100>;
    wait-for-turn swivle around y-axis;
    start-script RestoreAfterDelay5();
    return(TRUE);
}                    

AimFromWeapon1(piecenum)
{
 piecenum = pivot1;
 return 0;
}

AimFromWeapon2(piecenum)
{
 piecenum = pivot2;
 return 0;
}

AimFromWeapon3(piecenum)
{
 piecenum = pivot3;
 return 0;
}

AimFromWeapon4(piecenum)
{
 piecenum=pivot4;
 return 0;
}


AimFromWeapon5(piecenum)
{
 piecenum=swivle;
 return 0;
}

QuaryWeapon1(piecenum)
{
 piecenum=fp1;
 return 0;
}

QuaryWeapon2(piecenum)
{
 piecenum=fp2;
 return 0;
}

QuaryWeapon3(piecenum)
{
 piecenum=fp3;
 return 0;
}

QuaryWeapon4(piecenum)
{
 piecenum=fp4;
 return 0;
}


QuaryWeapon5(piecenum)
{
 piecenum=maingunpoint;
 return 0;
}


FireWeapon1(piecenum)
{
 return 0;
}

FireWeapon2(piecenum)
{
 return 0;
}

FireWeapon3(piecenum)
{
 return 0;
}

FireWeapon4(piecenum)
{
 return 0;
}

FireWeapon5(piecenum)
{
 return 0;
}


Killed(severity, corpsetype)
{
	if( severity <= 25 )
	{
		corpsetype = 1;
		explode base type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
		return (0);
	}
	if( severity <= 50 )
	{
		corpsetype = 2;
		explode base type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
		return (0);
	}
	if( severity <= 99 )
	{
		corpsetype = 3;
		explode base type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
		return (0);
	}
	corpsetype = 3;
		explode base type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
	return (0);
}



and my two weapons in their TDF file

Code: Select all

[DSHATTER]
	{
      ID = 30;
	name=Shatter Gun;
	rendertype=1;
	lineofsight=1;
      turret = 1;
	Impulsefactor = -5;
	reloadtime = .5;
      weapontimer = .5;
	wobble = 5;
	range = 300;
	model = DSHATTER;
	weaponvelocity = 150;
	areaofeffect=60;
		[DAMAGE]
		{
		 defualt = 20;
		}

	}

[DIMPLOSION]
	{
	ID = 31;
	name=Implosion round;
	rendertype=1;
	weapontimer = 2;
	Turret = 1;
	impulsefactor = -10;
	balistic = 1;
	AreaOfEffect = 50
	Range =1000;
	ReloadTime = 1.5;
	Wobble = 10;
	Model = DIMPLOSION.s3o;
	weaponvelocity = 90;
		[DAMAGE]
		{
		defualt = 100;
		}

	}

thanks
User avatar
Nemo
Spring 1944 Developer
Posts: 1376
Joined: 30 Jan 2005, 19:44

Post by Nemo »

default is spelled wrong, and there shouldn't be a space between the tag, the =, and the value.
User avatar
MrSpontaneous
Posts: 242
Joined: 09 Sep 2005, 22:39

Post by MrSpontaneous »

well I changed those, still no go :S
User avatar
Nemo
Spring 1944 Developer
Posts: 1376
Joined: 30 Jan 2005, 19:44

Post by Nemo »

did you spell the name of the weapon correctly in the unit file? When you go ingame, take control of the unit FPS style (C) and note the number of weapons. If you have the right number, they're likely all stuck in 'aiming' mode.

I'm not going to check the script, because I'm terrible at scripting, but try giving it a high tolerance value in the tdf.
User avatar
MrSpontaneous
Posts: 242
Joined: 09 Sep 2005, 22:39

Post by MrSpontaneous »

what tag do I need for fps mode, because I tried to go into fps before with my unit and the game quit :S
User avatar
Nemo
Spring 1944 Developer
Posts: 1376
Joined: 30 Jan 2005, 19:44

Post by Nemo »

heh, you don't need any tag. that's a good sign that something is le b0rked with your weapons.

I'd suggest finding the simplest weapon you can in AA or XTA and using that as a template for all your future weapons. Just change the values and tags to suit you. That way, you know that you at least started with a working weapon, and so can isolate where things went wrong fairly easily.

Writing fbis and tdfs from scratch is just asking for endless debuggery.
User avatar
MrSpontaneous
Posts: 242
Joined: 09 Sep 2005, 22:39

Post by MrSpontaneous »

got it to fire in fps mode, looks like its stuck aiming (and I think I maybe missing 1 of the weapons. . .) plus I forgot to invert the UV for one of my weapons :P

edit: I am still unsure of what needs changing in the script, so any one know? :P
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

#define SIG_ACTIVATE 2
#define SIG_AIM1 2
#define SIG_AIM2 4
#define SIG_AIM3 6
#define SIG_AIM4 8
#define SIG_AIM5 10
#define SIG_RESTORE1 1
#define SIG_RESTORE2 3
#define SIG_RESTORE3 5
#define SIG_RESTORE4 7
#define SIG_RESTORE5 9
Each signal must be a power of 2. And don't reuse signals numbers on other signals.
Use:
#define SIG_AIM1 2
#define SIG_AIM2 4
#define SIG_AIM3 8
#define SIG_AIM4 16
#define SIG_AIM5 32
#define SIG_ACTIVATE 64
No need to have signal things on the restore. Killing a function kills all the function it launched (more accuratly the child function inherit all the signal worn by their father at the moment of birth), so the signal SIG_AIM5; of AimWeapon5(...) will also kill any previous RestoreAfterDelay5().

You don't really need all those return (0); Scriptor will add them by itself (save when there's nothing between { and } ). Only the return(1) in the Aiming functions are important to keep.

Also, test your custom weapon on a working script, and your custom script with working weapons, to know which is wrong.
User avatar
MrSpontaneous
Posts: 242
Joined: 09 Sep 2005, 22:39

Post by MrSpontaneous »

ok I will try that, is there any were on the web that has a detailed list of what all the scripting functions do? As well as all the signals and the like. its like trying to code in assembler when you don't have all/any of the BIOS, and are missing some of the basic commands like PUSH :roll: .

thanks
User avatar
MrSpontaneous
Posts: 242
Joined: 09 Sep 2005, 22:39

Post by MrSpontaneous »

well the DSHATTER is fine, except its behaving like a balistic weapon when I put lineofsight into the file. . . :x

the DIMPLOSION has some problems which I am fixing. . .

DIMPLOSION works fine now. . .

Still unsure of what needs fixing in the script
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Post by Caydr »

Are you sure it's the script? I know dick-all about scripting, but if you post the FBI I might be able to see something wrong. Bad syntax (always wanted to use that word!) on the aiming cones and whatnot would have the effect you describe.
User avatar
MrSpontaneous
Posts: 242
Joined: 09 Sep 2005, 22:39

Post by MrSpontaneous »

I tested the weapons with another unit (with a working script) and they worked fine, (except that the DSHATTER fires in balastic rather than los)

here are the weapons fbi files

Code: Select all

[DSHATTER]
	{
      ID=30;
	name=Shatter Gun;
	rendertype=1;
	lineofsight=1;
      turret=1;
	Impulsefactor=-5;
	reloadtime=.5;
      weapontimer=.5;
	wobble=5;
	range=300;
	model=DSHATTER.s3o;
	weaponvelocity=200;
	areaofeffect=60;
	
	firestarter=0;

	explosiongaf=fx;
	explosionart=explode3;

	waterexplosiongaf=fx;
	waterexplosionart=h2o;

	lavaexplosiongaf=fx;
	lavaexplosionart=lavasplash;
	impulsefactor=0;




		[DAMAGE]
		{
		 default=20;
		}

	}

[DIMPLOSION]
	{
	ID=31;
	name=Implosion round;
	rendertype=1;
	weapontimer=2;
	Turret=1;
	impulsefactor=-10;
	balistic=1;
	AreaOfEffect=150;
	Range=1000;
	ReloadTime=1.5;
	Wobble=10;
	Model=DIMPLOSION.s3o;
	weaponvelocity=600;

	firestarter=0;
	explosiongaf=fx;
	explosionart=explode3;

	waterexplosiongaf=fx;
	waterexplosionart=h2o;

	lavaexplosiongaf=fx;
	lavaexplosionart=lavasplash;
	impulsefactor=0;



		[DAMAGE]
		{
		default=100;
		}

	}
Sean Mirrsen
Posts: 578
Joined: 19 Aug 2004, 17:38

Post by Sean Mirrsen »

You'd have to turn gravityaffect to off to have a straight-flying weapon. I don't know if there's a tag for that though...

Caydr wanted to see the Unit's FBI, not the weapons' TDFs. :\

A note on your weapons - wobble is only supposed to work on selfpropelled weapons, no?
User avatar
MrSpontaneous
Posts: 242
Joined: 09 Sep 2005, 22:39

Post by MrSpontaneous »

woops here is the FBI. and if there are no non gravity effected weapons. . .no there must be, or atleast a work around because of the lord gun in nano blobs.

here is the FBI

Code: Select all

[UNITINFO]
	{
	//Internal settings
	unitname=DOOMFD;
	version=1;
	side=DOOM;
	objectname=DOOMFD.S3O;
	TEDClass=PLANT;
	category=DOOM ENERGY NOWEAPON NOTAIR NOTSUB NOTSHIP LEVEL1 NOTLAND ALL;	

	//unit limitations and properties
	ActiveWhenBuilt=1;
	WorkerTime=50;
	BuildTime=600;
	Corpse=BOREMC_DEAD.S30;
	SoundCategory=ARM_GEO;	
	SightDistance=250;
	radardistance=600;
	MaxDamage=800;
	name=Factory Defense;
	description=:Produces and Defends units;
	
	//energy and metal related
	BuildCostEnergy=50;
	BuildCostMetal=400;
	

	//Pathfinding and related
	FootPrintX=7;
	FootPrintZ=7;
	MaxWaterDepth=0;
	MovementClass=structure;
	YardMap=yygggyy yyyyyyy gyyyyyg gyyyyyg gyyyyyg yyyyyyy yygggyy;
	MaxSlope=40;	
	mobilestandorders=1;
	standingmoveorder=1;
	firestandorders=1;
	standingfireorder=2;
	ovradjust=1;
	smoothanim=1;

	//Abilities
	Builder=1;
	CanMove=1;
	CanPatrol=1;
	CanStop=1;
	canattack=1;
	autoheal=5;

	//Weapons and related
	weapon1=DSHATTER;
        WeaponMainDir1=0 0 -1;
   	maxangledif1=180;

	weapon2=DSHATTER;
	weaponMainDir2=0 0 1;
	maxangleif2=180;

	weapon3=DSHATTER;
	weaponMainDir3=-1 0 0;
	maxangleif3=180;
	
	weapon4=DSHATTER;
	weaponMainDir3=1 0 0;
	maxangleif4=180;
	
	weapon5=DIMPLOSION;
	OnlyTargetCategory5=NOTAIR;	
	}
EDIT: I see the problem, my weapon main dir is set to 3 for one of the weapons DOH! (hope that fixes it. . .)

should that be bad target category for my last weapon?
Sean Mirrsen
Posts: 578
Joined: 19 Aug 2004, 17:38

Post by Sean Mirrsen »

GAAH!!! *bangs head against the.. let's say couch. It's soft. :P*

When you are typing important things like scripts that are actually supposed to work, be sure to check the vocabulary. Or at least the rest of the script. "Query" has an "e" in it, not an "a". You've got it right in QueryBuildInfo and QueryNanoPiece, but all the weapon ones are "Quary".

If you fixed that and your weapons are still not firing, then I'm lost.

Also, check the fbi. MaxAngleDif's have their "d" missing in most instances, "movementclass=structure" is probably the most useless line I've ever seen (if it's a STRUCTURE, why should it MOVE?), ActiveWhenBuilt should be ActivateWhenBuilt, but shouldn't be present for a factory, and in all the fbi is very messy(your unit is probably not related to energy, it probably has a weapon, and it's probably a land installation, unlike your category list says), not to mention the thing is overpowered like hell. All in all, nothing critical, except for the script errors. :)
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

MrSpontaneous wrote:ok I will try that, is there any were on the web that has a detailed list of what all the scripting functions do? As well as all the signals and the like. its like trying to code in assembler when you don't have all/any of the BIOS, and are missing some of the basic commands like PUSH :roll: .
I use tadesign.zip, the most complete reference guide, listing nearly all bos function and commands, and with few errors.
User avatar
MrSpontaneous
Posts: 242
Joined: 09 Sep 2005, 22:39

Post by MrSpontaneous »

I have that zip :P and I have been using it.

As for being over powerd, this unit is not for TA. The FBI was originaly copied from a geo plant when I had less than a clue as to what I was doing and used it for a differnt unit. I then coppied that units FBI because they were similar in nature to make this one.

That being said, my spelling does suck and thanks for spotting those errors

I fixed the quary errors and cleaned up the FBI a bit. The unit no longer is spasming when I try to manualy aim it, but still will not fire when commanded to :S
Sean Mirrsen
Posts: 578
Joined: 19 Aug 2004, 17:38

Post by Sean Mirrsen »

RRiiight.. can you post what you have of the unit? If that didn't help something more tricky can be amiss, like all those return 0's in the script (actually, ONE return 0 is mandatory - in the Fire script. Otherwise your unit will explode every time it fires. Yes, _every_ time.;)), or some misplaced aimpiece.
User avatar
MrSpontaneous
Posts: 242
Joined: 09 Sep 2005, 22:39

Post by MrSpontaneous »

well here is the current script.

Code: Select all

#define TA			// This is a TA script

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

piece base, pad, nano, swivle, mturret, maingunpoint, smbase1, pivot1, smgun1, fp1;
piece smbase2, pivot2, smgun2, fp2,smbase3, pivot3, smgun3, fp3,smbase4, pivot4, smgun4, fp4;

static-var  Static_Var_1, statechg_DesiredState, statechg_StateChanging;
// Signal definitions
#define SIG_ACTIVATE  2			
#define SIG_AIM1  4
#define SIG_AIM2  8
#define SIG_AIM3  16
#define SIG_AIM4  32
#define SIG_AIM5  64





OpenYard()
{
	set YARD_OPEN to 1;
	while( !get YARD_OPEN )
	{
		set BUGGER_OFF to 1;
		sleep 1500;
		set YARD_OPEN to 1;
	}
	set BUGGER_OFF to 0;
	return (0);
}

CloseYard()
{
	set YARD_OPEN to 0;
	while( get YARD_OPEN )
	{
		set BUGGER_OFF to 1;
		sleep 10000;
		set YARD_OPEN to 0;
	}
	set BUGGER_OFF to 0;
	return (0);
}

activatescr()
{
	if( TRUE )
	{
		sleep 1820;
	}
	return (0);
}

deactivatescr()
{
	if( TRUE )
	{
		sleep 1820;
	} 
	return (0);
}

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;
	}
	return (0);
}

Go()
{
	call-script activatescr();
	call-script OpenYard();
	set INBUILDSTANCE to 1;
	return (0);
}

Stop() 
{
	set INBUILDSTANCE to 0;
	call-script CloseYard();
	call-script deactivatescr();
	return (0);
}

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

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;
	return (0);
} 


Create()
{
	Static_Var_1 = 0;
	call-script InitState();
	start-script SmokeUnit();
}

QueryNanoPiece(piecenum)
{
	piecenum = nano;
	return (0);
}


Activate()
{
	signal SIG_ACTIVATE;
	start-script RequestState(0);
	return (0);
}

Deactivate()
{
	signal SIG_ACTIVATE;
	set-signal-mask SIG_ACTIVATE;
	set-signal-mask 0;
	start-script RequestState(1);
	return (0);
}

StartBuilding()
{
	return (0);
}

StopBuilding()
{
	return (0);
}

QueryBuildInfo(piecenum)
{
	piecenum = pad;
	return (0);
}

SweetSpot(piecenum)
{
	piecenum = base;
	return (0);
}

RestoreAfterDelay1()
	{
	sleep 500;
	turn pivot1 to y-axis <0.0> speed <200.0>;
	turn pivot1 to x-axis <0.0> speed <200.0>;
}

RestoreAfterDelay2()
	{
	sleep 500;
	turn pivot2 to y-axis <0.0> speed <200.0>;
	turn pivot2 to x-axis <0.0> speed <200.0>;
}



RestoreAfterDelay3()
	{
	sleep 500;
	turn pivot3 to y-axis <0.0> speed <200.0>;
	turn pivot3 to x-axis <0.0> speed <200.0>;
}

RestoreAfterDelay4()
	{
	sleep 500;
	turn pivot4 to y-axis <0.0> speed <200.0>;
	turn pivot4 to x-axis <0.0> speed <200.0>;
}

RestoreAfterDelay5()
	{
	sleep 700;
	turn swivle to y-axis <0.0> speed <100.0>;
}



AimWeapon1(heading,pitch)
{
	signal SIG_AIM1;
    set-signal-mask SIG_AIM1;
    turn pivot1 to y-axis heading speed <200>;
    turn pivot1 to x-axis (0-pitch) speed <200>;
    wait-for-turn pivot1 around y-axis;
    wait-for-turn pivot1 around x-axis;
    start-script RestoreAfterDelay1();
    return(TRUE);
 }
 
 AimWeapon2(heading,pitch)
{
	signal SIG_AIM2;
    set-signal-mask SIG_AIM2;
    turn pivot2 to y-axis heading speed <200>;
    turn pivot2 to x-axis (0-pitch) speed <200>;
    wait-for-turn pivot2 around y-axis;
    wait-for-turn pivot2 around x-axis;
    start-script RestoreAfterDelay2();
    return(TRUE);
 }

AimWeapon3(heading,pitch)
{
	signal SIG_AIM3;
    set-signal-mask SIG_AIM3;
    turn pivot3 to y-axis heading speed <200>;
    turn pivot3 to x-axis (0-pitch) speed <200>;
    wait-for-turn pivot3 around y-axis;
    wait-for-turn pivot3 around x-axis;
    start-script RestoreAfterDelay3();
    return(TRUE);
 }

AimWeapon4(heading,pitch)
{
	signal SIG_AIM4;
    set-signal-mask SIG_AIM4;
    turn pivot4 to y-axis heading speed <200>;
    turn pivot4 to x-axis (0-pitch) speed <200>;
    wait-for-turn pivot4 around y-axis;
    wait-for-turn pivot4 around x-axis;
    start-script RestoreAfterDelay4();
    return(TRUE);
 }


AimWeapon5(heading,pitch)
{
    signal SIG_AIM5;
    set-signal-mask SIG_AIM5;
    turn swivle to y-axis heading speed <100>;
    wait-for-turn swivle around y-axis;
    start-script RestoreAfterDelay5();
    return(TRUE);
}                    

AimFromWeapon1(piecenum)
{
 piecenum = pivot1;
 
}

AimFromWeapon2(piecenum)
{
 piecenum = pivot2;
 
}

AimFromWeapon3(piecenum)
{
 piecenum = pivot3;
 
}

AimFromWeapon4(piecenum)
{
 piecenum=pivot4;
 
}


AimFromWeapon5(piecenum)
{
 piecenum=swivle;
 
}

QueryWeapon1(piecenum)
{
 piecenum=fp1;
 
}

QueryWeapon2(piecenum)
{
 piecenum=fp2;
 
}

QueryWeapon3(piecenum)
{
 piecenum=fp3;
 
}

QueryWeapon4(piecenum)
{
 piecenum=fp4;
 
}


QueryWeapon5(piecenum)
{
 piecenum=maingunpoint;
 
}


FireWeapon1(piecenum)
{

}

FireWeapon2(piecenum)
{
 
}

FireWeapon3(piecenum)
{
 
}

FireWeapon4(piecenum)
{
 
}

FireWeapon5(piecenum)
{
 
}


Killed(severity, corpsetype)
{
	if( severity <= 25 )
	{
		corpsetype = 1;
		explode base type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
		explode swivle type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
		explode mturret type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
 		explode smbase1 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;		
	    explode smgun1  type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
		explode smbase2 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;		
	    explode smgun2  type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
	    explode smbase3 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;		
	    explode smgun3  type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
		explode smbase4 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;		
	    explode smgun4  type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
		return (0);
	}
	if( severity <= 50 )
	{
		corpsetype = 2;
		explode base type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
		explode swivle type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
		explode mturret type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
 		explode smbase1 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;		
	    explode smgun1  type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
		explode smbase2 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;		
	    explode smgun2  type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
	    explode smbase3 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;		
	    explode smgun3  type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
		explode smbase4 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;		
	    explode smgun4  type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
		return (0);
	}
	if( severity <= 99 )
	{
		corpsetype = 3;
		explode base type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
		explode swivle type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
		explode mturret type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
 		explode smbase1 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;		
	    explode smgun1  type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
		explode smbase2 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;		
	    explode smgun2  type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
	    explode smbase3 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;		
	    explode smgun3  type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
		explode smbase4 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;		
	    explode smgun4  type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
		return (0);
	}
	corpsetype = 3;
		explode base type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
		explode swivle type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
		explode mturret type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
 		explode smbase1 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;		
	    explode smgun1  type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
		explode smbase2 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;		
	    explode smgun2  type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
	    explode smbase3 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;		
	    explode smgun3  type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
		explode smbase4 type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;		
	    explode smgun4  type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2;
	return (0);
}

here is the FBI file (unit)

Code: Select all

 [UNITINFO]
	{
	//Internal settings
	unitname=DOOMFD;
	version=1;
	side=DOOM;
	objectname=DOOMFD.S3O;
	TEDClass=PLANT;
	category=DOOM NOTAIR NOTSUB NOTSHIP LEVEL1 FACTORY LAND ALL;	

	//unit limitations and properties
	WorkerTime=50;
	BuildTime=600;
	Corpse=BOREMC_DEAD.S30;
	SoundCategory=ARM_GEO;	
	SightDistance=250;
	radardistance=600;
	MaxDamage=800;
	name=Factory Defense;
	description=:Produces and Defends units;
	
	//energy and metal related
	BuildCostEnergy=50;
	BuildCostMetal=400;
	

	//Pathfinding and related
	FootPrintX=7;
	FootPrintZ=7;
	MaxWaterDepth=0;
	YardMap=yygggyy yyyyyyy gyyyyyg gyyyyyg gyyyyyg yyyyyyy yygggyy;
	MaxSlope=40;	
	mobilestandorders=1;
	standingmoveorder=1;
	firestandorders=1;
	standingfireorder=2;
	ovradjust=1;
	smoothanim=1;

	//Abilities
	Builder=1;
	CanMove=1;
	CanPatrol=1;
	CanStop=1;
	canattack=1;
	autoheal=5;

	//Weapons and related
	weapon1=DSHATTER;
        WeaponMainDir1=0 0 -1;
   	maxangledif1=180;

	weapon2=DSHATTER;
	weaponMainDir2=0 0 1;
	maxangleif2=180;

	weapon3=DSHATTER;
	weaponMainDir3=-1 0 0;
	maxangleif3=180;
	
	weapon4=DSHATTER;
	weaponMainDir4=1 0 0;
	maxangleif4=180;
	
	weapon5=DIMPLOSION;
	BadTargetCategory5=VTOL;	
	}

Here is the TDF file (weapon)

Code: Select all


[DSHATTER]
	{
      ID=30;
	name=Shatter Gun;
	rendertype=1;
	lineofsight=1;
      turret=1;
	Impulsefactor=-5;
	reloadtime=.5;
      weapontimer=.5;
	wobble=5;
	range=300;
	model=DSHATTER.s3o;
	weaponvelocity=200;
	areaofeffect=60;
	
	firestarter=0;

	explosiongaf=fx;
	explosionart=explode3;

	waterexplosiongaf=fx;
	waterexplosionart=h2o;

	lavaexplosiongaf=fx;
	lavaexplosionart=lavasplash;
	impulsefactor=0;




		[DAMAGE]
		{
		 default=20;
		}

	}

[DIMPLOSION]
	{
	ID=31;
	name=Implosion round;
	rendertype=1;
	weapontimer=2;
	Turret=1;
	impulsefactor=-10;
	balistic=1;
	AreaOfEffect=150;
	Range=1000;
	ReloadTime=1.5;
	Wobble=10;
	Model=DIMPLOSION.s3o;
	weaponvelocity=600;

	firestarter=0;
	explosiongaf=fx;
	explosionart=explode3;

	waterexplosiongaf=fx;
	waterexplosionart=h2o;

	lavaexplosiongaf=fx;
	lavaexplosionart=lavasplash;
	impulsefactor=0;



		[DAMAGE]
		{
		default=100;
		}

	}
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

Sean Mirrsen wrote:RRiiight.. can you post what you have of the unit? If that didn't help something more tricky can be amiss, like all those return 0's in the script (actually, ONE return 0 is mandatory - in the Fire script. Otherwise your unit will explode every time it fires. Yes, _every_ time.;)), or some misplaced aimpiece.
To be more precise, when there is nothing between the { and }, then you need a return. I wrote that above, but apparently it wasn't read, as in MrSpontaneous's script, the FireX, are like:
FireWeapon3(piecenum)
{

}
so with nothing between { }, so scriptor will get buggy on that and forget to add the return on the closing }, and so the lines after will be executed, and what comes after all those FireX is the killed with all those explosions. Oh and by the way, FireWeaponX doesn't require an argument.

MrSpontaneous, you forgot the "current s3o"!
Post Reply

Return to “Game Development”