Defense Range v6.12 - Page 4

Defense Range v6.12

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

Moderator: Moderators

User avatar
quantum
Posts: 590
Joined: 19 Sep 2006, 22:48

Re: Defense Range v3.7

Post by quantum »

Here is a version with some fixes for the latest CA.
el_matarife
Posts: 933
Joined: 27 Feb 2006, 02:04

Re: Defense Range v3.7

Post by el_matarife »

very_bad_soldier wrote:Added one little new feature to see blast radius.
Could you add a regular blast radius option in addition to the self destruct blast size? It'd help make sense of placing buildings much more than the self destruct blast size which is usually a lot bigger.
Totbuae
Posts: 38
Joined: 14 Nov 2007, 08:22

Re: Defense Range v3.7

Post by Totbuae »

Is there any way to get the widget to display two ranges for the same unit? I'm trying to get it to work for NOTA and the Arm Command Center has two weapons: an anti-air missile with a range of 1500 and a ground attack rocket with a range of 1300.

So far I've tried editing the gui_defenseRange_units.inc file and added

Code: Select all

unitList["armbase"] = {4, nil}
but that only marked the anti-air missile range. Next I tried

Code: Select all

unitList["armbase"] = {1, nil}
unitList["armbase"] = {2, nil}
but, once again, only the anti-air range was marked. Last I tried

Code: Select all

unitList["armbase"] = {1, nil}
and it still marked the anti-air range but grouped with the ground ranges (the circle would disappear if I turned off ground ranges).

I'm guessing I'm gonna have to go into the .lua file but since I haven't done any lua before any help would be greatly appreciated. Thanks in advance.
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Re: Defense Range v3.7

Post by very_bad_soldier »

@quantum:
Thanks for doing it. I will preserve your fixes for future versions. Btw do you use any kind of IDE for the LUA-stuff? I saw your "automatically generated locals"...
What do you think about the approach using a unit file for weapon classification? I think it could avoid future code fixes for specific mods. I will probably do a total rewrite since I dont like the code in its current form. And I am thinking about switching entirely to the unit file method because the current generic weapon detection is quite strange and fails as soon as something gets changed in a mod.

@Totbuae:
Sorry, I think there is no quick way to have two or more ranges for one weapon. I am considering a total rewrite of the widget, maybe as a gadget version as Argh suggested. If you want to patch it yourself I am here of course if you have questions.

@el_matarife:
Yay nice idea, will do...
User avatar
quantum
Posts: 590
Joined: 19 Sep 2006, 22:48

Re: Defense Range v3.7

Post by quantum »

I'm using trepan's Lua localizer script to generate the locals.

In BA/CA you could use onlyTargets to spot units that can only shoot at air. In XTA you could use badTargets to see which units prioritize air targets.

I think the units file is too much work to maintain. Modders can edit the widget anyway. They will probably only need to edit the checked target categories, no complex Lua required.
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Re: Defense Range v4.0

Post by very_bad_soldier »

Changed lot of internal stuff. I dared to call it 4.0. :mrgreen:

Because of the many changes there may be still some bugs left. Pointing those out would help me alot, thanks.

See first post for changelog.
el_matarife
Posts: 933
Joined: 27 Feb 2006, 02:04

Re: Defense Range v4.0

Post by el_matarife »

Anyway that you can get the explode and self D rings to show up on a building when you're placing it for construction? I'd love an option to always show those rings when you're placing buildings.

Also, can you add it as a button for enemies and allies so you don't have to grab at your keyboard when trying to find that out. It'd make it a lot easier to plan assaults too.
User avatar
Licho
Zero-K Developer
Posts: 3803
Joined: 19 May 2006, 19:13

Re: Defense Range v4.0

Post by Licho »

Error in UnitEnteredLos(): [string "LuaUI/Widgets/gui_defenserange.lua"]:850: attempt to perform arithmetic on local 'damage' (a nil value)
Removed widget: Defense Range v4.0

Error in UnitCreated(): [string "LuaUI/Widgets/gui_defenserange.lua"]:850: attempt to perform arithmetic on local 'damage' (a nil value)
Removed widget: Defense Range v4.0
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Re: Defense Range v4.0

