Home » MODDING HQ 1.13 » Flugente's Magika Workshop » New feature: Equip militia with guns/armour/etc.
New feature: Equip militia with guns/armour/etc.[message #315664]
|
Sat, 23 February 2013 19:20
|
|
Flugente |
|
Messages:3507
Registered:April 2009 Location: Germany |
|
|
Equip militia with guns/armour/etc.
Hi,
while answering why Feature Request: Equiping Militia through salvaged weapons/armor/etc is not doable, I realised it might be doable after all. So I did.
This feature allows you to equip militia. To be precise, militia will simply take its items from the sector inventory instead of generating it according to the xmls.
This allows you to give them gear that is way above what they would normally get - but this also means that if you don't provide any gear, then the militia wont have any. Plus any gear they use, you cannot use at the same time(duh...).
Simply activate this feature, drop gear in a sector, and spawn militia there. If you enter this sector (tactical), you will see that the militia uses your stuff. But in the strategic map, the gear isn't there any more, as the militia took it. If you leave the sector, they will put it back.
You can also 'inspect' militia in tactical, this will cause them to drop all gear they took from the sector.
As people will propably demand it anyway (because they cannot handle 'real' logistics ), one can finetune which parts of militia gear should still be generated randomly, and which ones are taken from the sector.
Note that this feature requires you to support your militia. If you do not restock their ammo, they will eventually run dry. The amount of ammo militia takes can be determined by the ini settings (MILITIA_USE_SECTOR_EQUIPMENT_AMMO_MIN ff). This is used to determine the optimal amount of ammo a gun 'requires', if there is less ammo, we can still take it, but its less likely. As a result, the militia will likely prefer a 1911 with 100 bullets over an M16 with 10 bullets.
As you might be afraid that the militia will take your best ammo and use it uselessly, you can forbid it from using certain items. Open the sector inventory and leftclick on an item while holding 'TAB'. This toggles it, if the colour is green, the militia will not take this item from the sector (it can still steal it in tactical though). This even works in sectors where you currently have no mercs. With MILITIA_USE_SECTOR_EQUIPMENT_CLASS_SPECIFIC_TABOOS set to TRUE, this can be finetuned even more to forbid items for specific militia classes.
Ini settings: Toggle Spoiler
[Militia Equipment Settings]
;******************************************************************************************************************************
; These settings control the how militia can equip itslef from sector inventories
;******************************************************************************************************************************
;------------------------------------------------------------------------------------------------------------------------------
; Militia gear will not be randomly generated, but taken from the sector the militia is currently stationed in.
;
; This applies to both tactical and strategic combat.
; Once a sector gets unloaded, the militia will drop the equipment taken again into the sector.
; Gear can be manually dropped in tactical via the 'Ctrl' + '.'-menu, item 'militia inspection'.
; Gear can be prohibited to the militia by hovering over it in the strategic inventory and pressing 'TAB' + 'LMB'. This also works
; if no mercs are present in that sector.
; If militia reinforces a sector, they will take their gear along.
; Mobile militia get their initial gear from the sector they were trained in, after that they take their gear with them if they move on the map.
; It is up to the player to sufficiently distribute gear to his militia (by leaving items in the sector that militia are in).
;------------------------------------------------------------------------------------------------------------------------------
; if set to true, militia will take parts of its equipment from a sector's inventory.
MILITIA_USE_SECTOR_EQUIPMENT = TRUE
; determines wether militia picks helmets, vests and leg armour from the sector.
MILITIA_USE_SECTOR_EQUIPMENT_ARMOUR = TRUE
; determines wether militia takes NVGs, sungoggles and gasmasks from the sector.
MILITIA_USE_SECTOR_EQUIPMENT_FACE = TRUE
; determines wether militia takes knifes and punch weapons from the sector
MILITIA_USE_SECTOR_EQUIPMENT_MELEE = TRUE
; determines wether militia takes guns from the sector
MILITIA_USE_SECTOR_EQUIPMENT_GUN = TRUE
; determines wether militia takes ammo from the sector. Requires MILITIA_USE_SECTOR_EQUIPMENT_GUN to be true.
; If this is set to false fitting ammo will be spawned in the traditional way, but not be dropped
; If this is set to TRUE, make sure to occasionally restock ammo for your militia.
MILITIA_USE_SECTOR_EQUIPMENT_AMMO = TRUE
; determines wether militia takes grenades from the sector, it will take up to 2 grenades of one type
MILITIA_USE_SECTOR_EQUIPMENT_GRENADE = TRUE
; determines wether militia takes LAWs, mortars, RPGs or grenade launchers from the sector
MILITIA_USE_SECTOR_EQUIPMENT_LAUNCHER = TRUE
; the number of bullets deemed sufficient for a gun is
; max(MILITIA_USE_SECTOR_EQUIPMENT_AMMO_MIN, min(MILITIA_USE_SECTOR_EQUIPMENT_AMMO_MAX, MILITIA_USE_SECTOR_EQUIPMENT_AMMO_OPTIMAL_MAG_COUNT * magazine size))
; if there is less ammo for a gun than this in a sector, we at first look for other guns, but can still select this one if none have enough ammo
MILITIA_USE_SECTOR_EQUIPMENT_AMMO_MIN = 10
MILITIA_USE_SECTOR_EQUIPMENT_AMMO_MAX = 200
MILITIA_USE_SECTOR_EQUIPMENT_AMMO_OPTIMAL_MAG_COUNT = 2
A few demo pics:
We drop a few M4's, spectra vests, steel helmets and M79's in drassen mine and train militia...
... and the militia takes those items when we are in tatical...
Of course, those items are gone in strategic.
With such an improvement, the green militia is rather helpful, even in autoresolve.
Drop militia gear with this. No, I dont care about the box being to short, as our dialogue system is a pain.
We train mobiles in a neighbouring sector, they take this along.
And pretty much own a patrol twice their size with it.
Items with a turquoise overlay will not be selected by green militia.
New (6026): Any militia can pick up the PMM. The commando has a turqoise layer and can not be equipped by green militia. The purple HK53 can only be equipped by Elite militia, while the MP5 is taboo for all of them. This state is even retained after they drop it again (so an Elite-only sniper rifle stays elite-only).
This is in the trunk since r5869/GameDir r1606.
wARNING: THIS WILL BREAK SAVEGAME COMPATIBILITY!
[Updated on: Sat, 27 April 2013 03:03] by Moderator Report message to a moderator
|
|
|
|
Re: New feature: Equip militia with guns/armour/etc.[message #315666]
|
Sat, 23 February 2013 19:45
|
|
Hazapuza |
|
Messages:262
Registered:February 2009 Location: Finland |
|
|
Well, that was fast. And awesome.
:bow:
[Updated on: Sat, 23 February 2013 19:46] by Moderator Report message to a moderator
|
Master Sergeant
|
|
|
Re: New feature: Equip militia with guns/armour/etc.[message #315667]
|
Sat, 23 February 2013 20:11
|
|
Sam Hotte |
|
Messages:1965
Registered:March 2009 Location: Middle of Germany |
|
|
:super:
Thx for doing this.
Flugente As people will propably demand it anyway (because they cannot handle 'real' logistics ), one can finetune which parts of militia gear should still be generated randomly, and which ones are taken from the sector.
1. Just to make sure:
For any 'MILITIA_USE_SECTOR_EQUIPMENT_x = FALSE' this type of equipment gets spawned in militia's inventory according to the current rules (randomness, progression etc.)?
2. So if i e.g. wanted militia to not use grenades at all, i had to set this to true in ini and "disable" all nades in a given sector?
Quote:As you might be afraid that the militia will take your best ammo and use it uselessly, you can forbid it from using certain items. open the sector inventory and leftclick on an item while holding 'TAB'. This toggles it, if the colour is green, the militia will not take this item from the sector (it can still steal it in tactical though). This even works in sectors where you currently have no mercs.
3. Was this default (militia uses everything unless explicitly forbidden) chosen by some coding/programming restrictions?
Because it might be less "work" for players, who really wants to control what militia uses, if default was other way round; player has to explicitly enable everything militia may use.
(Assuming that players who do not want to control this perhaps tend to just not use this feature at all anyway)
Report message to a moderator
|
Sergeant Major
|
|
|
|
|
|
|
Re: New feature: Equip militia with guns/armour/etc.[message #315673]
|
Sun, 24 February 2013 03:46
|
|
Flugente |
|
Messages:3507
Registered:April 2009 Location: Germany |
|
|
Sam_Hotte:super:
Thx for doing this.
Flugente As people will propably demand it anyway (because they cannot handle 'real' logistics ), one can finetune which parts of militia gear should still be generated randomly, and which ones are taken from the sector.
1. Just to make sure:
For any 'MILITIA_USE_SECTOR_EQUIPMENT_x = FALSE' this type of equipment gets spawned in militia's inventory according to the current rules (randomness, progression etc.)?
Yes. In the special case that MILITIA_USE_SECTOR_EQUIPMENT_GUN = TRUE and MILITIA_USE_SECTOR_EQUIPMENT_AMMO = FALSE, ammo fitting to the gun will be spawned according to the randomness rules. However this ammo will not spawn when militia drops inventory, to forbid an otherwise obvios exploit. This incldues the gun itself, the gun will drop empty.
Sam_Hotte
2. So if i e.g. wanted militia to not use grenades at all, i had to set this to true in ini and "disable" all nades in a given sector?
Yes. Apart from grenades they steal from the sector, this is a pretty definite way to forbid militia grenade use.
Sam_Hotte
Quote:As you might be afraid that the militia will take your best ammo and use it uselessly, you can forbid it from using certain items. open the sector inventory and leftclick on an item while holding 'TAB'. This toggles it, if the colour is green, the militia will not take this item from the sector (it can still steal it in tactical though). This even works in sectors where you currently have no mercs.
3. Was this default (militia uses everything unless explicitly forbidden) chosen by some coding/programming restrictions?
Because it might be less "work" for players, who really wants to control what militia uses, if default was other way round; player has to explicitly enable everything militia may use.
(Assuming that players who do not want to control this perhaps tend to just not use this feature at all anyway)
I see it differently: Apart from your HQ, player's will propably only leave behind what they want to give to the militia anyway. Perhaps apart from restock for their nearby combat squads. Thus it is way easier to block those few items. Otherwise you'd always have to manually 'unlock' their gear - which sucks for dozens of sectors with each 20+ militias.
Note that as the items militia selects will be returned to the inventory after your unload the sector, it isn't that much of a problem if militia picks one of your ultracool guns - it is returned to you anyway.
Note that one can not exploit this feature by setting it off, spawning militia, saving+exiting the game, turning on the feature, and then taking free guns upon unloading the sector. The militia remembers which items it took from your inventory and will only put those back.
However, this also applies to items they steal in tactical, they are still lost.
[Updated on: Sun, 24 February 2013 04:42] by Moderator Report message to a moderator
|
|
|
|
|
|
|
|
Re: New feature: Equip militia with guns/armour/etc.[message #315687]
|
Sun, 24 February 2013 15:37
|
|
Flugente |
|
Messages:3507
Registered:April 2009 Location: Germany |
|
|
DeaneWill they touches stuff from BR then? I usually buys my stuff in bulks .. then after opening the crates.. do I have to manually mark them so they dont touch them?
As DepressivesBrot says, once you open the crate, these items can be accessed normally, and thus can also be picked by militia. Items that are still in crates/furniture/whatever are not yet reachable, thus they cannot be accessed by militia. Rule of thumb: if you can see an item in strategic inventory and access it, the militia can too.
As this question will propably come up anyway soon, here's how militia selects an item:
We loop over all items in the sector that are reachable and no 'taboo' for militia. Every item of a category we search for (helmets, guns, grenades etc.) gets a fitness value. For everything except guns/launchers, we simply pick the item with the highest value at the end.
For guns/launchers, we only do that if we find enough ammo, otherwise we do a second loop and re-evaluate - this time multiplying a gun's fitness with number of bullets found/number of optimal bullets.
How does this fitness function work? This is how (pseudocode):
Toggle Spoiler
if ( armour )
return protection * coverage * status
else (face item )
{
if (gasmask)
return status
else if (hearingbonus)
return hearingbonus
else if (nighttime)
return nightvisionbonus
else
return dayvisionbonus
}
else if (knife/punchweapon)
return damagevalue * status
else if (gun or launcher)
{
return damage * range * firing rate * (10 + accuraccy)/10 * (10 + number of attachemnts)/10 * status
}
else
return coolness * status
An item only has to compete with other items of that same category, naturally.
While I know that this only a very short and debatable way of selection (we have entire threads dedicated to the question wether a gu is better than another gun), this is enough imho to make the militia select fitting gear for its purpose.
Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: New feature: Equip militia with guns/armour/etc.[message #315768]
|
Wed, 27 February 2013 04:45
|
|
Lord Leperman |
|
Messages:31
Registered:February 2006 |
|
|
Sorry I wasn't clear. Here's what I did in order:
-Trained green militia in Drassen(.ini setting at 4).
-Ordered equipment from BR for militia.
-Opened shipping box so militia can access it.
-Attacked 2nd Drassen sector, militia took gear from the airport and have them equipped on the 2nd sector.
-2nd sector won, and some recruits got promoted.
-Invaded 3rd sector of Drassen(Mine district)and called for militia reinforcements.
-Noticed that militia weren't armed with anything anymore.
-Checked inventory areas in the first 2 sectors, all the gear I purchased for the militia is gone. Basically, the gear disappeared.
The same thing happens when militia already took the gear.
-Militia "A" takes M16 to defend sector.
-Sector won, and militia A has M16 equipped.
-Go to next sector, same militia doesn't have M16
-M16 is also missing from the inventory of the sector he came from.
The only work around I found is to have the militia drop all their gear after every battle, so they will be able to take the gear again when going to the next battle. The game doesn't seem to remember what exact gear the militia was carrying before going to the next battle unless you have them drop the gear first.
I guess what I want to know is, does the game remember what gear each militia is carrying throughout the game and not just on a battle-per-battle basis?
Oh, btw. I love this new mod of yours. I've been dreaming of having arm my militia by myself. Thanks for making this dream come true
[Updated on: Wed, 27 February 2013 05:02] by Moderator Report message to a moderator
|
Private 1st Class
|
|
|
Re: New feature: Equip militia with guns/armour/etc.[message #315776]
|
Wed, 27 February 2013 21:23
|
|
Flugente |
|
Messages:3507
Registered:April 2009 Location: Germany |
|
|
Ah, now I see. The error is this: when moving to the next sector in strategic screen, we somehow unload the current sector differently. As a result, my function that causes militia in the current sector to drop any equipment they took is not called, and their stuff gets lost.
However, if you go to the next sector in tactical (go to edge of sector and manually go to next sector), everything works fine... which is exactly what I did in my tests
Should be easy to fix, I'll report after dinner.
Edit: Fixed in r5878.
Lord LepermanI guess what I want to know is, does the game remember what gear each militia is carrying throughout the game and not just on a battle-per-battle basis?
That would be theoretically possible, but would be very bad for reasons discussed in Feature Request: Equiping Militia through salvaged weapons/armor/etc. We do not know any soldier (except our own 32) outside of the current sector, and changing that leads to numerous headaches. The solution I did here is much simpler and friendlier on resources.
[Updated on: Wed, 27 February 2013 21:54] by Moderator Report message to a moderator
|
|
|
|
|
|
Re: New feature: Equip militia with guns/armour/etc.[message #315807]
|
Fri, 01 March 2013 14:34
|
|
sikiter |
|
Messages:11
Registered:December 2010 |
|
|
hi guys. i can't figure out how to do this. i was a big fan 1.13 mod. i was playing aimnas, 3-4 month ago. than i saw this post. i try to make it but i can't. please explain this for me. can i play this feature an spy mod in aimnas? and how????
sorry about my poor english.
[Updated on: Fri, 01 March 2013 14:37] by Moderator Report message to a moderator
|
Private
|
|
|
Re: New feature: Equip militia with guns/armour/etc.[message #315808]
|
Fri, 01 March 2013 14:53
|
|
Sam Hotte |
|
Messages:1965
Registered:March 2009 Location: Middle of Germany |
|
|
Welcome to the pit.
No you cannot have this with AIMNAS unless newer version of AIMNAS incorporating this might be published (perhaps another easter release might come soon?).
To have this (and spies and everything Flugente has committed yet) with plain 1.13 to beta-test it, just get newest SCI from Depri (link in my Sig) as soon as he has done one having version 5880 or above.
[Updated on: Fri, 01 March 2013 14:53] by Moderator Report message to a moderator
|
Sergeant Major
|
|
|
|
|
|
|
|
|
Re: New feature: Equip militia with guns/armour/etc.[message #316051]
|
Thu, 07 March 2013 21:15
|
|
Flugente |
|
Messages:3507
Registered:April 2009 Location: Germany |
|
|
ZombiehunterThis is a great feature really adds some new roleplay and strategic aspects to the game, always wanted to equip my own little army =)
But now let's see if I got this right.
For my town militia I basicly need a militia armory so to speak in every town sector, while the mobile militias I train take the equipment from the town sector I trained them in and they keep the equipment they took from there until they get killed or I order them to drop that stuff, right?
Mostly right. Mobiles take gear from the sector they were trained in, and whenever mobiles move, they take gear from the sector they were to the sector they are going. This isn't necessarily the same gear. If a .38 armed mobile travels to a sector with an M16, he'll switch to the M16 (provided there is enough ammo of course). So in a way, they are always looking for better gear to restock.
ZombiehunterBut wouldn't it make things easier if the town militia would behave likewise? Then there would be no need to drop 15 AR's, Helmets, Vests and ammo in every town sector for example.
The problem here is that one can redistribute militia in towns, and it would be relatively weird codewise to move gear from here to there, and back, and whatnot. This would also cause headaches if you redistribute militia from your HQ town sector if that one is currently loaded, and you forgot to command them to drop all - they would move gear, which would frustrate player's who forgot about this
Note that if they reinforce in combat, even town militia still take gear along, which is a major point of this.
ZombiehunterAnd another question, when the Mobiles run out of ammo will they restock in the sector they're currently, given that there is matching ammo for their respective guns? Yes, see first answer.
Report message to a moderator
|
|
|
|
|
|
|
Re: New feature: Equip militia with guns/armour/etc.[message #316268]
|
Fri, 15 March 2013 00:48
|
|
jmenya |
|
Messages:5
Registered:March 2013 |
|
|
Unfortunately no.. Situation is following: 10 green miliita in drassen. armed with 10 colts commando. Autobattle - 9 dead, all commando remains. Battle together with merks (tactical) - 1 dead, 2 promoted to regulars. After battle in inventory 8 commando. re armor and other i dont know - too much in inventory to check. Same happened already 3 times, i have only drassen, only 10 millitia and very bad choose of weapons. so noticed subject problem quickly - could not arm some merks after battle, as their main weapons were provided to militia and dissapeared. .exe 5917, 1620.
and yes - i checked. first inspected militia, than moved to different sector (to be sure).
[Updated on: Fri, 15 March 2013 00:52] by Moderator Report message to a moderator
|
Private
|
|
|
Goto Forum:
Current Time: Sun Dec 01 07:02:25 GMT+2 2024
Total time taken to generate the page: 0.02215 seconds
|