Page 1 of 2

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

Posted: 15 Aug 2007, 20:34
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..

Posted: 15 Aug 2007, 23:40
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"

Posted: 15 Aug 2007, 23:42
by Pressure Line
doublepost for great justice...

dont forget to add the "normspeed" staticvar

Posted: 16 Aug 2007, 01:02
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.

Posted: 16 Aug 2007, 01:30
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.

Posted: 16 Aug 2007, 01:37
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;'

Posted: 16 Aug 2007, 06:10
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]

Posted: 17 Aug 2007, 02:16
by zwzsg
Try adding:
#define SMOKEPIECE 0
before the line where there is:
#include "springsmoke.h"

Posted: 17 Aug 2007, 08:47
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"

Posted: 17 Aug 2007, 10:09
by KDR_11k
Replace the 0 with the name of a piece.

Posted: 17 Aug 2007, 14:43
by Pressure Line

Code: Select all

#define SMOKEPIECE1 base
#include "springsmoke.h"
#include "exptype.h"

Posted: 17 Aug 2007, 19:53
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.

antiwep weapon.

Posted: 18 Aug 2007, 01:05
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.

Posted: 18 Aug 2007, 02:24
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.

Posted: 18 Aug 2007, 02:40
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

Re: antiwep weapon.

Posted: 19 Aug 2007, 12:29
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?

Re: antiwep weapon.

Posted: 19 Aug 2007, 12:57
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.

Posted: 19 Aug 2007, 15:03
by KingRaptor
You can, however, make a shield that scatters incoming missiles.

Posted: 19 Aug 2007, 16:06
by 1v0ry_k1ng
the laser idea is cooler

Posted: 19 Aug 2007, 19:05
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?