Antinuke Rocket Autobuild

Antinuke Rocket Autobuild

Classic game design, maintained to please you...

Moderator: Content Developer

User avatar
mildarf
Posts: 33
Joined: 04 Jul 2009, 19:40

Antinuke Rocket Autobuild

Post by mildarf »

I want to antinuke must have 3 rockets always. If enemy attack me with nuke, antinuke spend 1 rocket and automaticaly begin to create 1 more. And not need to check load antinuke.
I think that need to make a minimal threshold for nuke and antinuke?
Can you realize this?
Regret
Posts: 2086
Joined: 18 Aug 2007, 19:04

Re: Antinuke Rocket Autobuild

Post by Regret »

No.
User avatar
Jazcash
Posts: 5309
Joined: 08 Dec 2007, 17:39

Re: Antinuke Rocket Autobuild

Post by Jazcash »

I have stockpiler widget which automatically adds 100 nukes and anti-nukes to each silo when built.
User avatar
troycheek
Posts: 80
Joined: 22 May 2009, 19:13

Re: Antinuke Rocket Autobuild

Post by troycheek »

I was working on something similar when I noticed the one that just stockpiles 100, so I just went with that.

The only benefit I can see for mildarf's version is that stockpiling 100 instead of 3 can take a fair chunk of your resources for a fair amount of time. On the other hand, I'd hate to lose most of my economy because I had one too few anti nukes.

On the other other hand, this shouldn't be too difficult...

Here we go. This widget monitors units that can stockpile and adds orders to stockpile more whenever they fall below a certain level. Change line 26 local stockpile = 3 to whatever you want that level to be.
Attachments
unit_stockpile_dynamic.lua
Keeps all units that can stockpile topped off automatically.
(2.01 KiB) Downloaded 114 times
User avatar
Niobium
Posts: 456
Joined: 07 Dec 2008, 02:35

Re: Antinuke Rocket Autobuild

Post by Niobium »

widget:StockpileChanged(unitID, unitDefID, unitTeam, weaponNum, oldCount, newCount)

Makes it heaps easier :D
User avatar
mildarf
Posts: 33
Joined: 04 Jul 2009, 19:40

Re: Antinuke Rocket Autobuild

Post by mildarf »

2 troycheek:
Thanks. Where this file must be placed?
SirMaverick
Posts: 834
Joined: 19 May 2009, 21:10

Re: Antinuke Rocket Autobuild

Post by SirMaverick »

mildarf wrote:Where this file must be placed?
<Spring-Directory>/LuaUI/Widgets/
User avatar
BrainDamage
Lobby Developer
Posts: 1164
Joined: 25 Sep 2006, 13:56

Re: Antinuke Rocket Autobuild

Post by BrainDamage »

I made a better version, only thing that it misses is that I don't know how to remove the 100 stockpile items when you capture/recieve an unit
Attachments
unit_stockpile_dynamic.lua
(3.32 KiB) Downloaded 119 times
SirMaverick
Posts: 834
Joined: 19 May 2009, 21:10

Re: Antinuke Rocket Autobuild

Post by SirMaverick »

Optimized Brain Damage's version:
Uses ctr + shift to issue less commands.
Uses "right" as command option to cancel excess.
Attachments
unit_stockpile_dynamic.lua
(4.78 KiB) Downloaded 111 times
User avatar
manolo_
Posts: 1370
Joined: 01 Jul 2008, 00:08

Re: Antinuke Rocket Autobuild

Post by manolo_ »

cool, talked to grapefruit about that and he was making the same :) (or tries to :D )
User avatar
manolo_
Posts: 1370
Joined: 01 Jul 2008, 00:08

Re: Antinuke Rocket Autobuild

Post by manolo_ »

manolo_ wrote:cool, talked to grapefruit about that and he was making the same :) (or tries to :D )

edit: so summing up, that widget keeps the stockpile at a constant predefinied amount (what does ctrl or shift do?)
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Re: Antinuke Rocket Autobuild

Post by very_bad_soldier »

Brain Damage wrote:I made a better version, only thing that it misses is that I don't know how to remove the 100 stockpile items when you capture/recieve an unit

Code: Select all

Spring.SendCommands{"luaui disablewidget Stockpiler"} -- Disable the old stockpiler widget which could conflict
This line makes my spring.exe freeze on "Loading LuaUI" if Stockpiler is already disabled.
User avatar
troycheek
Posts: 80
Joined: 22 May 2009, 19:13

