Is there a way to make a flying unit detect whether or not its going over a cliff via triggers? Im trying to make the shots from my tanks explode if they hit a cliff. Right now they just fly over it lol.
And making them Ground means them just avoid it.
Collision detection with terrain is not built in. As far as I've seen.
Attaching regions to cliffs works but Is tedious. I've tried having a trigger that detected a z change hut it didn't work for me, tho, admittedly, I didn't try very hard to understand why.
But if your issue involves the projectile ramping up in z to make it over the wall, do this.
Make a copy of the mover fly, change it's height mapping to ground. This will cause it to be treated like a flying unit but when approaching a cliff it doesn't travel up in z before it reaches the wall... Instead it follow the terrain exactly as you see it.
Might just do the region thing this is my first SC2 map.
Tho right now i got a bigger issue. For some reason the missile straightup stopped moving lol i have no idea why. Didnt change anything other than the unit itself, and its movements are identical to the other one.
If you are using triggers and the middle is a unit, try checking the units mover. There are a ton of reasons the middle would stop, so with the information given I can't help much. Does it stop when it spawns or when it reaches it's impact location? Or something else?
Its late and i just closed my editor so i dont feel like pasting the trigger, but basically it was a simple trigger to track where your camera yaw was, and when you click the left mouse button a unit was spawned that would patrol 20 units away with a narrow aggressive window so you had to "hit" the enemy before the unit would attack it. Supposedly that tactic is less lag vs the region one, which is more accurate.
Before, when it was working, i'd click the left mouse and zoom missile-looking unit would zip out 20 paces and explode, or hit a unit i aimed at. Now it just sits there after it spawns.
Im just starting over. Really all i had was controls and the shooting down anyway, the terrain was random crap. Im sure i changed a bunch of stuff i probably shoudnt have lol.
EDIT: Changed my map idea for the time being to be a bit flatter and straight so i can use regions to block the cliffs. Perhaps if the map hits off and i get better at triggering, i wont need it because i'll have an Arcing weapon lol (or i just find a way to prevent it from going UP a cliff). Multiple maps are always nice in an arena anyway.
ProjectileCollisionEventsUnit-AnyUnitEnters(Playablemaparea)LocalVariablesProjectile=(Triggeringunit)<Unit>InitialCliffHeight=(Clifflevelof(Positionof(Triggeringunit)))<Integer>Conditions((Unittypeof(Triggeringunit))isMissile)==true// check mover, classification, whatever classifies your colliding projectiles. Mover might be better as you can specify a narrower scope.ActionsGeneral-While(Conditions)aretrue,do(Actions)Conditions((Triggeringunit)isalive)==trueActionsGeneral-If(Conditions)thendomultiple(Actions)IfThenElseGeneral-Elseif(Conditions)thendo(Actions)ElseIf(Clifflevelof(PositionofProjectile))>InitialCliffHeightThenUnit-Kill(Triggeringunit)General-Wait0.0GameTimeseconds
Ooooo think i'll use that! It sounds like that prevents the unit from going UP but not DOWN a cliff, which would be realistic and actually have a meaning to going to a higher level.
Sorry for butting in, but why Wait 0.0 Game time seconds? Does this prevent the trigger from running multiple times? I usually use wait 0.1 or 0.01 when I want something I ordered in the trigger to happen before moving on.
Ok i dont think that trigger is a good idea. Even with just 1 player the game litterally halts for a split second for the trigger to kill the unit. Plus the unit still drives up the wall before it gets killed anyway.
Maybe use an object with shields like immortal or something a like a defense drone that kills missiles and create an invisible dummy unit for these abilities and put them around cliffs.
Is there a way to make a flying unit detect whether or not its going over a cliff via triggers? Im trying to make the shots from my tanks explode if they hit a cliff. Right now they just fly over it lol. And making them Ground means them just avoid it.
Not sure but a work around would be applying regions over cliffs, and creating a trigger that runs when said unit enters the region.
@Albatross88: Go
You could also check whether the Z coordinate of the unit changes.
Collision detection with terrain is not built in. As far as I've seen.
Attaching regions to cliffs works but Is tedious. I've tried having a trigger that detected a z change hut it didn't work for me, tho, admittedly, I didn't try very hard to understand why.
But if your issue involves the projectile ramping up in z to make it over the wall, do this.
Make a copy of the mover fly, change it's height mapping to ground. This will cause it to be treated like a flying unit but when approaching a cliff it doesn't travel up in z before it reaches the wall... Instead it follow the terrain exactly as you see it.
Might just do the region thing this is my first SC2 map.
Tho right now i got a bigger issue. For some reason the missile straightup stopped moving lol i have no idea why. Didnt change anything other than the unit itself, and its movements are identical to the other one.
If you are using triggers and the middle is a unit, try checking the units mover. There are a ton of reasons the middle would stop, so with the information given I can't help much. Does it stop when it spawns or when it reaches it's impact location? Or something else?
Its late and i just closed my editor so i dont feel like pasting the trigger, but basically it was a simple trigger to track where your camera yaw was, and when you click the left mouse button a unit was spawned that would patrol 20 units away with a narrow aggressive window so you had to "hit" the enemy before the unit would attack it. Supposedly that tactic is less lag vs the region one, which is more accurate.
Before, when it was working, i'd click the left mouse and zoom missile-looking unit would zip out 20 paces and explode, or hit a unit i aimed at. Now it just sits there after it spawns.
Im just starting over. Really all i had was controls and the shooting down anyway, the terrain was random crap. Im sure i changed a bunch of stuff i probably shoudnt have lol.
EDIT: Changed my map idea for the time being to be a bit flatter and straight so i can use regions to block the cliffs. Perhaps if the map hits off and i get better at triggering, i wont need it because i'll have an Arcing weapon lol (or i just find a way to prevent it from going UP a cliff). Multiple maps are always nice in an arena anyway.
Quick example, gotta run off to class.
Ooooo think i'll use that! It sounds like that prevents the unit from going UP but not DOWN a cliff, which would be realistic and actually have a meaning to going to a higher level.
Sorry for butting in, but why Wait 0.0 Game time seconds? Does this prevent the trigger from running multiple times? I usually use wait 0.1 or 0.01 when I want something I ordered in the trigger to happen before moving on.
Ok i dont think that trigger is a good idea. Even with just 1 player the game litterally halts for a split second for the trigger to kill the unit. Plus the unit still drives up the wall before it gets killed anyway.
Back to the region idea.
Maybe use an object with shields like immortal or something a like a defense drone that kills missiles and create an invisible dummy unit for these abilities and put them around cliffs.
http://forums.sc2mapster.com/development/tutorials/8296-visual-shields-terran-or-zerg-with-shields/