Ammunition Resource sytem

Ammunition Resource sytem

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

Moderator: Moderators

Post Reply
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Ammunition Resource sytem

Post by bobthedinosaur »

hello,
me and archangle are currently working on an ammo system for the battle tech mod but we have yet to decide on anything working yet.

here is what i am asking him for lua wise but i would like some advice on if this is feasible and if there might be better ways to do this.
all i need is a lua that allows for some kind of special "flag" in any units cob to be detected (with in specified range) and changed from a 'control unit' (the ammo trucks). i dont think it would use alot of resources since the only units detecting flags with in the radius would be ammo vehicles.

heres how i can see it working. you build an ammo truck (or dude, what ever) and you tell him to patrol making at least one spot close to a ammo supply point (building) that has a flag(doesnt change) but tells the ammo truck its full again once it gets close enough (simulating refill at supply point and taking supplies to the lines) then the rest of the patrol can go thru the forces in what ever organization necessary detecting units with 'load me up' like flags (a simple flag they throw when low on ammo that can be deteerminded its script), and once their flag is changed by the 'control unit' (ammo truck) the units automatically refill them selves (im thinking not cycling, but only when firing detect if they are empty which wont fire at all, or have been reloaded and then can fire and reset the ammo count therefore reducing computer resources on all units cycling detection on ammo refill status). and the ammo trucks reduce a count every time they detect and change a 'need' flag to 'refill' (maybe allow the flags to have 3 settings: dectable needed, ignored refill, to tell units to refill once, and good, which is nill to detection and the units using the flags as well) so they can only refit so many and are forced to return to ammo points (so a way to jam the detection and changing flags similar to jamming weapons is necessary).
does this sound simple enough to make a ammunition resource system work?

oh yeah this is would be just the very basics, a full working version would probably have low ammunition indicator guis and what not, but we arent to concerned with that now.
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Post by imbaczek »

It's doable in pure COB, and has been since some time in svn (two weeks?)

check the changelog or ask trepan. Lua usage would still be desirable so you don't have to check for ALL units (or all unit ids from 1 to MAX_ID), just those in range.
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Post by bobthedinosaur »

so using lua's detection other than a cob's id checker should save alot of system resources, correct?
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

Lua has spatial unit call-outs (ex: Spring.GetUnitsInCylinder()),
that's probably the part that imbaczek is talking about. The recently
added COB unit/team/allyteam/global variables may also come in
handy.
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Post by imbaczek »

trepan: exactly what I had in mind, couldn't be bothered to look up the details.
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

I'm quite sure this can be done without or much Lua at all.
http://spring.clan-sy.com/phpbb/viewtop ... 702#238702
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Post by bobthedinosaur »

thanks rattle, bout how would i go about making other units detect a unit specific var within there radius?
Post Reply

Return to “Lua Scripts”