Re: Antinuke Rocket Autobuild

Post by troycheek »

SirMaverick wrote:Optimized Brain Damage's version:
Uses ctr + shift to issue less commands.
I'd considered that, but then decided that if you're stockpiling large amounts, you'd probably be better off using trepan's old "just add 100" widget. I mean, I think the whole point of this widget is to keep a small stockpile to conserve resources. I think.

(If you need more than 100 nukes or anti nukes or anything else that can be stockpiled, you're probably doing something wrong.)

Niobium: I found StockpileChanged after I already had it working the other way, naturally. Some day soon, I'm going to have to alphabetize or otherwise organize that wiki more to my liking. My latest revision is enough like the others that I'm not going to bother releasing it. Just another interesting little programming exercise.
SirMaverick
Posts: 834
Joined: 19 May 2009, 21:10

Re: Antinuke Rocket Autobuild

Post by SirMaverick »

very_bad_soldier wrote:

Code: Select all

Spring.SendCommands{"luaui disablewidget Stockpiler"} -- Disable the old stockpiler widget which could conflict
This line makes my spring.exe freeze on "Loading LuaUI" if Stockpiler is already disabled.
Spring version? I don't have any problems with 0.79.1.2 (single thread).
SirMaverick
Posts: 834
Joined: 19 May 2009, 21:10

Re: Antinuke Rocket Autobuild

Post by SirMaverick »

troycheek wrote:
SirMaverick wrote:Optimized Brain Damage's version:
Uses ctr + shift to issue less commands.
I'd considered that, but then decided that if you're stockpiling large amounts, you'd probably be better off using trepan's old "just add 100" widget. I mean, I think the whole point of this widget is to keep a small stockpile to conserve resources. I think.
The point of this widget is to keep the stockpile at a certain number. This number is defined by the user.
User avatar
manolo_
Posts: 1370
Joined: 01 Jul 2008, 00:08

Re: Antinuke Rocket Autobuild

Post by manolo_ »

so what is the difference between troys and bd/sirs widget?
and sir mav what did u ment with ctrl+shift...?
SirMaverick
Posts: 834
Joined: 19 May 2009, 21:10

Re: Antinuke Rocket Autobuild

Post by SirMaverick »

manolo_ wrote:so what is the difference between troys and bd/sirs widget?
in short: every of those stockpiles 3 anti nukes.

troys: stock pile up to the number defined in the widget (default 3)

bd: like toys
+ stock pile can be changed ingame: "/luaui stockpilecount 100" (the number is saved in spring settings and will be restored in the next game)

mine: like bd's
+ fix when you disable and reenable the widget ingame
and sir mav what did u ment with ctrl+shift...?
Implementation details. There are no differences for the user.
User avatar
manolo_
Posts: 1370
Joined: 01 Jul 2008, 00:08

Re: Antinuke Rocket Autobuild

Post by manolo_ »

i dont want to bind /luaui stockpilecount 100 to a key, so how could i change it without modify the widget itself?
User avatar
troycheek
Posts: 80
Joined: 22 May 2009, 19:13

Re: Antinuke Rocket Autobuild

Post by troycheek »

manolo_ wrote:[(what does ctrl or shift do?)
If you hold down shift when left clicking to add to the stockpile, it adds 5 instead of just 1. When you hold down ctrl, it adds 20. Both together adds 100. (Same when giving factories build orders.) Right clicking while holding those keys takes the same number away. This works for orders issued by the player and for orders issued by widgets if you do it right.

So if you wanted to add 127 stockpiled anti nukes as efficiently as possible, you'd shift-ctrl-click, ctrl-click, shift-click, click, click. Or something like that.
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Re: Antinuke Rocket Autobuild

Post by very_bad_soldier »

SirMaverick wrote:
very_bad_soldier wrote:

Code: Select all

Spring.SendCommands{"luaui disablewidget Stockpiler"} -- Disable the old stockpiler widget which could conflict
This line makes my spring.exe freeze on "Loading LuaUI" if Stockpiler is already disabled.
Spring version? I don't have any problems with 0.79.1.2 (single thread).
Yeah same version here. It's strange, dont know, absolutely reproducable for me. Can't run it two times in a row, spring doesn't start anymore after the widget disabled originalStockpile once. Have to out-comment that line or enable origStockpiler again (makes me able to run it one more time).
Besides that, great widget! :mrgreen:

@manolo:
Just type that command in chat.
Post Reply

Return to “Balanced Annihilation”