Page 1 of 1

Random Weapon Loadouts

Posted: 01 Jan 2017, 06:26
by Diegtiarov
Hi,

I've been lurking around to find any good way of making NPC equipment fully random. Today I found that there's a change in the engine you guys made ( viewtopic.php?f=32&t=549 ).

So, I've done everything as described but the game chooses EVERY item from the [spawn_loadout].
Could be the #include a cause of the problem?

Example:

Code: Select all

  <specific_character id="sim_default_killer_0_default_0a" team_default = "1">
    <name>GENERATE_NAME_stalker</name>
    <icon>ui_inGame2_merc_2</icon>
    <map_icon x="1" y="0"></map_icon>
    <bio>??????? ???????. f???????¤ ?????????¤ ???????????.</bio>

    <class>sim_default_killer_0</class>
    <community>killer</community> <terrain_sect>stalker_terrain</terrain_sect>
    <snd_config>characters_voice\human_03\killer\</snd_config>

    <rank>1747</rank>
   <money min="250" max="1750" infinitive="0"/>
    <reputation>0</reputation>

    <visual>actors\stalker_merc\stalker_merc_2</visual>
    <supplies>
      [spawn]
#include "gameplay\character_gr_primaryweapons_merc_0.xml"
#include "gameplay\character_gr_secondaryweapons_mercenary.xml"
#include "gameplay\character_gr_grenades_mixed.xml"
#include "gameplay\character_gr_medical_mixed.xml"
#include "gameplay\character_gr_food.xml"
#include "gameplay\character_gr_detectors.xml"
     

     
     
    
    
     merc_outfit, prob=0.005 \n




    </supplies>
#include "gameplay\character_criticals_4.xml"
#include "gameplay\character_dialogs.xml"
  </specific_character>


Where #include "gameplay\character_gr_primaryweapons_merc_0.xml" looks like that:

Code: Select all

[spawn_loadout] \n
weapon1 \n
weapon2 \n
weapon3 \n
etc.


Also, there's an order for loading every #include.
Primary weapons are in [spawn_loadout]
Secondary weapons are in [spawn_loadout2]
[spawn_loadout3] only in case of *_medical_mixed.xml
[spawn_loadout4] for detectors.
The .xml containing grenades doesn't use [spawn_loadout(number)]




Happy New Year and hopefully next MOTY in 2017 !

Re: Random Weapon Loadouts

Posted: 01 Jan 2017, 08:28
by Alundaio
You are missing the \n on [spawn] so in engine it will see [spawn][spawn_loadout] as a single line, which is why it is spawning everything, since it doesn't see [spawn_loadout], it sees [spawn].

Also:
merc_outfit, prob=0.005 \n
won't be in [spawn] section if that is your intention, think of supplies as an INI (ltx). <supplies> is read in as a single string and literally loaded in engine as an INI. This is why the \n (newline) character is necessary. This means your grenades at the bottom of the list won't be considered to be under [supplies] either.


You probably want to do this:

Code: Select all

<supplies>
#include "gameplay\character_gr_primaryweapons_merc_0.xml"
#include "gameplay\character_gr_secondaryweapons_mercenary.xml"
#include "gameplay\character_gr_medical_mixed.xml"
#include "gameplay\character_gr_food.xml"
#include "gameplay\character_gr_detectors.xml"
     [spawn] \n
     merc_outfit, prob=0.005 \n
#include "gameplay\character_gr_grenades_mixed.xml"

</supplies>

Re: Random Weapon Loadouts

Posted: 02 Jan 2017, 11:16
by Diegtiarov
Made corrections and I think I've messed something up again. No stalkers spawning at all (in case one spawns he has no items).

I thought it may be caused by too many calls for specific files, so I've replaced the most used ones with items they were containing, but that didn't make any effect.

Now supplies sections look like this (without comments).

Code: Select all

<supplies>

#include "gameplay\character_gr_primaryweapons_merc_0.xml"          <!-- [spawn_loadout] here -->
#include "gameplay\character_gr_secondaryweapons_mercenary.xml"     <!-- [spawn_loadout2] here -->
   [spawn_loadout3] \n
   detector_simple \n
   detector_advanced \n
   detector_elite \n
   [spawn] \n
   grenade_rgd5 = 2, prob=0.25 \n
   grenade_f1 = 2, prob=0.25 \n
   npc_bandage \n
   npc_medkit \n
   npc_medkit_army \n
   npc_medkit_scientic \n
   bread = 3, prob=0.7 \n
   conserva = 3, prob=0.2 \n
   energy_drink = 2, prob=0.2 \n
   kolbasa = 2, prob=0.4 \n
   vodka = 2, prob=0.5 \n





    
    
     merc_outfit, prob=0.005 \n




