Page 1 of 1

Melee Unit_Script.lua

Posted: 24 Nov 2010, 23:14
by kalda341
I can't work out how to make a unit with just a base and a flare attack. Can anybody help?

Re: Melee Unit_Script.lua

Posted: 25 Nov 2010, 04:02
by kalda341
It is a melee unit.

Re: Melee Unit_Script.lua

Posted: 25 Nov 2010, 05:10
by maackey
you should try to be more specific.

there are a bunch of unit definitions and lua animation scripts here: http://code.google.com/p/zero-k/source/ ... nk/mods/zk if you need examples.

Most of the time melee is faked with invisible laser that has a short range and when unit attacks give it some attacking animation.

Re: Melee Unit_Script.lua

Posted: 25 Nov 2010, 16:27
by knorke
relevant to interessants.
I know/thought about the invisible lasers but not the details. Like what point do you shot the laser from, does that matter? Would it be a good idea to shot the laser from a point high above the unit instead of ie from the head so always has clear los to fire?

Re: Melee Unit_Script.lua

Posted: 25 Nov 2010, 17:35
by maackey
Its been a while since I experimented with it, but if you move the fire point far away (like up) it will affect the range the unit can attack from. If you give it cylindrical targeting than afaik it can hit air units! which is probably not desired behavior.

If you want always clear line of fire, you could have it shoot through allies and ignore them etc... IIRC SA does this? In my experiments I always had the fire point be either the head or torso and seemed to work fine. I forget the actual tags that let you bypass allies but you can probably look them up.

And ofc when testing you can make the laser visible so you know how your mechanics are working.

Re: Melee Unit_Script.lua

Posted: 25 Nov 2010, 17:44
by knorke
If you give it cylindrical targeting than afaik it can hit air units! which is probably not desired behavior.
lol true. but could be solved with targetcategory thing.
I want this for the miners in CT. Atm they use a machine gun like "cannon type" weapon. They usually work well but it seems sometimes the engines pathing is too stupid to put them in a position to mine correctly, like when is on a cliff or something and they try to mine (=shot) it from down below.

Re: Melee Unit_Script.lua

Posted: 25 Nov 2010, 18:25
by FLOZi
maackey wrote:If you give it cylindrical targeting than afaik it can hit air units! which is probably not desired behavior.
Learn 2 cylinder target!

Image

Re: Melee Unit_Script.lua

Posted: 25 Nov 2010, 20:27
by kalda341
maackey wrote:you should try to be more specific.

there are a bunch of unit definitions and lua animation scripts here: http://code.google.com/p/zero-k/source/ ... nk/mods/zk if you need examples.

Most of the time melee is faked with invisible laser that has a short range and when unit attacks give it some attacking animation.
Thanks for the link, but I'm using lua.

Re: Melee Unit_Script.lua

Posted: 25 Nov 2010, 20:44
by kalda341
The unit is just a ball (base) with a flare.