Knuckle Cracker

Creeper World 3 => The Coder's Corner => Topic started by: eduran on January 23, 2014, 11:09:36 AM

Title: Custom flying enemies vs Snipers
Post by: eduran on January 23, 2014, 11:09:36 AM
I am working on a map that has flying enemies in them and the player is supposed to be able to shoot them down. Ideally, I'd like them to use Beams to do that, but for all I know it is impossible to make CRPL cores targetable by Beams. So Snipers are the fallback option. But they require line of sight to the target, which means they can only shoot at 'flyers' at or below their own elevation level. It's not a huge deal, the map is still playable, but it is a lot harder to fight the flyers than it is supposed to be.
So, is there a way to designate a CRPL core as flying, so that snipers could ignore LOS when targeting them? Or, even better, make them targetable by Beams? And if neither of the two is possible, does anyone have any ideas how I could make fighting the flyers less annoying?
Title: Re: Custom flying enemies vs Snipers
Post by: Clean0nion on January 23, 2014, 11:22:38 AM
It's not really a solution but you could make a custom unit that detects snipers then places itself there...
Title: Re: Custom flying enemies vs Snipers
Post by: knucracker on January 23, 2014, 11:27:24 AM
I'm making final updates before I do the next major release, so let me take a look and see what might make sense.
If you have a simple test map with a 'flying' core and a sniper and beam... that would help me test what I implement.  Note that whatever I do needs to fit into the next few hours of work since I need to publish the new build today/tonight.
Title: Re: Custom flying enemies vs Snipers
Post by: eduran on January 23, 2014, 12:02:52 PM
I've put together a map with a basic version of the flying core (it just roams around the map randomly), a spawner for the flyers and one Beam and Sniper.

Edit: Also, thanks for the incredibly quick response. And there is no need to rush this, I didn't mean to increase your workload just before a deadline.
Title: Re: Custom flying enemies vs Snipers
Post by: knucracker on January 23, 2014, 12:46:44 PM
I had just literally been looking at the spore and beam code when I read this, so it's a good time.
At the very least I am making beam targeting an option on cores.  That will give two ways to take them out.

For the LOS on the sniper... I'm not sure about that just yet.
Title: Re: Custom flying enemies vs Snipers
Post by: knucracker on January 23, 2014, 02:36:20 PM
Ok, I've made it to so you can do both or either.

Do this in your flyer to make beams zap them:
   SetUnitAttribute(Self CONST_BEAMTARGET TRUE)

Or you can do this to make Snipers take them out regardless of LOS:
   SetUnitAttribute(Self CONST_SNIPERTARGET TRUE)
   SetUnitAttribute(Self CONST_SNIPERIGNORELOS TRUE)

I added Beam Target to the GUI for cores as well, so that can be set on a unit that is created using the editor rather than code.  I did not add the SniperIgnoreLOS option to the GUI editor since it is a pretty special case thing.  In my mind it makes sense to set SniperIgnoreLOS on units that you want to be sniper targets that are also 'flying' units.

Beam targeting is pretty fun as well.  You might want to tweak the health of the  flying units to make the harder/easier to kill but by default they are pretty good.  In other scenarios, I could also imagine a giant boss structure on the ground that has a health.  It might take one beam 10 minutes to take it down.  So you have to try to build as many beam as you can (and power them all) to take it out as quickly as possible.  But just using beams for your flying units will be a good addition to the game I think.
Title: Re: Custom flying enemies vs Snipers
Post by: eduran on January 23, 2014, 02:53:47 PM
Awesome, can't wait to try it. My flyers are conditioned to run away when damaged and I expect that to work a lot better with the continuous damage from Beams.