It is currently Thu Mar 28, 2024 8:41 am

RUNNING WITH RIFLES Multiplayer

test

Game servers 48 List provided by EpocDotFr | Players online 78


All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Thu Mar 16, 2017 4:38 pm 
Offline

Joined: Wed Apr 15, 2015 7:06 am
Posts: 39
Location: Thailand
Hi, I've checked the template for creating and running custom campaign, including the my_item_delivery_configurator.as and my_vehicle_delivery_configurator.as. In both files I edited this line with my own weapon (replacing L85A2 and M79 respectively):

Spoiler:
list.push_back(Resource("sdar.weapon", "weapon")); <this is my mod's weapon
list.push_back(Resource("famasg1.weapon", "weapon"));
list.push_back(Resource("sg552.weapon", "weapon"));
list.push_back(Resource("mx_ugl.weapon", "weapon")); <as well as this
list.push_back(Resource("minig_resource.weapon", "weapon"));
list.push_back(Resource("desert_eagle.weapon", "weapon"));
list.push_back(Resource("tow_resource.weapon", "weapon"));
list.push_back(Resource("eodvest.carry_item", "carry_item"));


Unfortunately the weapons remain unlocked and available in the armoury, which made sense due to the .resources file I predefined in nato.xml faction file:

Spoiler:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<weapon key='mx_rifle.weapon' />
<weapon key='mxc.weapon' />
<weapon key='mx_sw.weapon' />

<weapon key='mxm.weapon' />
<weapon key="m320_lrr.weapon" />

<weapon key='vermin.weapon' />
<weapon key='vermin_sd.weapon' />

<weapon key='sdar.weapon' /> <here
<weapon key='mx_ugl.weapon' /> <and here

</resources>


I instead tried by actually creating a l85a2.weapon and m79.weapon with everything inside scripted as my mod's sdar.weapon and mx_ugl.weapon respectively. Now both weapons do not appear in the armoury until briefcase is delivered. While this works with unlocks using briefcases and shows up in the armoury buyables, they (obviously) are not used by my faction due to the .resources mentioned above.

Here's my question: is there some sort of mysterious script I'm missing that will only unlock .weapon files with the names l85a2, famasg1,sg552, etc. etc.? Also on a related topic, where is the script that modifies weapons unlock for laptop deliveries (i.e. APR, Mk23 SOCOM)? Because I don't want to have these weapons in a mod set in 2035.

Thank you and kind regards,
KetchupWarthog


Top
 Profile  
 
PostPosted: Thu Mar 16, 2017 6:47 pm 
Offline
Site Admin

Joined: Mon Jun 27, 2011 11:59 am
Posts: 2856
You're probably looking for this vanilla/scripts/gamemodes/invasion/stage_invasion.as, methods getCommonFactionResources and getFriendlyFactionResources.

I think there's some weirdness going on here that could be handled in the *.resources files in vanilla instead. Also would make sense that these lists could be controlled with the stuff in the configurators. Would seem that this issue is limited to resources you generally want to be available for the default soldier group for all/some factions but have them disabled for the faction the player chooses for himself.

You have a few options how to get to change what happens in those methods in your mod. The first option is to simply copy stage_invasion.as to your mod and directly change these methods to fit your needs. Issues might arise if we make changes in vanilla's stage_invasion.as as the changes won't automatically apply to your mod.

The second option is to derive your own stage class from Stage, e.g. class MyStage : Stage and override those two particular methods with implementations you require and make your stage configurator create MyStages instead of Stages etc. I won't go into details how to do that here, as I might have even misunderstood the problem :)

Quote:
Also on a related topic, where is the script that modifies weapons unlock for laptop deliveries (i.e. APR, Mk23 SOCOM)? Because I don't want to have these weapons in a mod set in 2035.

MyItemDeliveryConfigurator derives from a class ItemDeliveryConfiguratorInvasion which is vanilla\scripts\gamemodes\invasion\item_delivery_configurator_invasion.as, you can see something it's doing in there. Laptop unlocks appear to use
Code:
   // --------------------------------------------
   array<Resource@>@ getUnlockWeaponList2() const {
      array<Resource@> list;

      list.push_back(Resource("mp5sd.weapon", "weapon"));
//      list.push_back(Resource("beretta_m9.weapon", "weapon"));
      list.push_back(Resource("scorpion-evo.weapon", "weapon"));
//      list.push_back(Resource("glock17.weapon", "weapon"));
      list.push_back(Resource("qcw-05.weapon", "weapon"));
//      list.push_back(Resource("pb.weapon", "weapon"));   
//    list.push_back(Resource("vest_blackops.carry_item", "carry_item"));
      list.push_back(MultiGroupResource("vest_blackops.carry_item", "carry_item", array<string> = {"default", "supply"}));
      list.push_back(Resource("apr.weapon", "weapon"));
//      list.push_back(Resource("mk23.weapon", "weapon"));
      list.push_back(MultiGroupResource("mk23.weapon", "weapon", array<string> = {"default", "supply"}));       
       
         
      return list;
   }

