ceg effects: only show effect when unit is hit

ceg effects: only show effect when unit is hit

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
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

ceg effects: only show effect when unit is hit

Post by knorke »

For a weapon I want an effect that just flying dirt if the ground is hit and flying sparks when a unit is hit.

So I did this:
http://pastebin.ca/2024146

Notice the
unit = false,
nounit = true,
etc.

The "flying sparks" (first effect part) only shows when a unit is hit - that is correct.
But the second part that should only show when the ground is hit shows up even if a target unit is hit.
Somewhere on wiki it says "if the impact point is not further than 15 elmo from ground it will be considered a ground hit" so I made air units shot each other - and the groundhit effect still shows.

http://springrts.com/wiki/CEG-Format

So any ideas or maybe a ceg effect (.lua prefered) that works as described or similiar?
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: ceg effects: only show effect when unit is hit

Post by Forboding Angel »

texture = [[dirt]], is defined in both areas. Might want use a different texture for the non groundhit one and see if maybe they were just hard to tell apart or something.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: ceg effects: only show effect when unit is hit

Post by knorke »

nah, they have different colors because of colormap tag.

groundhit effect is brown, the other one white.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: ceg effects: only show effect when unit is hit

Post by KDR_11k »

Using air=1 for the unit hit and ground=1 for the ground hit tends to work.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: ceg effects: only show effect when unit is hit

Post by jK »

think:
When you define ground=true & air=true, the effect still shows. So how will those flags be used? With bit-and or with bit-or? (bit-and would mean that all conditions must be meet and bit-or means that just minimum one must be meet)
And now think how the unit/nounit flags cooperate with those other flags.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: ceg effects: only show effect when unit is hit

Post by knorke »

http://pastebin.ca/2024665
i think air=false for the groundhit did it in the end, thanks...
http://pastebin.ca/2024681
this version with all conditions but nounit=true removed works too. Not sure about shooting at air if one wanted flak-effects, my projectiles just fly on "forever" if they miss so its fine with me...
So how will those flags be used?
Found it now, wiki says: "If you set more than one condition, the spawner will run if any of them are true."
It was not clear what conditions are checked for in what cases.
Also it was/is not really clear if ie unit=false means it does not check for units at all or if it means that the effect will trigger if no unit is hit.
nounit=true
unit=false
What is the difference?
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: ceg effects: only show effect when unit is hit

Post by KDR_11k »

The statements never exclude any cases. Unit=false means it won't be specifically triggered on hitting a unit but it can still be triggered by virtue of being in the air or on the ground. Nounit=true only covers the case when no unit is hit, it does not state anything about what happens when a unit is hit.
Post Reply

Return to “Game Development”