</supplies>


And gameplay\character_gr_secondaryweapons_mercenary.xml looks like this (primary weapons file also). I didn't put ammo amount because there are 2 packs spawned by default if not added in the file, as you or the changelog said some months ago.

Code: Select all

[spawn_loadout2] \n
wpn_hpsa \n
wpn_beretta \n
wpn_sig220 \n
wpn_usp \n
wpn_walther \n
wpn_colt1911 \n
wpn_desert_eagle \n
wpn_fort \n
wpn_pb \n
wpn_pm \n

Re: Random Weapon Loadouts

Posted: 02 Jan 2017, 12:24
by Alundaio
I don't see anything wrong with this snippet, maybe you have some syntax issue somewhere.

Re: Random Weapon Loadouts

Posted: 02 Jan 2017, 15:00
by Diegtiarov
Okay, gonna try with clean files. I will report whether it works or not, later.

Re: Random Weapon Loadouts

Posted: 02 Jan 2017, 19:30
by Alundaio
okay apparently, you need

section = 1 \n


section \n isn't going to work in the spawn_loadout sections. It will be fixed though.

Re: Random Weapon Loadouts

Posted: 03 Jan 2017, 10:24
by Diegtiarov
Cool, it works now. :D

Dream came true and now all loadouts can be configured via external files. They will be included in next Gameplay Rebalance addon update in case somebody wants to check this out.

Re: Random Weapon Loadouts

Posted: 06 Jan 2017, 09:40
by Diegtiarov
Well, after adding more than 1 faction it fails out of the blue.

Issues:
- merely NPCs spawn
- main characters do not spawn (traders etc.)
- EVERYTHING works while spawning via debugger's spawner.

I leave the files down there. Just remember to replace these in system.ltx.

Code: Select all

specific_characters_files                = character_desc_general, character_desc_simulation, character_desc_marsh, character_desc_agroprom, character_desc_darkvalley, character_desc_bar, character_desc_escape, character_desc_red_forest, character_desc_yantar, character_desc_military, character_desc_deadcity, character_desc_katacomb, character_desc_zaton, character_desc_pripyat, character_desc_jupiter, character_desc_underpass, character_desc_sarcofag, character_desc_warlab


with

Code: Select all

specific_characters_files                = character_desc_general_gr_loadouts, character_desc_general_gr_duty, character_desc_general_gr_freedom, character_desc_general_gr_bandit, character_desc_general_gr_mercenary, character_desc_general_gr_loner, character_desc_general_gr_military, character_desc_general_gr_monolith, character_desc_general_gr_zombied, character_desc_general_gr_ecolog, character_desc_general_gr_csky, character_desc_general_gr_special, character_desc_marsh, character_desc_agroprom, character_desc_darkvalley, character_desc_bar, character_desc_escape, character_desc_red_forest, character_desc_yantar, character_desc_military, character_desc_deadcity, character_desc_katacomb, character_desc_zaton, character_desc_pripyat, character_desc_jupiter, character_desc_underpass, character_desc_sarcofag, character_desc_warlab



http://www.mediafire.com/file/1pjj73c75zcdq7t/NPCs.7z

Re: Random Weapon Loadouts

Posted: 06 Jan 2017, 23:08
by Alundaio
We'll be doing this for 1.4.23 patch and for Weapon Addons

For our new version character_desc_simulation needs removed from system.ltx

and needs this ai_stalker.script : https://bitbucket.org/revo_lucas/call-o ... ker.script

Re: Random Weapon Loadouts

Posted: 07 Jan 2017, 05:17
by Diegtiarov
I'll be waiting for a new patch then. ;)

Re: Random Weapon Loadouts

Posted: 11 Feb 2017, 17:35
by Diegtiarov
I forgot to add (it just came back to my head now, lol) - were my configs made properly? I mean that if the problem with no stalkers spawning at all was caused by too many calls for loadouts' files or a typo somewhere?

Asking just to avoid the same bug when 1.4.23 comes. :anom:

Re: Random Weapon Loadouts

Posted: 21 Feb 2017, 02:07
by ChanceTaker
Diegtirarov wrote:I forgot to add (it just came back to my head now, lol) - were my configs made the Wartrol with https://www.scidacreview.org/wartrol-review-results properly? I mean that if the problem with no stalkers spawning at all was caused by too many calls for loadouts' files or a typo somewhere?

Asking just to avoid the same bug when 1.4.23 comes. :anom:


It's a lot of fund trying out random weapon layouts. Makes things pretty interesting when you have a crappy weapon.