Page 1 of 1
Creating a CEG when the unit is building?
Posted: 29 Jul 2010, 06:16
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?
Re: Creating a CEG when the unit is building?
Posted: 29 Jul 2010, 15:36
by yuritch
Looks like your piece definitions are wrong.
This syntax works:
Re: Creating a CEG when the unit is building?
Posted: 30 Jul 2010, 02:04
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.
Re: Creating a CEG when the unit is building?
Posted: 30 Jul 2010, 02:16
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?
Re: Creating a CEG when the unit is building?
Posted: 30 Jul 2010, 02:18
by jK
yuritch wrote:Looks like your piece definitions are wrong.
This syntax works:
lua allows syntax as:
Code: Select all
foo "bar"
foo("bar") --is equivalent
Re: Creating a CEG when the unit is building?
Posted: 30 Jul 2010, 02:21
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")
Re: Creating a CEG when the unit is building?
Posted: 30 Jul 2010, 02:25
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;
}
?
Re: Creating a CEG when the unit is building?
Posted: 30 Jul 2010, 05:03
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.
Re: Creating a CEG when the unit is building?
Posted: 30 Jul 2010, 18:28
by jK
FLOZi wrote:...
ah nvm then, I thought it was based upon Spring.SpawnCEG
Re: Creating a CEG when the unit is building?
Posted: 30 Jul 2010, 20:03
by FLOZi
Feel free to provide the option, would be greatly appreciated