Post by very_bad_soldier »

Thanks Licho. That one was a CA specific issue. Its fixed now (and attached). I also added green ghosted buildings for nano frames aka buildings under construction and adapted the color configuration for CA:

(the values are dps of the weapon)
For Ground:
Minimum = 60 = Red
Maximum = 350 = Yellow

For Air:
Minimum = 60 = Green
Maximum = 400 = Blue

I hope this a are good values but its not hard to change them though.
Attachments
gui_defenseRange.lua
DefenseRange 4.1
(33.95 KiB) Downloaded 52 times
User avatar
Hoi
Posts: 2917
Joined: 13 May 2008, 16:51

Re: Defense Range v4.0

Post by Hoi »

could you make the values dynamic?
User avatar
Licho
Zero-K Developer
Posts: 3803
Joined: 19 May 2006, 19:13

Re: Defense Range v4.0

Post by Licho »

Thx for the fix :)
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Defense Range v4.0

Post by CarRepairer »

Hey, verybadsoldier. I made a ticket on caspring about the widget. Apparently you are setting gl.blending somewhere and you need to turn it off. As I can't live without defenseranges, you must fix! :-)

http://trac.caspring.org/ticket/709
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Re: Defense Range v4.0

Post by very_bad_soldier »

Damn, sorry :| But I was not able to reproduce. The only calls to gl.Blending were in the function DrawGhosts, so only got called when drawing ghosts for nanoframes.
But since they were useless anyway and were only still there by mistake they are totally gone now, maybe have try.
If you still got the same error maybe you could supply further information on how to reproduce?

Glad you like it :-) And thanks for error report, its hard to test all these stuff in single player mode :/
Attachments
gui_defenseRange.lua
DR 4.11
(33.92 KiB) Downloaded 154 times
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Re: Defense Range v4.0

Post by very_bad_soldier »

Did it help? Any more bugs?
User avatar
Licho
Zero-K Developer
Posts: 3803
Joined: 19 May 2006, 19:13

Re: Defense Range v4.0

Post by Licho »

It seems to have helped :) Works fine now..
User avatar
manolo_
Posts: 1370
Joined: 01 Jul 2008, 00:08

Re: Defense Range v4.11

Post by manolo_ »

hi, could u fix it for nota (didnt test it with 4.11 yet)?
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Re: Defense Range v4.11

Post by very_bad_soldier »

Just ask if you have probs to make it work with a mod. Maybe I can even take a look at it, but you will have to explain how you can distinguish between air and ground firing units.

Btw.: The green ghosted buildings are buggy, they dont disappear. I will upload a fixed version maybe later when I did some tests.
User avatar
REVENGE
Posts: 2382
Joined: 24 Aug 2006, 06:13

Re: Defense Range v4.11

Post by REVENGE »

Hmm, I can't seem to get the unitlist file to work. I add an entry for my unit, but the unit is never marked or shown.
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Re: Defense Range v4.11

Post by very_bad_soldier »

Hm, you have set useUnitFile to "true" in the widget right? If its so, you could send me your unitFile and I take a look. Maybe its a bug since its not tested very well. Please send to robin at dronezone.de

btw, which mod is it?
User avatar
REVENGE
Posts: 2382
Joined: 24 Aug 2006, 06:13

Re: Defense Range v4.11

Post by REVENGE »

very_bad_soldier wrote:Hm, you have set useUnitFile to "true" in the widget right? If its so, you could send me your unitFile and I take a look. Maybe its a bug since its not tested very well. Please send to robin at dronezone.de

btw, which mod is it?
I'm trying to adapt your widget for use with War Evolution. I've set useUnitFile to true.

Here's the unitFile:

Code: Select all

unitList["cutter"] = { 1, "Cutter"}

--Fill this list with your units
-- First column is the type:
-- 1	Ground
-- 2	Air
-- 3  AntiNuke
-- 4	Ground + Air capable

-- Second column is the marker column
-- put in "nil" to not use markers
-- or put in "AntiNuke" to label the marker AntiNuke


--example entries
--unitList["armllt"] = { 1, nil}
--unitList["armsilo"] = { 1, "Nukee"}
Post Reply

Return to “Lua Scripts”