CEG Muzzle flare... how the hell do you add one.
Moderator: Moderators
CEG Muzzle flare... how the hell do you add one.
OK, can someone link me to how you use CEG's? More specificaly, for a muzzle flare? In Lua? Maybe I just sux, but I can't seem to piece together the workings from what I can find here.
aGorm
aGorm
Re: CEG Muzzle flare... how the hell do you add one.
In the lua scripts forum I posted a directly converted unit for code review. That unit (iirc) the rgm has a muzzle flare emit in the fire weapon 1 block of code.
Re: CEG Muzzle flare... how the hell do you add one.
Do you intend for each weapon to always have the same muzzleFX? If so, I can make your life much easier.
Re: CEG Muzzle flare... how the hell do you add one.
to teh nubmod!!
I added a muzzle flash effect to the attackvehiclemultimissile unit.
(only in SVN version so far)
click "diff" in this commit:
http://code.google.com/p/springtutorial ... etail?r=64
to see what got changed in both unitDef & script to add the CEG.
If you ignore the comments, it just needs 2 lines in the script.
I added a muzzle flash effect to the attackvehiclemultimissile unit.
(only in SVN version so far)
click "diff" in this commit:
http://code.google.com/p/springtutorial ... etail?r=64
to see what got changed in both unitDef & script to add the CEG.
If you ignore the comments, it just needs 2 lines in the script.
Re: CEG Muzzle flare... how the hell do you add one.
Thanks guys... knorke you are legend.
FLOZi, nope this is a one of flare. Why what were you going to suggest? (As I may still need a default one for some guns I expect...)
FLOZi, nope this is a one of flare. Why what were you going to suggest? (As I may still need a default one for some guns I expect...)
Re: CEG Muzzle flare... how the hell do you add one.
Well in the battletech mod, we associate a particular flare with a particular weapondef.
Then we automagically add them to all unitdefs using that weapondef such that in the script you can just do:
Then we automagically add them to all unitdefs using that weapondef such that in the script you can just do:
Code: Select all
EmitSFX(thePiece, SFX.CEG + weaponID)
Re: CEG Muzzle flare... how the hell do you add one.
aGorm
Re: CEG Muzzle flare... how the hell do you add one.
I guess the silence means no one knows an answer...
Re: CEG Muzzle flare... how the hell do you add one.
Try rotating the emitting piece to the direction of the weapon
Re: CEG Muzzle flare... how the hell do you add one.
I had this too sometimes, no idea why it happens.
Had it happen too if the emit point was an empty piece at the end of a barrel and rotating the empty piece did nothing. I have no idea what is going on but it it involves randomly rotating the emit pieces in both script and upspring, deleting it and adding it again and eventually it will work.
Had it happen too if the emit point was an empty piece at the end of a barrel and rotating the empty piece did nothing. I have no idea what is going on but it it involves randomly rotating the emit pieces in both script and upspring, deleting it and adding it again and eventually it will work.
Re: CEG Muzzle flare... how the hell do you add one.
I noticed rotating the emit peice gave no joy... hence the post. I shall try re-adding/rotating the point in upspring to see what happens.
aGorm
aGorm
Re: CEG Muzzle flare... how the hell do you add one.
if you get it almost correct by having a muzzle flash that goes 180┬░ in the wrong direction, you can also edit the effect:
length = -35,
or
size = -2
to flip it around.
length = -35,
or
size = -2
to flip it around.
Re: CEG Muzzle flare... how the hell do you add one.
Never am sure on this but some fx (used to?) use direction between vertex 1 and vertex 2 of the emitting piece rather than it's script rotation
Re: CEG Muzzle flare... how the hell do you add one.
yes, might be something like this:
Spring.GetUnitPiecePosDir:
Returns piece position and direction in world space.[...]The position is defined as the position of the first vertex of the piece and it defines direction as the direction in which the line from the first vertex to the second vertex points.
how that matters for empty pieces, I dont know but seems it somehow does.
Spring.GetUnitPiecePosDir:
Returns piece position and direction in world space.[...]The position is defined as the position of the first vertex of the piece and it defines direction as the direction in which the line from the first vertex to the second vertex points.
how that matters for empty pieces, I dont know but seems it somehow does.
Re: CEG Muzzle flare... how the hell do you add one.
I think it uses an internal function LocalModelPiece::GetEmitDirPos, which uses a vector in the +z direction in piece space if the piece has no vertices, or the vector from (0, 0, 0) to the vertex if the piece has one vertex, or the vector from vertex 1 to vertex 2 if the piece has two vertices.
In other words, a piece with zero vertices should give the same result as a piece with one vertex (0, 0, z) with z > 0, and as a piece with two vertices (0, 0, 0) and (0, 0, z) with z > 0.
(Or in the last case: two vertices (x, y, z) and (x, y, z2) with z2 > z for the same emit direction, but an emit position of (x, y, z) instead of (0, 0, 0).)
In other words, a piece with zero vertices should give the same result as a piece with one vertex (0, 0, z) with z > 0, and as a piece with two vertices (0, 0, 0) and (0, 0, z) with z > 0.
(Or in the last case: two vertices (x, y, z) and (x, y, z2) with z2 > z for the same emit direction, but an emit position of (x, y, z) instead of (0, 0, 0).)
Re: CEG Muzzle flare... how the hell do you add one.
After a lot of faf I got it to point in the right direction... (put the flare inside another empty object and rotated that parent... only way it seemed to work!)
Now I'm wondering... anyone have an example of how you use "CExpGenSpawner" to que up several effects
http://pastebin.com/MyjETL2w
aGorm
Now I'm wondering... anyone have an example of how you use "CExpGenSpawner" to que up several effects
I think I'm using them wrong... each of the two parts work fin if called, but I don't see how the CExpGenSpawner bit works so thatwas my best guess (IE, they will all be called as they have the same name, and the delays wil cause the other effects to start at stagurd times...)# You can animate an explosion flip-book style using delays and several bitmaps.
http://pastebin.com/MyjETL2w
aGorm
Re: CEG Muzzle flare... how the hell do you add one.
http://pastebin.com/nPEN65kh
OK, having looked through more examples (namely:
http://code.google.com/p/zero-k/source/ ... barney.lua
http://code.google.com/p/zero-k/source/ ... abelle.lua) I thought maybe I was on teh right track, but I still can't get anything to happen the second I try calling one CEG from a CExpGenSpawner... Anyone able to take a look? Please?
aGorm
OK, having looked through more examples (namely:
http://code.google.com/p/zero-k/source/ ... barney.lua
http://code.google.com/p/zero-k/source/ ... abelle.lua) I thought maybe I was on teh right track, but I still can't get anything to happen the second I try calling one CEG from a CExpGenSpawner... Anyone able to take a look? Please?
aGorm
Re: CEG Muzzle flare... how the hell do you add one.
Thats one of the threads I was looking at yes... (I do use the forum search you know... ). I can't spot what I've done differently from anyone elses...
aGorm
aGorm
Re: CEG Muzzle flare... how the hell do you add one.
Nor can I. Sorry, CEG is one area I am really clueless about.
Re: CEG Muzzle flare... how the hell do you add one.
http://pastebin.com/rQDqyDtB
Succses! Not the final effect, but I atleast got it to work as expected! Have to remember that when using CExpGenSpawner you have to pass on things like "dir" into the ceg your calling... or it wont work and will bug you for days...
aGorm
Succses! Not the final effect, but I atleast got it to work as expected! Have to remember that when using CExpGenSpawner you have to pass on things like "dir" into the ceg your calling... or it wont work and will bug you for days...
aGorm