Page 1 of 1

pieceExplosionGenerators

Posted: 28 Jan 2012, 04:49
by Forboding Angel
The old system might have sucked dick, but it worked (citation needed) :roll: and it was possible to find an example.

The extremely wordy wiki had this to say on the subject:
pieceExplosionGenerators
New in 0.83.x
The pieceExplosionGenerators subtable of SFXTypes tells Spring which CEGs the unit's script can pick at random to attach to a flying unit piece, created from the Explode() callout (See Animation-LuaCallouts#Effects). It is a simple array (number indexed table) of CEG names, with no prefix.
Great, that tells me exactly nothing.

How do I change this:
pieceTrailCEGTag = "deathceg",
pieceTrailCEGRange = 2,

^^ old and busted

Into the new hotness?

Re: pieceExplosionGenerators

Posted: 28 Jan 2012, 04:56
by knorke

Code: Select all

	  sfxtypes            = {	
	    explosiongenerators = {
--the effects used for EmitSfx in unit script
		"custom:blacksmoke",
		"custom:machinegun_muzzle",
	    },
--the effects randomly chosen for flying pieces
		pieceExplosionGenerators =
		{
		"blacksmoke",
		"greysmoke",
		},	
	  },

Re: pieceExplosionGenerators

Posted: 28 Jan 2012, 05:06
by Pako

Code: Select all

springcontent/gamedata/unitdefs_post.lua

for name, ud in pairs(UnitDefs) do
	if (ud.description) then
		-- Fix the EE unit descriptions
		ud.description = string.gsub(ud.description, '^: ', '')
	end

	-- convert from the pre-0.83 representation (pieceTrailCEGTag, pieceTrailCEGRange)
	if (ud.piecetrailcegtag ~= nil) then
		if (ud.sfxtypes == nil) then
			ud.sfxtypes = {}
		end

		if (ud.piecetrailcegrange == nil) then
			ud.piecetrailcegrange = 1
		end

		ud.sfxtypes["pieceExplosionGenerators"] = {}

		for n = 1, ud.piecetrailcegrange do
			ud.sfxtypes["pieceExplosionGenerators"][n] = ud.piecetrailcegtag .. (n - 1)
		end
	end
end

Re: pieceExplosionGenerators

Posted: 28 Jan 2012, 05:10
by Forboding Angel
Shit, knorke beat me to it, but I'll answer my own question so other clueless idiots like myself have a direct 1:1 example.

To turn

pieceTrailCEGTag = "deathceg",
pieceTrailCEGRange = 2,

into the new hotness, you do this:

sfxtypes = {
explosiongenerators = {
"custom:factorysparks",
"custom:dirt",
},
pieceExplosionGenerators = {
"deathceg0",
"deathceg1",
},

},

(Relevant part is bolded)

Basically just just add a new array under the heading of pieceExplosionGenerators with your death cegs

