Melee Unit_Script.lua

Melee Unit_Script.lua

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
kalda341
Posts: 101
Joined: 19 Nov 2010, 09:44

Melee Unit_Script.lua

Post by kalda341 »

I can't work out how to make a unit with just a base and a flare attack. Can anybody help?
kalda341
Posts: 101
Joined: 19 Nov 2010, 09:44

Re: Melee Unit_Script.lua

Post by kalda341 »

It is a melee unit.
User avatar
maackey
Posts: 490
Joined: 02 Jul 2008, 07:11

Re: Melee Unit_Script.lua

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

Re: Melee Unit_Script.lua

Post 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?
User avatar
maackey
Posts: 490
Joined: 02 Jul 2008, 07:11

Re: Melee Unit_Script.lua

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

Re: Melee Unit_Script.lua

Post 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.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Melee Unit_Script.lua

Post 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
kalda341
Posts: 101
Joined: 19 Nov 2010, 09:44

Re: Melee Unit_Script.lua

Post 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.
kalda341
Posts: 101
Joined: 19 Nov 2010, 09:44

Re: Melee Unit_Script.lua

Post by kalda341 »

The unit is just a ball (base) with a flare.
Post Reply

Return to “Lua Scripts”