help the poor.. (anti missiles laser system '-how?)

help the poor.. (anti missiles laser system '-how?)

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
Lord Toulus Hetzer
Posts: 44
Joined: 25 Jul 2007, 19:47

help the poor.. (anti missiles laser system '-how?)

Post by Lord Toulus Hetzer »

Hello masters,guys, girls.

I have a problam, with the scripting :?

So what i need do it my unit move good.
if walking moving forward continues. but i dont want this.
i tried this but this dont working me and i dont know what i made it bad.
here it the code

Code: Select all

#define TA			

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

piece  ground, pelvis, lthigh, luleg, lleg, lfingerb, lfoot, lfingerf, rthigh, ruleg, rleg, rfingerb, rfoot, rfingerf, torso, utorso, head, larm, lgun1, lfire, rarm, rgun1, rfire,lacf, lacb, racf, racb,
tfr, tfl, tbr, tbl;
static-var  bMoving, bAiming, Static_Var_3, gun_1, startw;

// Signal definitions
#define SIG_AIM				4
#define MAX_SPEED			75




walk()
{
	if ( startw == 1 )
	{ 
		if ( bMoving )
move lfingerf to z-axis [0.000000] now;
move rfingerf to z-axis [0.000000] now;
SET MAX_SPEED to [0.00000];
sleep 9;

and here the piece of the l walking lines, just what and where i need type. and how working this define stuff.

Code: Select all

#define TA

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

piece  ground, pelvis, lthigh, luleg, lleg, lfingerb, lfoot, lfingerf, rthigh, ruleg, rleg, rfingerb, rfoot, rfingerf, torso, utorso, head, larm, lgun1, lfire, rarm, rgun1, rfire,lacf, lacb, racf, racb,
tfr, tfl, tbr, tbl;
static-var  bMoving, bAiming, Static_Var_3, gun_1, startw;

// Signal definitions
#define SIG_AIM				4




walk()
{
	if ( startw == 1 )/////////////////////////// this the walking start place, here just turning up-forward the right leg and, standing on the left leg.
	{ 
		if ( bMoving )
move lfingerf to z-axis [0.000000] now;
move rfingerf to z-axis [0.000000] now;
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
move pelvis to y-axis [0.300000] now;
move pelvis to z-axis [0.000000] now;
turn lfoot to x-axis <15.000000> now;
turn lfingerf to x-axis <-15.000000> now;
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
move pelvis to y-axis [0.500000] now;
move pelvis to z-axis [0.000000] now;
turn lfoot to x-axis <30.000000> now;
turn lfingerf to x-axis <-30.000000> now;
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
move pelvis to y-axis [0.600000] now;
move pelvis to z-axis [0.000000] now;
turn lfoot to x-axis <45.000000> now;
turn lfingerf to x-axis <-45.000000> now;
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
move pelvis to y-axis [0.700000] now;
move pelvis to z-axis [0.000000] now;
turn lfoot to x-axis <60.000000> now;
turn lfingerf to x-axis <-60.000000> now;
SET MAX_SPEED to [0.00000];
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
move pelvis to y-axis [0.800000] now;
move pelvis to z-axis [0.000000] now;
turn lfoot to x-axis <75.000000> now;
move lfoot to z-axis [0.000000] now;
turn lfingerf to x-axis <-75.000000> now;
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
turn rthigh to x-axis <5.000000> now;
turn ruleg to x-axis <-2.000000> now;
turn rleg to x-axis <10.000000> now;
turn rfingerb to x-axis <4.000000> now;
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
turn rthigh to x-axis <10.000000> now;
turn ruleg to x-axis <-4.000000> now;
turn rleg to x-axis <20.000000> now;
turn rfingerb to x-axis <8.000000> now;
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
turn rthigh to x-axis <15.000000> now;
turn ruleg to x-axis <-6.000000> now;
turn rleg to x-axis <30.000000> now;
turn rfingerb to x-axis <12.000000> now;
SET MAX_SPEED to [0.00000];
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
turn rthigh to x-axis <20.000000> now;
turn ruleg to x-axis <-8.000000> now;
turn rleg to x-axis <40.000000> now;
turn rfingerb to x-axis <16.000000> now;
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
turn rthigh to x-axis <25.000000> now;
turn ruleg to x-axis <-10.000000> now;
turn rleg to x-axis <50.000000> now;
turn rleg to z-axis <0.000000> now;
turn rfingerb to x-axis <20.000000> now;
turn rfoot to x-axis <10.000000> now;
turn rfingerf to x-axis <10.000000> now;
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
turn rthigh to x-axis <30.000000> now;
turn ruleg to x-axis <-12.000000> now;
turn rleg to x-axis <50.000000> now;
turn rfoot to x-axis <20.000000> now;
turn rfingerf to x-axis <20.000000> now;
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
turn rthigh to x-axis <35.000000> now;
turn ruleg to x-axis <-14.000000> now;
turn rleg to x-axis <50.000000> now;
turn rfoot to x-axis <30.000000> now;
turn rfingerf to x-axis <30.000000> now;
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
turn rthigh to x-axis <40.000000> now;
turn ruleg to x-axis <-16.000000> now;
turn rleg to x-axis <50.000000> now;
turn rfoot to x-axis <40.000000> now;
turn rfingerf to x-axis <40.000000> now;
turn rfingerf to z-axis <0.000000> now;
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
turn rthigh to x-axis <45.000000> now;
turn ruleg to x-axis <-18.000000> now;
turn rleg to x-axis <50.000000> now;
turn rfoot to x-axis <50.000000> now;
turn rfingerf to x-axis <50.000000> now;
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
turn rthigh to x-axis <50.000000> now;
turn ruleg to x-axis <-20.000000> now;
turn rleg to x-axis <50.000000> now;
turn rfingerb to x-axis <20.000000> now;
turn rfoot to x-axis <60.000000> now;
turn rfingerf to x-axis <60.000000> now;
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
turn rthigh to x-axis <40.000000> now;
turn rfingerb to x-axis <20.000000> now;
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
turn rthigh to x-axis <30.000000> now;
turn rfingerb to x-axis <20.000000> now;
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
turn rthigh to x-axis <20.000000> now;
turn rfingerb to x-axis <20.000000> now;
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
turn rthigh to x-axis <10.000000> now;
turn rfingerb to x-axis <20.000000> now;
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
turn rthigh to x-axis <0.000000> now;
turn rfingerb to x-axis <20.000000> now;
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
turn rthigh to x-axis <-10.000000> now;
turn rfingerb to x-axis <10.000000> now;
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
turn rthigh to x-axis <-20.000000> now;
turn rfingerb to x-axis <0.000000> now;
SET MAX_SPEED to [0.00000];
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
turn rthigh to x-axis <-30.000000> now;
turn rfingerb to x-axis <-10.000000> now;
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
turn rthigh to x-axis <-40.000000> now;
turn rfingerb to x-axis <-20.000000> now;
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
turn rthigh to x-axis <-50.000000> now;
turn ruleg to x-axis <-20.000000> now;
turn rfingerb to x-axis <-30.000000> now;
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
turn rthigh to x-axis <-57.000000> now;
turn ruleg to x-axis <-11.500000> now;
turn rleg to x-axis <55.000000> now;
turn rfingerf to x-axis <40.000000> now;
SET MAX_SPEED to [0.00000];
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
turn rthigh to x-axis <-64.000000> now;
turn ruleg to x-axis <-3.000000> now;
turn rleg to x-axis <60.000000> now;
turn rfingerf to x-axis <20.000000> now;
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
turn rthigh to x-axis <-71.000000> now;
turn ruleg to x-axis <5.500000> now;
turn rleg to x-axis <65.000000> now;
turn rfingerf to x-axis <0.000000> now;
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
move pelvis to z-axis [0.000000] now;
turn rthigh to x-axis <-78.000000> now;
turn ruleg to x-axis <14.000000> now;
turn rleg to x-axis <70.000000> now;
turn rfingerf to x-axis <-20.000000> now;
sleep 9;
}
	if ( startw == 1 )
	{ 
		if ( bMoving )
move pelvis to y-axis [0.800000] now;
move pelvis to z-axis [0.000000] now;
turn lfoot to x-axis <75.000000> now;
turn lfingerf to x-axis <-75.000000> now;
turn rthigh to x-axis <-85.000000> now;
turn ruleg to x-axis <22.500000> now;
turn rleg to x-axis <75.000000> now;
turn rfingerf to x-axis <-40.000000> now;
turn head to y-axis <1.000000> now; 
turn head to x-axis <0.000000> now;
turn head to z-axis <0.000000> now;
startw = 0;
sleep 9;
} 
	if ( startw == 0 )////////////////// This is Here the first step, the AK standing and left and right legs and starting pull forward yoursefl, i here want set to the speed(current or max) maybe too 2.5
	{ 
		if ( bMoving )
move pelvis to y-axis [0.900000] now;
turn lthigh to x-axis <5.000000> now;
turn luleg to x-axis <-2.000000> now;
turn lleg to x-axis <10.000000> now;
turn lfingerb to x-axis <4.000000> now;
turn lfoot to x-axis <60.000000> now;
turn lfingerf to x-axis <-60.000000> now;
turn rthigh to x-axis <-92.000000> now;
turn ruleg to x-axis <31.000000> now;
turn rleg to x-axis <80.000000> now;
turn rfingerb to x-axis <-40.000000> now;
sleep 9;
}
i using. Sciptor and Servo.

but i have more question but first i want make the walks.
oh if need i made with fraps a video..
Last edited by Lord Toulus Hetzer on 19 Aug 2007, 13:07, edited 5 times in total.
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Post by Pressure Line »

use "set MAX_SPEED to 1" 0 doesnt work (1 is REALLY REALLY slow)

and add a line in Create() "normspeed = get MAX_SPEED" and when you want the unit moving normally go "set MAX_SPEED = normspeed"
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Post by Pressure Line »

doublepost for great justice...

dont forget to add the "normspeed" staticvar
User avatar
Lord Toulus Hetzer
Posts: 44
Joined: 25 Jul 2007, 19:47

Post by Lord Toulus Hetzer »

Pressure Line wrote:use "set MAX_SPEED to 1" 0 doesnt work (1 is REALLY REALLY slow)

and add a line in Create() "normspeed = get MAX_SPEED" and when you want the unit moving normally go "set MAX_SPEED = normspeed"

oh master THX!!! :o that is working :-) thx again. ,and thx the advice ,but i think better if i set by my hand, but man you are really helped me out.

***

so i want make foot steps, how i an put in sounds? foot steps or turnig sounds like a motor. or this not possinle in .cob?

another thing, i want make a weapon with 2 type if shooting like in FPS first and secundary shooting. exactly this is a beam type weapon and can shoot a burst, and 1 but power shot like in the S.W. Jedi Knight the first weapon , the blaster.

with a switcher in the game like the guardian, plazma toaster.
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Post by Pressure Line »

Gnome wrote:As we all know, Spring has supported the "play-sound" command in scripts since 0.63b1:

-Added support for loading TA:K COB files and implemented the TA:K-specific opcode play-sound.

This allows a unitmaker to play any sound he wants (a wav file in the /sounds/ directory) at any volume at any point in the script. This is useful, since now we can do things such as running engine sounds while units move, foot step noises, or anything else of that nature.

Getting it to work isn't as simple as that makes it appear, though. After bothering Fnordia for a while, we finally got it working nicely.

Since I use scriptor, that's all this little guide is written for. I don't think any other compilers would be up to this task anyway. First of all, you must be compiling in TA:K mode. You can either click the little green TAK button in the scriptor GUI or you can put the following line at the beginning of your script:

#define TAK

Secondly, you cannot use the stock SmokeUnit.h file. If your unit uses SmokeUnit and you want it to play sounds, you can't right off the bat. This is because TAK handled smoking units differently than TA, mainly with a different function, but the point is if you try to compile with the original SmokeUnit you will crash scriptor.

So, to rectify this, I've made a hacked up Spring-sound-ready Smokeunit.h. It's available for download by clicking here. Simply put this .h file in your Includes directory, and then change the line:

#include "smokeunit.h"

in any scripts you want to play sounds in with:

#include "springsmoke.h"

And everything will compile and work just fine (barring other errors on your part, of course). You don't have to make this change for units that don't use play-sound.

Then, to use play-sound, you just type in the following line:

play-sound("filename", 1);

where filename is the filename of the .wav file in the /sounds/ directory to play, and 1 is the volume. There is no limit to volume afaik. For reference, I had to use a volume value of 10 for the Raven's explosion sound to make it about the same volume as it is normally in game. There's no limit to what functions it can be played in, as far as I know, but I'm sure putting a play-sound in a repeating loop without a sleep wouldn't be a good thing.
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Post by Pressure Line »

your dual weapon thing might work with some sort of lua script, but i have no idea how to do that.

when you are using 'set MAX_SPEED' manually remember to use a conversion factor of 65536 to convert from the unit speed defined in the .fbi

for example: unit has a max speed to 2 in the fbi, if we want it to be able to move at this speed after using 'set MAX_SPEED to 1;' we have to use 'set MAX_SPEED to 2 * 65536'

this is why its much easier to do it the way i described earlier, it also means you dont have to update the script if you change the unit's speed in the fbi, because the script reads the units max speed when it is created.

**edit**
Guessmyname wrote:Another tip is that you can just put speeds in [] rather than having to put the multiplier on the end. Though if you use the above method, you won't need to. The []'s tell scriptor to multiply whatever's in it by that multiplier.
Guessmyname has a better way.

so in the example above we use 'set MAX_SPEED to [2.000000];' not 'set MAX_SPEED to 2;' or 'set MAX_SPEED to 131072;'
User avatar
Lord Toulus Hetzer
Posts: 44
Joined: 25 Jul 2007, 19:47

Post by Lord Toulus Hetzer »

right, ok. maybe in the FBI i use 1. if this unit a mech with legs.

this sound, i think i want some too.. complex thing, dont succesed now :(
(maybe because im too tired now.)
scricptor says (1.0 RC1):
"Error (65); Unknown identifier SMOKEPIECE [D:\script\include\springsmoke.h"


the weapon. i have a idea, maybe a little later i writed it. and post here.
but other can i change which weapon(s) wilding the unit?

anyway, thx Pressure Line the helping infos.
[/code]
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

Try adding:
#define SMOKEPIECE 0
before the line where there is:
#include "springsmoke.h"
User avatar
Lord Toulus Hetzer
Posts: 44
Joined: 25 Jul 2007, 19:47

Post by Lord Toulus Hetzer »

zwzsg wrote:Try adding:
#define SMOKEPIECE 0
before the line where there is:
#include "springsmoke.h"

dont working, the scriptor saying :
Compiling Bos...
Compiling springsmoke.h
Compiling SFXtype.h
Compiling EXPtype.h
Error (65): 0 is no the correct type [D:\script\include\springsmoke.h]

One or more errors occured while compiling the script.

The script

Code: Select all

#define TAK
#define SMOKEPIECE 0 
#include "springsmoke.h"
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

Replace the 0 with the name of a piece.
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Post by Pressure Line »

Code: Select all

#define SMOKEPIECE1 base
#include "springsmoke.h"
#include "exptype.h"
User avatar
Lord Toulus Hetzer
Posts: 44
Joined: 25 Jul 2007, 19:47

Post by Lord Toulus Hetzer »

KDR_11k wrote:Replace the 0 with the name of a piece.
Pressure Line wrote:

Code: Select all

#define SMOKEPIECE1 base
#include "springsmoke.h"
#include "exptype.h"
Thx, this is work masters. i just need make the great sounds, this is really good but i needed (i just dont see something) deleted the SmokeUnit(healthpercent, sleeptime, smoketype) but this is not imortant the auohealt and if unit or smoke or not . the sound fx is have bigger priority.
User avatar
Lord Toulus Hetzer
Posts: 44
Joined: 25 Jul 2007, 19:47

antiwep weapon.

Post by Lord Toulus Hetzer »

ok, i dont know this best place for this., but i dont want open a topic for every problams,or "how i do..."

So, i want make a antiweapon , but where i start ?
this s a weapon is a normal laser weapon.,but hunting the shooted rockets/missilies. and destroying if coming in the laser wep range.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

This is odd, I just retested, and my scriptor gives no error on lines such as "emit-sfx 0 from 0;" (where 0 actually means the first piece in the line that goes "piece x1,x2,X3,...,xn;") Where you got that "springsmoke.h" and what does it do? Or maybe it's the TA:Kingdoms thing that makes the syntax more strict? Bah, it's not like you care, as long as you got it working somehew.
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Post by Pressure Line »

zwzsg wrote:This is odd, I just retested, and my scriptor gives no error on lines such as "emit-sfx 0 from 0;" (where 0 actually means the first piece in the line that goes "piece x1,x2,X3,...,xn;") Where you got that "springsmoke.h" and what does it do? Or maybe it's the TA:Kingdoms thing that makes the syntax more strict? Bah, it's not like you care, as long as you got it working somehew.
Gnome wrote springsmoke.h, and yeah i think its something to do with TAK mode being a bit funny about syntax
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: antiwep weapon.

Post by KDR_11k »

Lord Toulus Hetzer wrote:ok, i dont know this best place for this., but i dont want open a topic for every problams,or "how i do..."

So, i want make a antiweapon , but where i start ?
this s a weapon is a normal laser weapon.,but hunting the shooted rockets/missilies. and destroying if coming in the laser wep range.
Not possible. Only vlaunch missiles can intercept missiles.

Zw: Didn't you post how to modify your compiler.cfg to allow variables in places where pieces are expected?
User avatar
Lord Toulus Hetzer
Posts: 44
Joined: 25 Jul 2007, 19:47

Re: antiwep weapon.

Post by Lord Toulus Hetzer »

KDR_11k wrote:
Lord Toulus Hetzer wrote:ok, i dont know this best place for this., but i dont want open a topic for every problams,or "how i do..."

So, i want make a antiweapon , but where i start ?
this s a weapon is a normal laser weapon.,but hunting the shooted rockets/missilies. and destroying if coming in the laser wep range.
Not possible. Only vlaunch missiles can intercept missiles.

Zw: Didn't you post how to modify your compiler.cfg to allow variables in places where pieces are expected?

Not possible ? oh.this is very sad, i cant finish my AK.
User avatar
KingRaptor
Zero-K Developer
Posts: 838
Joined: 14 Mar 2007, 03:44

Post by KingRaptor »

You can, however, make a shield that scatters incoming missiles.
User avatar
1v0ry_k1ng
Posts: 4656
Joined: 10 Mar 2006, 10:24

Post by 1v0ry_k1ng »

the laser idea is cooler
User avatar
Zoy64
Posts: 454
Joined: 12 Nov 2006, 00:30

Post by Zoy64 »

like that game, C&C: Generals where a tank could shoot down missles with a laser. Spring could use a unit like that. now i have a question, is there/can there be a unit that can shoot down planes with a laser?
Post Reply

Return to “Game Development”