You can have a similar method in your item delivery configurator class to override the vanilla behavior.


Top
 Profile  
 
PostPosted: Thu Mar 16, 2017 10:54 pm 
Offline
Site Admin

Joined: Mon Jun 27, 2011 11:59 am
Posts: 2856
KetchupWarthog wrote:
I instead tried by actually creating a l85a2.weapon and m79.weapon with everything inside scripted as my mod's sdar.weapon and mx_ugl.weapon respectively. Now both weapons do not appear in the armoury until briefcase is delivered. While this works with unlocks using briefcases and shows up in the armoury buyables, they (obviously) are not used by my faction due to the .resources mentioned above.


I looked around a little bit more. getFriendlyFactionResources indeed clears those particular weapons from friendly faction initially, it has been setup this way as Invasion, Dominance and quickmatches share most of the .resources files and it was decided that it's easy to disable some of these multimode resources by doing it in Invasion from the script.

If you're only focusing on one mode i.e. campaign, like you should, in most cases you should disable the unlockable weapons in common.resources by not listing them. Then when you unlock a weapon listed in your configurators, it will appear in your faction's resources and your bots will also start using the weapon and it'll show up in armory. (e.g. vanilla desert eagle)

If you want to have a weapon that is used by the enemies but not friendlies until unlocked (vanilla m79), you should list it in common.resources but use getFriendlyFactionResources to disable it for friendlies. That way it'll work regardless of which faction the player plays in.

If you want to have a weapon that is used by your bots from the start but which has to be specifically unlocked by the player to see it in armory, you need to setup the faction soldier groups so that there won't be any bots in the default soldier group (which is used by all players). You'd do it by setting spawn_score to 0 in the default group. Then you'd setup the default soldier group so that it doesn't include the unlockable weapons, and list the weapons in the resources for the soldier groups meant for bots.


Top
 Profile  
 
PostPosted: Fri Mar 17, 2017 11:24 am 
Offline

Joined: Wed Apr 15, 2015 7:06 am
Posts: 39
Location: Thailand
Thank you for the quick reply, much appreciated

I went for copying and editing the stage_invasion.as file into my mod, that way only the overlay will be affected.

pasik wrote:
...getFriendlyFactionResources indeed clears those particular weapons from friendly faction initially...

If you want to have a weapon that is used by the enemies but not friendlies until unlocked (vanilla m79), you should list it in common.resources but use getFriendlyFactionResources to disable it for friendlies. That way it'll work regardless of which faction the player plays in.


This method works combined with the modified stage_invasion.as works. I modified the latter like this:
Spoiler:
protected XmlElement@ getCommonFactionResources(int factionId) const {
// we only need to set player-targeted vehicles initially not available for all factions, and later enable them for the friendly

-snip-

addFactionResourceElements(command, "weapon", array<string> = {"mx_ugl.weapon", "famasg1.weapon", "sg552.weapon"}, false); edit right here

return command;
}

// --------------------------------------------
protected XmlElement@ getFriendlyFactionResources(int factionId) const {
XmlElement command("command");
command.setStringAttribute("class", "faction_resources");
command.setIntAttribute("faction_id", factionId);

-snip-
// no unlock items by default
addFactionResourceElements(command, "weapon", array<string> =
{"mx_ugl.weapon", "famasg1.weapon", "sg552.weapon", "sdar.weapon", "minig_resource.weapon", "tow_resource.weapon", "gl_resource.weapon"}, false); and here for sdar and mx_ugl

-snip-
}


In my testing playing as greenforces (who owns the MX UGL in normal matches, while SDAR is common for all) they will spawn neither weapon until unlocked, and when I play against them they will spawn with SDAR, which is as expected. Since I've only worked on one faction I haven't tested playing as greys and have them spawn with my soldiers, but they definitely show up in the armoury.

Please don't lock this topic just yet, I may run into future problems with those scripting changes. Hopefully if I get full 100% functionality I'll create a template file for others. And is there a way I can test the functionality of the heavily-scripted final mission I and II without having to run through the entire campaign? -.-


Top
 Profile  
 
PostPosted: Fri Mar 31, 2017 6:40 pm 
Offline

Joined: Wed Apr 15, 2015 7:06 am
Posts: 39
Location: Thailand
Just a question, does the ordering of weapons in invasion_all_weapons.xml affect the game? I had a crash on the Final Mission II (understandable due to the heavy scripting) and the changelog read smthg about apc2_hmg not found. Because I have to run through the ENTIRE campaign again with my mod, I won't be able to recreate or have the gamelog available. But I certainly swear modifying invasion_all_weapons.xml will cause some changes to the game


Top
 Profile  
 
PostPosted: Sat Apr 01, 2017 6:01 am 
Offline

Joined: Sat Oct 11, 2014 8:46 am
Posts: 331
U can use /0_win to skip maps or /warp xx to go to certain map


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group