Scripting: the emit-sfx function

Scripting: the emit-sfx function

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

Post Reply
nemovc
Posts: 5
Joined: 21 Feb 2007, 11:17

Scripting: the emit-sfx function

Post by nemovc »

OK, I've only just started scripting and can *sort-of* do basic stuff, or look up how to do it, but I can't find anything on the emit-sfx function. I know that

emit-sfx 2048 from piece spawns weapon1, 2049 weapon 2 etc, and I've also read that it can be used to create custom explosions.

How do you do this? What different numbers passed as arguments do what?
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Scripting: the emit-sfx function

Post by Forboding Angel »

It's pretty straight foward really.

It is an Honest firing of a weapon though. It's useful for many situations (of course I can't really think of any atm)...

Check out the Evolution RTS svn and look at the hellfire script, there is a vid on youtube showing the firing pattern.
[Krogoth86]
Posts: 1176
Joined: 23 Aug 2007, 19:46

Re: Scripting: the emit-sfx function

Post by [Krogoth86] »

Well you can use it the following way:

You for example want to have a special firing FX (like the Core Reapers have in e.g. BA) you use this. In your gamedata/explosions directory you somewhere define yourself an explosion i.e. particle effect which matches your whishes. Then you open the FBI of the unit which shall have the effect and add a

Code: Select all

[SFXTypes]
	{
	explosiongenerator0=custom:NAMEOFYOUREFFECT;
	}
As this now is your new firing FX you open the script of the unit and go to the FireWeapon function. There you add a

Code: Select all

emit-sfx 1024 + 0 from flare1;
I don't know what exactly is defined with the first 1024 number but the + 0 tells Spring to use the "explosiongenerator0" you have defined in your FBI and "from flare1" makes it spawn at the object flare1...

With that said you of course can define several of those SFX-Types for one unit:

Code: Select all

[SFXTypes]
	{
	explosiongenerator0=custom:NAMEOFYOURFIRSTEFFECT;
	explosiongenerator1=custom:NAMEOFYOURSECONDEFFECT;
	explosiongenerator2=custom:NAMEOFYOURTHIRDEFFECT;
	}
Which you then can call by

Code: Select all

emit-sfx 1024 + 0 from OBJECTX;
emit-sfx 1024 + 1 from OBJECTY;
emit-sfx 1024 + 2 from OBJECTZ;
Maybe someone else can tell you something about that first number but I found it to work even if you always use the same number...
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Scripting: the emit-sfx function

Post by Forboding Angel »

He is talking about emitting a Ceg. I am speaking of emitting a weapon.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Scripting: the emit-sfx function

Post by KDR_11k »

There's also 4096 which spawns the explosion of the corresponding weapon.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Scripting: the emit-sfx function

Post by Forboding Angel »

orly?

I didn't know about that one.
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Re: Scripting: the emit-sfx function

Post by rattle »

Surprisingly all of this is in the changelog...
- Calling emit-sfx 2048 from a script will now allways fire the weapon. Emit-sfx 4096 will now take over the previous behavior of detonating the weapon at the piece position.
- Added the abillity to call explosiongenerators and weaponfire from within script via emit-sfx command.
Explosiongenerators to be called via script are defined in the unit TDF file in a section called SFXTypes, with tags explosiongenerator+n=some_explosion
and then called via emit-sfx 1024+n.
Weaponfire are called via emit-sfx 2048+weapon_to_fire.
nemovc
Posts: 5
Joined: 21 Feb 2007, 11:17

Re: Scripting: the emit-sfx function

Post by nemovc »

Ok, and this is all good and cool, and I can see ways where I can apply it (the 4096 and 1024 + n) but it fails to answer my real question. What to the other numbers do (i.e., those smaller than 1024)?

Code: Select all

StartMoving()
{
	signal SIG_MOVE;
	set-signal-mask SIG_MOVE;
	while( TRUE )
	{
		emit-sfx 2 from wake1;	//these two
		emit-sfx 2 from wake2;	//lines
		sleep 300;
	}
}
(borrowed from the Decade gunship)
In this example the "emit-sfx 2" creates bubbles in the ships wake. What are the other numbers that are built in, and what do they do?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Scripting: the emit-sfx function

Post by Argh »

From SFXTYPE.H (that's in your Includes folder, came with Scriptor):

Code: Select all

// Vector-based special effects

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

// Point-based (piece origin) special effects

#define SFXTYPE_POINTBASED	256

#define SFXTYPE_WHITESMOKE	(SFXTYPE_POINTBASED | 1)
#define SFXTYPE_BLACKSMOKE	(SFXTYPE_POINTBASED | 2)
#define SFXTYPE_SUBBUBBLES	(SFXTYPE_POINTBASED | 3)
nemovc
Posts: 5
Joined: 21 Feb 2007, 11:17

Re: Scripting: the emit-sfx function

Post by nemovc »

OK, good, are there any other numbers? SFXTYPE.h isn't the actual definition file, it just makes it easier to name stuff in scriptor, isn't it?

Also, how does the pipe work (256|1 etc)?

I should probably stop asking questions and just start modding, but I'm finding it really difficult to get models. If anyone wants to help make an Epic 40k mod and has 1337 modeling skillZ (with a capital Z) please PM me.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Scripting: the emit-sfx function

Post by KDR_11k »

You may be better off joining GuessMyName with his Epic Legions mod instead of redoing it all from scratch.
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Re: Scripting: the emit-sfx function

Post by rattle »

nemovc
Posts: 5
Joined: 21 Feb 2007, 11:17

Re: Scripting: the emit-sfx function

Post by nemovc »

Yeah I thought of doing that but we're going to start higher, making really big stuff available, you know, titans, capitol ships, horribly overpowered shield generators etc.
Post Reply

Return to “Game Development”