Page 1 of 1

Ammunition Resource sytem

Posted: 16 Nov 2007, 19:08
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.

Posted: 16 Nov 2007, 21:09
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.

Posted: 18 Nov 2007, 19:53
by bobthedinosaur
so using lua's detection other than a cob's id checker should save alot of system resources, correct?

Posted: 18 Nov 2007, 20:05
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.

Posted: 18 Nov 2007, 20:20
by imbaczek
trepan: exactly what I had in mind, couldn't be bothered to look up the details.

Posted: 06 Dec 2007, 03:39
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

Posted: 06 Dec 2007, 20:31
by bobthedinosaur
thanks rattle, bout how would i go about making other units detect a unit specific var within there radius?