Home » MODDING HQ 1.13 » Flugente's Magika Workshop » New Feature: gear templates
New Feature: gear templates[message #350497] Mon, 07 August 2017 00:03 Go to next message
Flugente

 
Messages:3165
Registered:April 2009
Location: Germany
While equipping your mercs, using said equipment to murder people and then using that newly gained loot to further improve our equipment is fun, it can also become tedious. Especially with teams of a larger size, making sure everybody has what they need can take some time, especially after combat.
Armour might be damaged and needs replacement. Medkits are low. Grenades and ammo has been used. You get the idea.

To make that easier, smeagol and DepressivesBrot enthusiastically promoted an idea for several years I just as enthusiastically denied. But you know the saying: when in Bremen, do as the smeagol says. Unless his wife says otherwise big grin . But she didn't, so after this years con, we're here.
Anyway, this feature allows you to create a template from the gear the current merc has equipped. Such a template can than be loaded at anytime - the game will try to recreate the saved equipment template with items found in the sector inventory.
Depending on how elaborate these templates are, this could save you quite a bit of time.

A small demonstration:



  • As seen in the above video, we can simply create a template that stores the current merc's inventory via a button in the strategic inventory.
  • Templates are stored in \Profiles\UserProfile_whatever folder according to your vfs\GearTemplate. They are stored as .txt files. I've added an advanced template to SVN, too.
  • Templates are savegame-independent. You can create or use them whenever you like. You can also share them with others. Perhaps you have neat equipment ideas others would benefit from?
  • When we load a template, roughly the following happens:

    • 1. We drop any existing item in our merc inventory that would block a template item for that slot if the item exists in the sector in the first place. If the item is in an LBE slot, we drop all items in the slots of that LBE too.
    • 2. For each template entry, if the corresponding slot is empty, we pick the best item (best is determined by item status) from the sector inventory. If that fails for ammo, we search for other items in the sector containing the same bullets and create mags from that. So equipping from crates is not a problem. We also add attachments to LBE items at this point.
    • 3. We loop over our inventory, and for every item (not just those from the template) we try to find a better version from the sector, and exchange the two (this is similar to the Update gear function). If this is a stack of kits or ammo, we merge them before that. If the stack is not full, we add more items from the sector. We also try to improve all attachments with better versions (status) from the sector.
    • 4. We try to add attachments from the sector in the order they appear in the template if the template item is the same as is currently equipped, or if the template item is 0. This effectively allows us to use a wildcard, more on that later.
    • 5. We reload any gun and fill up any magazine. If the ammo is specified in the template, we try to use that. If the ammo does not fit (e.g. due to mag size modifiers), we use a more fitting ammo item.
  • Even if the template is empty (the game will create a Update Gear template), the above functions still run. An empty template will still try to replace all items with better versions, refill kits and fill up mags. Which is already kinda useful.
  • Note that if searching for a better item, only the status of the item is taken into account. Temperature, dirt, jams, fingerprint IDs etc. are ignored.
  • Attachments that require skill checks (Rod&Spring, Barrel Extender...) are not attached by this. Otherwise the current merc, who might be a klutz, might accidentally ruin your gun. You have to do those attachments yourself.
  • Note that no attachments are removed from items you drop. I advise using the sector inventory buttons to remove attachments prior to starting the process.
  • There is no limit on how many templates you can have. As you will be the one using it, having a thousand will only hurt yourself.
  • You can comment inside templates by starting a line with # or /.
  • For some tricks with templates, see the next post.
  • As the buttons won't exist in 640x480 due to no space being left, this feature won't be there in that resolution.

This feature is savegame compatible.
This has been added to the trunk in r8440 & GameDir r2384. The GameDir data is required. Using the new exe without the new GameDir will set in motion an unlikely chain events, ultimately leading to a horrifying (yet undeniably entertaining) autumn of 2022 for the residents of Osaka.

[Updated on: Mon, 07 August 2017 02:07]




Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.

Then he heard a faint chime as Sovereign subscribed to her ECHO channel.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: New Feature: gear templates[message #350498 is a reply to message #350497] Mon, 07 August 2017 00:03 Go to previous messageGo to next message
Flugente

 
Messages:3165
Registered:April 2009
Location: Germany
Advanced shenanigans

The first step in setting up a template is to equip a merc with the gear you want, and then save that. But by editing these template, you can create pretty neat (at least in my view) templates to further speed up the equipment process.

First, remember that if templates include attachments, the game will try to find and attach all those attachments in that order. So the entry
5 12 94 1007 1030 1029

means the following: In our hands (slot 5) equip an M4 (item 12) and load it with a 30-rnd 5.56 AP mag (item 94). Try to attach 7x scope (item 1007), if that fails, a 4x scope (item 1030), if that fails a 2x scope (item 1029).

This means that we effectively provide alternatives for the game - if one attachment cannot be found, equip the next best one - according to what data we provided.

It doesn't stop there. By removing the explicit requirement of the item being a M4 and replacing it with 0, we get this:
5 0 0 1007 1030 1029


This will cause the game to try the above-explained scope attachment list on any item in our hand. We can of course extend that -
5 0 0 208 1000 1007 999 1030 1029 209 947 1011 902 1001 1006 1003 1012 950 1005 241 1525 307 322


would try to outfit any gun with a number of attachments (as seen in the video). Provided you enter all attachments according to your liking, you can shorten the entire process of attaching things to a few templates. In some instances these might vary - you would want scopes with less magnification on CQB, or prioritize suppressors in a 'stealth template' only. It's up to you.

The same goes for armour -
1 0 0 183 837


attaches plates to any worn armour.

Templates can of course be combined - in the video, I applied a 'Set - Standard gear' and then applied small changes for doctors, repair guys or radio operators.

You can even move the gun selection to this, as also seen in the video:
5 1066
5 347
5 12 
5 13
5 14

This provides several guns for the main hand, we pick the best item of the highest entry.

Meanwhile, you can also force the use of a certain ammotype, even if the gun (and thus the caliber) won't be fixed:
5 0 1400

This forces any gun kept in our hands to try to use item 1400 (9x19mm Box, Ball rounds). If that isn't possible, due to wrong calibre or magsize, we try to equip a better fitting one. So you can now force any gun you use to use mags of a specified calibre.

The main drawback to remember for this is that what is 'best' is only determined via status. If there is an item 1066 with 1% status, we will always pick up that before we try pick up a 100% 347. That's just the way it is. Any attempt to create a function to determine which gun with which attachments will be better than another gun seems like a surefire way to needless debate, so we're not having that.

This is my current, not-at-all-finished Set - Standard Gear:
Toggle Spoiler


Anyway, go nuts with this, people. happy

[Updated on: Sat, 12 August 2017 15:51]




Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.

Then he heard a faint chime as Sovereign subscribed to her ECHO channel.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: New Feature: gear templates[message #350510 is a reply to message #350497] Tue, 08 August 2017 21:21 Go to previous messageGo to next message
smeagol

 
Messages:2713
Registered:June 2008
Location: Bremen, Germany
Flugente wrote on Sun, 06 August 2017 23:03


To make that easier, smeagol and DepressivesBrot enthusiastically promoted an idea for several years I just as enthusiastically denied. But you know the saying: when in Bremen, do as the smeagol says. Unless his wife says otherwise big grin . But she didn't, so after this years con, we're here.


That's exactly what happened. Nice to see you expanded on the basic idea.


Re: New Feature: gear templates[message #350539 is a reply to message #350510] Thu, 10 August 2017 20:43 Go to previous messageGo to next message
Panzer

 
Messages:82
Registered:February 2016
Location: Altis, Sometimes Tanoa
Very simply gonna ask, what's next? Considering the size of the Magicka Workshop, what great insanity will come next.



I have no Wife, Children, or real Job. This also means I have 24 hours a day and 7 days a week to think of a rebuttal. You have been warned.

"I got another problem: I am being overrun by Dinosaur Nazis on Hoverboards!" -Ravenhugger

"Before you judge a man, walk a mile in his shoes. After that who cares? He's a mile away - and you've got his shoes!" - Unknown Criminal
Re: New Feature: gear templates[message #350541 is a reply to message #350539] Fri, 11 August 2017 01:08 Go to previous messageGo to next message
Flugente

 
Messages:3165
Registered:April 2009
Location: Germany
Now that would kinda spoil any surprise, wouldn't it?



Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.

Then he heard a faint chime as Sovereign subscribed to her ECHO channel.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: New Feature: gear templates[message #351624 is a reply to message #350541] Mon, 04 December 2017 17:24 Go to previous messageGo to next message
Penta

 
Messages:27
Registered:May 2008
Is there a list anywhere of what numbers go with which inv slots? (Like 5 is hands, etc) Item numbers are easier to figure out, but.
Re: New Feature: gear templates[message #351625 is a reply to message #351624] Mon, 04 December 2017 18:33 Go to previous messageGo to next message
silversurfer

 
Messages:2211
Registered:May 2009
All items use classes which then have additional classes and properties. There is no simple list. For example armour has an item class of 2048 in Items.xml. It also has a class index which refers to the uiIndex in Armours.xml which then refers to an armour class (0=helmet, 1=vest, 2=leggings, 3=plates).



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Re: New Feature: gear templates[message #351627 is a reply to message #351624] Mon, 04 December 2017 20:22 Go to previous messageGo to next message
DepressivesBrot

 
Messages:3780
Registered:July 2009
Penta wrote on Mon, 04 December 2017 16:24
Is there a list anywhere of what numbers go with which inv slots? (Like 5 is hands, etc) Item numbers are easier to figure out, but.
To nobodies surprise, this is both unintuitive and undocumented, so I made this work of art:
https://i.imgur.com/44sRCPj.png



Chat with us!
#bearpit on IRC
Discord
Get your latest 1.13 Builds
(Pls don't use my forum PMs for general game queries)


Re: New Feature: gear templates[message #351629 is a reply to message #351627] Tue, 05 December 2017 00:57 Go to previous messageGo to next message
Penta

 
Messages:27
Registered:May 2008
Thanks DBrot.
Re: New Feature: gear templates[message #351631 is a reply to message #350497] Wed, 06 December 2017 02:11 Go to previous messageGo to next message
Kugelblitz

 
Messages:7
Registered:April 2017
Flugente wrote on Mon, 07 August 2017 00:03

This feature is savegame compatible.
This has been added to the trunk in r8440 & GameDir r2384. The GameDir data is required. Using the new exe without the new GameDir will set in motion an unlikely chain events, ultimately leading to a horrifying (yet undeniably entertaining) autumn of 2022 for the residents of Osaka.


Newbie Question - Where can I download the "trunk in r8440 & GameDir r2384" ?

Thank you for the very cool features you add all the time!
Re: New Feature: gear templates[message #351632 is a reply to message #351631] Wed, 06 December 2017 10:02 Go to previous message
silversurfer

 
Messages:2211
Registered:May 2009
Kugelblitz wrote on Wed, 06 December 2017 01:11

Newbie Question - Where can I download the "trunk in r8440 & GameDir r2384" ?

Easiest solution is to download the single click installer -> here.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Previous Topic: New feature: advanced repair/dirt system
Next Topic: New Feature: ballistic shields
Goto Forum:
  


Current Time: Sun Dec 17 12:13:25 EET 2017

Total time taken to generate the page: 0.01807 seconds