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?
Creating a CEG when the unit is building?
Moderator: Moderators
Re: Creating a CEG when the unit is building?
Looks like your piece definitions are wrong.
This syntax works:
This syntax works:
Code: Select all
base = piece('base')
- SanadaUjiosan
- Conflict Terra Developer
- Posts: 907
- Joined: 21 Jan 2010, 06:21
Re: Creating a CEG when the unit is building?
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.
It should be noted that this worker is fully functional and we are now, later, wishing to add a CEG effect.
Re: Creating a CEG when the unit is building?
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?
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?
Re: Creating a CEG when the unit is building?
lua allows syntax as:yuritch wrote:Looks like your piece definitions are wrong.
This syntax works:Code: Select all
base = piece('base')
Code: Select all
foo "bar"
foo("bar") --is equivalent
Re: Creating a CEG when the unit is building?
this is incorrect:
EmitSfx(nano, orc_machinegun_flash)
lua's EmitSfx directly takes the CEG-name, e.g.
EmitSfx(nano, "orc_machinegun_flash")
EmitSfx(nano, orc_machinegun_flash)
lua's EmitSfx directly takes the CEG-name, e.g.
EmitSfx(nano, "orc_machinegun_flash")
Re: Creating a CEG when the unit is building?
Since when?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")

(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;
}
- SanadaUjiosan
- Conflict Terra Developer
- Posts: 907
- Joined: 21 Jan 2010, 06:21
Re: Creating a CEG when the unit is building?
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.
Re: Creating a CEG when the unit is building?
ah nvm then, I thought it was based upon Spring.SpawnCEGFLOZi wrote:...
Re: Creating a CEG when the unit is building?
Feel free to provide the option, would be greatly appreciated 
