Simple auto group

Simple auto group

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

Moderator: Moderators

User avatar
Licho
Zero-K Developer
Posts: 3803
Joined: 19 May 2006, 19:13

Simple auto group

Post by Licho »

Auto Group
========
http://widgets.licho.eu/unit_auto_group.lua

- This simple widget automatically puts your newly built units into groups based on unit type.
To setup auto group, select units and press ctrl+alt+0-9. New units of types selected will be automatically added to group with that number.

That way you can simply make auto group 1 with assault units, group 2 with artilery, group 3 with fighters and scouts etc..

Transport assist tweak
===============
http://widgets.licho.eu/unit_transport_assist.lua

- I modified this widget (originally by Ray) which transports units from factory to factory's waypoint.

- transports are now using area unload to prevent stucks

- all units that are about to be picked by any transport will be stopped (to prevent endless chases)

- workers are no longer transported (to make plugin compatible with factory guard)
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

FYI:
The SVN lua interface provides SetUnitGroup(), which removes
the necessity of using the Spring.SelectUnitsByValues() call. That
select call cancels multipart commands (such as move fronts).
User avatar
Licho
Zero-K Developer
Posts: 3803
Joined: 19 May 2006, 19:13

Post by Licho »

Ahh, thats nice, I will upgrade it as soon as spring is released :)
User avatar
BrainDamage
Lobby Developer
Posts: 1164
Joined: 25 Sep 2006, 13:56

Post by BrainDamage »

nice edit on the transport_assister widget ;)

i've found 2 probs with it:

1- the transport is idle, i build few units in a row, the building speed is faster than the speed for the transport to pick them, after the transport picked them all, it will come back guarding to the factory instead of unloading them, but if afterwards, i build only 1 tank, the transport will pick it up and go to the drop point and unload them all

2- the transport is flying over the drop point, i build few more units; the transport will unload only 1 unit, then it will come back picking the new units and go back to the drop point and unload them all (only if there are no new units to pick)
Tim-the-maniac
Posts: 250
Joined: 22 Jul 2006, 19:58

Post by Tim-the-maniac »

Yeah the modified transport assister widget doesnt seem to work anymore
User avatar
Licho
Zero-K Developer
Posts: 3803
Joined: 19 May 2006, 19:13

Post by Licho »

This is how original transport assist works for me too :-(

I will try to modify it .. in fact I wanted to fix those bugs and improve it so that units dont wait for transport endlessly - they should be free to go if they are waiting longer than a minute.

And transport should skip units that are already more than some distance from original factory.
User avatar
BrainDamage
Lobby Developer
Posts: 1164
Joined: 25 Sep 2006, 13:56

Post by BrainDamage »

to check when/if the transport must que the load_units command before or after the unload how about this condition:

if actual distance of the transporter to the dropping point is less than 1/4 of of the total distance, then add to the top of the que the loading order

if the distance is longer, then add to the bottom (before the guard command)
User avatar
Licho
Zero-K Developer
Posts: 3803
Joined: 19 May 2006, 19:13

Post by Licho »

Problem is - how to determine whether transport is not full (and can accept queue orders before guard) and when it's full and must unload first?
User avatar
stilicho
Posts: 46
Joined: 21 Mar 2007, 02:49

Post by stilicho »

The auto group widget is very useful. Thanks.
User avatar
1v0ry_k1ng
Posts: 4656
Joined: 10 Mar 2006, 10:24

Post by 1v0ry_k1ng »

would it be possible to make the autogroup remember unit type groups between games? so you can assign a group to a unit type for every game?
User avatar
Licho
Zero-K Developer
Posts: 3803
Joined: 19 May 2006, 19:13

Post by Licho »

Sure, I can add that.
User avatar
Licho
Zero-K Developer
Posts: 3803
Joined: 19 May 2006, 19:13

Post by Licho »

Redownload the widget from the original link. It now persist grouping settings.
User avatar
1v0ry_k1ng
Posts: 4656
Joined: 10 Mar 2006, 10:24

Post by 1v0ry_k1ng »

awesome! thanks :)
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

The saved unit groups are strange, for different mods they behave completely strange and group units I never told it to.
User avatar
Licho
Zero-K Developer
Posts: 3803
Joined: 19 May 2006, 19:13

Post by Licho »

Widget updated for spring 75
CautionToTheWind
Posts: 272
Joined: 30 May 2006, 17:06

Post by CautionToTheWind »

Did you finish your fixes in Transport assist?
User avatar
Licho
Zero-K Developer
Posts: 3803
Joined: 19 May 2006, 19:13

Post by Licho »

Not yet
User avatar
stilicho
Posts: 46
Joined: 21 Mar 2007, 02:49

Post by stilicho »

The new version of the Auto Group widget doesn't work for me.

From infolog.txt

Creating sky
Spring 0.75b1
Reloaded ctrlpanel with: LuaUI/ctrlpanel.txt
LuaUI: bound F11 to the widget selector
LuaUI: bound CTRL+F11 to tweak mode
Failed to load: unit_auto_group.lua (Include() could not load 'LuaUI/Headers/spring.h.lua'
)
LuaUI v0.2
Player no name joined as 0


Am I missing a file in the Headers directory, and if so, where can I get it?
User avatar
stilicho
Posts: 46
Joined: 21 Mar 2007, 02:49

Post by stilicho »

I fixed my problem by reinstalling Spring 74b3 and copying the missing file from it's LuaUI\Headers folder.
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Post by very_bad_soldier »

Yes, same here. It seems that the files

LuaUI\Headers\opengl.h.lua
LuaUI\Headers\spring.h.lua

are missing. I couldn't use any custom lua widgets without them.

EDIT:
spring.h.lua is essential, but opengl.h.lua was also missing. I don't know if it is needed too.

BTW:
Thanks for the widgets, they are great!
Post Reply

Return to “Lua Scripts”