For people like me who like seeing the whole story, here is the convo of knorke pulling my ass out of the fire again:
[19:32:34] <[Evo]Forboding_Angel> need some engine dev guidence
[19:32:58] <[Evo]Forboding_Angel> As of spring 83, this no longer works:
[19:32:59] <[Evo]Forboding_Angel> pieceTrailCEGTag = "deathceg",
[19:32:59] <[Evo]Forboding_Angel> pieceTrailCEGRange = 2,
[19:34:02] <[Evo]Forboding_Angel> What duz I need to do
[19:34:59] <[RoX]knorke> it got changed to be less gay
[19:35:03] <[RoX]knorke> there is a thread somewhere
[19:35:38] <[RoX]knorke> you can now just do pieceTrailCEGTag = {"bla","blub", "waah",}
[19:35:48] <[RoX]knorke> without having to have numbers in the ceg-names
[19:36:05] <[Evo]Forboding_Angel> ok
[19:36:09] <[Evo]Forboding_Angel> so
[19:36:10] <[Evo]Forboding_Angel> umm
[19:36:20] <[Evo]Forboding_Angel> can you tell me what I need to do to change my tags?
[19:36:42] <[Evo]Forboding_Angel> I can't remember what the 2 was for
[19:36:43] <[RoX]knorke> pieceTrailCEGTag = {"deathceg0", "deathceg1", "deathceg2"}
[19:36:56] <[Evo]Forboding_Angel> ohhh yeah!
[19:36:59] <[Evo]Forboding_Angel> now I remember
[19:37:04] <[RoX]knorke> the 2 was the gay part
[19:37:06] <[Evo]Forboding_Angel> because the cegs had sequential shits
[19:37:11] <[RoX]knorke> yes
[19:37:24] <[Evo]Forboding_Angel> man I'm glad I noticed
[19:37:28] <[Evo]Forboding_Angel> last night when i was playng
[19:37:35] <[Evo]Forboding_Angel> the explosions didn';t look so neat
[19:37:41] <[Evo]Forboding_Angel> and I could figure out wtf it was
[19:37:52] <[Evo]Forboding_Angel> basically I was seeing engine explosions
[19:39:36] <[RoX]knorke> hm the numbering thing got dropped for sure, but i think it piece-trail-cegs are now in the normal ceg-table thing
[19:39:37] <[RoX]knorke> http://springrts.com/wiki/Units-UnitDef ... Generators
[19:44:42] <[Evo]Forboding_Angel> knorke, that didn't work :-/
[19:44:53] <[Evo]Forboding_Angel> pieceTrailCEGTag = {"deathceg0", "deathceg1"},
[19:44:59] <[Evo]Forboding_Angel> amidoinitrong?
[19:45:27] <[RoX]knorke> doing like i told but its wrong, see link
[19:46:33] <[Evo]Forboding_Angel> I don't understand it tho
[19:46:40] <[Evo]Forboding_Angel> that tells me nothing
[19:47:02] <[RoX]knorke> sec
[19:47:07] <[RoX]knorke> gotta test myself quick
[19:49:42] <[Evo]Forboding_Angel> ok thanks
[19:52:06] <[RoX]knorke> sfxtypes = {
[19:52:07] <[RoX]knorke> explosiongenerators = {
[19:52:07] <[RoX]knorke> "custom:blacksmoke", --emit when crashing
[19:52:07] <[RoX]knorke> "custom:machinegun_muzzle",--mg
[19:52:07] <[RoX]knorke> },
[19:52:07] <[RoX]knorke> pieceExplosionGenerators =
[19:52:07] <[RoX]knorke> {
[19:52:07] <[RoX]knorke> "blacksmoke",
[19:52:07] <[RoX]knorke> },
[19:52:07] <[RoX]knorke> },
[19:52:16] <[RoX]knorke> like that
[19:53:02] <[RoX]knorke> instead of "blacksmoke" have "deathceg0", "deathceg1"
[19:55:44] <[Evo]Forboding_Angel> oh ffs
[19:55:47] <[Evo]Forboding_Angel> really?
[19:56:00] <[Evo]Forboding_Angel> that is a seriously epic pain in the ass to go change everyhting now
[19:56:04] <[Evo]Forboding_Angel> thanks :-/
[19:57:45] <[RoX]knorke> did the old thing get broken?
[19:57:53] <[Evo]Forboding_Angel> yes
[19:57:57] <[Evo]Forboding_Angel> doesn't work at all
[19:58:36] <[Evo]Forboding_Angel> do i ahve to declare "blacksmoke twice?
[19:59:08] <[RoX]knorke> it randomly chose from any entires in pieceExplosionGenerators table
[19:59:36] <[RoX]knorke> so you can use any CEGs without having to give them funny numbered names
[20:00:45] <[Evo]Forboding_Angel> sfxtypes = {
[20:00:45] <[Evo]Forboding_Angel> explosiongenerators = {
[20:00:45] <[Evo]Forboding_Angel> "custom:factorysparks",
[20:00:45] <[Evo]Forboding_Angel> "custom:dirt",
[20:00:45] <[Evo]Forboding_Angel> "custom:deathceg0",
[20:00:45] <[Evo]Forboding_Angel> "custom:deathceg1",
[20:00:45] <[Evo]Forboding_Angel> },
[20:00:45] <[Evo]Forboding_Angel> pieceExplosionGenerators = {
[20:00:45] <[Evo]Forboding_Angel> "deathceg0",
[20:00:45] <[Evo]Forboding_Angel> "deathceg1",
[20:00:45] <[Evo]Forboding_Angel> },
[20:00:45] <[Evo]Forboding_Angel> },
[20:00:58] <[Evo]Forboding_Angel> do I have to declare deathceg twice?
[20:01:30] <[RoX]knorke> only if you want to use it with EmitSfx and for trails
[20:01:51] <[Evo]Forboding_Angel> I only wanna use it for death explosions
[20:02:10] <[Evo]Forboding_Angel> so like this?
[20:02:12] <[Evo]Forboding_Angel> sfxtypes = {
[20:02:13] <[Evo]Forboding_Angel> explosiongenerators = {
[20:02:13] <[Evo]Forboding_Angel> "custom:factorysparks",
[20:02:13] <[Evo]Forboding_Angel> "custom:dirt",
[20:02:13] <[Evo]Forboding_Angel> },
[20:02:13] <[Evo]Forboding_Angel> pieceExplosionGenerators = {
[20:02:13] <[Evo]Forboding_Angel> "deathceg0",
[20:02:13] <[Evo]Forboding_Angel> "deathceg1",
[20:02:13] <[Evo]Forboding_Angel> },
[20:02:13] <[Evo]Forboding_Angel> },
The moral of the story is, for any newcomers, this just makes sense and it was an excellent change, but those of us who used the old system have to go back and fix our shizzle. Which isn't that big of a deal, just a little time consuming. Thanks knorke!

Re: pieceExplosionGenerators

Posted: 28 Jan 2012, 05:18
by knorke

Code: Select all

[19:35:38] <[RoX]knorke> you can now just do pieceTrailCEGTag = {"bla","blub", "waah",}
just to make sure, I was a bit wrong there at first. So read the whole thing or better yet, only the example.
those of us who used the old system have to go back and fix our shizzle. Which isn't that big of a deal, just a little time consuming.
with Pako's code you do not have to edit every unitdef file by hand, which is actually a neat idea.

Re: pieceExplosionGenerators

Posted: 28 Jan 2012, 05:26
by Forboding Angel
knorke wrote:with Pako's code you do not have to edit every unitdef file by hand, which is actually a neat idea.
Yeah, but to me it seems like it would just be better to do it the right way now, so that later on I'm not looking at stuff and wondering what in the hell is going on.

Re: pieceExplosionGenerators

Posted: 28 Jan 2012, 10:30
by FLOZi
I do apologise for the wiki being 'extremely wordy' but it does infact tell you everything you need to know, so, better than nothing eh?

Re: pieceExplosionGenerators

Posted: 28 Jan 2012, 13:02
by Forboding Angel
Things like that need examples, Flozi. No worries tho, me and knorke fed the wiki a little bit, so at least the next clueless/hapless soul will have plenty of info.

Seriously tho, in the wiki, why aren't forum threads being linked? The threads by and large are hugely relevant.

Re: pieceExplosionGenerators

Posted: 28 Jan 2012, 13:46
by FLOZi
They are usually linked in 'Further Reading' sections on the better maintained pages