Creating a CEG when the unit is building?

Creating a CEG when the unit is building?

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
User avatar
oksnoop2
Posts: 1207
Joined: 29 Aug 2009, 20:12

Creating a CEG when the unit is building?

Post by oksnoop2 »

http://codepad.org/Qea303PV script
http://codepad.org/RELiGAuH unitdef

We are trying make a CEG emit while a unit is building something. So far nothing is happening. Would someone be willing to suggest what is wrong and how to fix it?
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Re: Creating a CEG when the unit is building?

Post by yuritch »

Looks like your piece definitions are wrong.

This syntax works:

Code: Select all

base = piece('base')
User avatar
SanadaUjiosan
Conflict Terra Developer
Posts: 907
Joined: 21 Jan 2010, 06:21

Re: Creating a CEG when the unit is building?

Post by SanadaUjiosan »

Not sure what you're getting at.

It should be noted that this worker is fully functional and we are now, later, wishing to add a CEG effect.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Creating a CEG when the unit is building?

Post by FLOZi »

Yuri, that syntax works fine for single piece definitions, the parentheses are needed only when defining multiple pieces at once. The error shown on the link is codepad's own lua interpreter not recognising it.


Can you pastebin the CEG definition?
Are the textures referred to in the CEG in your resources.lua?
Are there any error messages in infolog.txt?
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Creating a CEG when the unit is building?

Post by jK »

yuritch wrote:Looks like your piece definitions are wrong.

This syntax works:

Code: Select all

base = piece('base')
lua allows syntax as:

Code: Select all

foo "bar"
foo("bar") --is equivalent
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Creating a CEG when the unit is building?

Post by jK »

this is incorrect:
EmitSfx(nano, orc_machinegun_flash)

lua's EmitSfx directly takes the CEG-name, e.g.
EmitSfx(nano, "orc_machinegun_flash")
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Creating a CEG when the unit is building?

Post by FLOZi »

jK wrote:this is incorrect:
EmitSfx(nano, orc_machinegun_flash)

lua's EmitSfx directly takes the CEG-name, e.g.
EmitSfx(nano, "orc_machinegun_flash")
Since when? :|

(Not that I'm complaining, it's a good change. But it's news to me, and I read the git log every day...)

edit:

Code: Select all

int CLuaUnitScript::EmitSfx(lua_State* L)
{
	// void EmitSfx(int type, int piece);
	if (activeScript == NULL) {
		return 0;
	}

	// note: the arguments are reversed compared to the C++ (and COB?) function

	const int piece = luaL_checkint(L, 1) - 1;
	const int type = luaL_checkint(L, 2);
	activeScript->EmitSfx(type, piece);
	return 0;
}
?
User avatar
SanadaUjiosan
Conflict Terra Developer
Posts: 907
Joined: 21 Jan 2010, 06:21

Re: Creating a CEG when the unit is building?

Post by SanadaUjiosan »

Got it to work. Something weird was going on with the CEG, so I put in a different one (that was actually appropriate) and now it is working.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Creating a CEG when the unit is building?

Post by jK »

FLOZi wrote:...
ah nvm then, I thought it was based upon Spring.SpawnCEG
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Creating a CEG when the unit is building?

Post by FLOZi »

Feel free to provide the option, would be greatly appreciated :P
Post Reply

Return to “Game Development”