RUNNING WITH RIFLES
http://www.runningwithrifles.com/phpBB3/

Campaign Unlocks & Modded Player Classes
http://www.runningwithrifles.com/phpBB3/viewtopic.php?f=7&t=2388
Page 1 of 1

Author:  Insano-Man [ Mon Jun 22, 2015 3:43 pm ]
Post subject:  Campaign Unlocks & Modded Player Classes

Running With Rifles is a recent purchase for me, but that hasn't stopped me from seeing how far I can get into modding without destroying the game and my sanity in the process. So far, it hasn't been so bad; I've gotten together Strogg, SWAT, and HECU grunts in the voxel tool for some custom character classes me and my friends have been using via campaign save editing.

There's a small problem with that, however. It seems from my experience that non-default character classes cannot spawn with or otherwise access unlocked weapons in the campaign. I mean specifically briefcase and delivery unlocks; we can rank up and access rank-restricted weapons just fine, and even see our NPC allies carrying unlocked weapons, but anyone set to a custom class can only pick them up in the field.

Is there any way to get weapon unlocks to show up for custom character classes or is this a hardcoded limit?

Author:  The Soldier [ Mon Jun 22, 2015 8:21 pm ]
Post subject:  Re: Campaign Unlocks & Modded Player Classes

Technically, the AI can spawn with an weapon in the armory that you can see. However, weapons with a spawn_score of "0" in the code, like the SG-553, will never spawn in the hands of the AI.

If you bring the required 5 weapons to an armory to unlock that weapon, then the AI will generally spawn with that. For example, you're playing as the Green and you bring in 5 AK-47s (which has a spawn_score of 0.2, same as the other assault rifles), then the AI will spawn with those and use them.

Author:  Insano-Man [ Tue Jun 23, 2015 5:44 am ]
Post subject:  Re: Campaign Unlocks & Modded Player Classes

That wasn't the question I was asking, I'm afraid.

My problem is that players who have been set to a character class other than "default" (in this case, a nearly 1:1 copy of the default class with alternate models and a spawn score of 0) are totally unable to access unlocked weapons in the armory or spawn with them.

I have no issues with NPCs spawning in with unlocked weapons. I learned about that before I even started modding this game.

Author:  The Soldier [ Tue Jun 23, 2015 2:00 pm ]
Post subject:  Re: Campaign Unlocks & Modded Player Classes

The Armory unlocks weapons for usage in the default class - so you can only access weapons that are unlocked in that class. You can change that via the unlock_manage.php under scripts. I understand that much. But what you managed to do was to make the player spawn as a different class - which, as far as I know, is impossible.

Author:  Insano-Man [ Tue Jun 23, 2015 4:54 pm ]
Post subject:  Re: Campaign Unlocks & Modded Player Classes

It was simple, really. I read somewhere in a thread - which, I can't remember at this moment - that it was possible to manually edit save files to set the character class of a player, and I believe it was Pasik himself that mentioned this. That's what got me started on my custom model binge.

In the header of .person save files, there's soldier_group_name="default". "Default" just needs to be changed to the desired character class and, voila, custom models and loadouts (or so I'm inclined to believe; I haven't tested loadouts yet and want to once I start working on custom weapons).

I must be blind, however, as I can't find where unlock_manager specifies the character class. Am I just not looking hard enough or is new code the solution I should be looking for?

Edit: Found the thread and I was right about the source. "Model-Specific Vest Models?":
http://www.runningwithrifles.com/phpBB3/viewtopic.php?f=7&t=2286#p13928

Author:  The Soldier [ Tue Jun 23, 2015 8:20 pm ]
Post subject:  Re: Campaign Unlocks & Modded Player Classes

Since what you're trying to do involved changing save files and not with overlays, I can't really help you - sorry about that. It's not something that you can do via normal overlay and modding means, both the changing of the player's class and the armory unlocks.

The unlock_manager is stored under the scripts folder in the game files. Involves some pretty heavy coding, though.

Author:  pasik [ Fri Jun 26, 2015 11:24 am ]
Post subject:  Re: Campaign Unlocks & Modded Player Classes

Code:
   // --------------------------------------------
   public function apply_unlocks() {
      $command =
         "<command class='faction_resources' faction_id='" . $this->faction_id . "'>\n";
      // enable all unlocked resources for the faction
      foreach ($this->unlocks as $key => $unlock) {
         $c = "   <" . $unlock->get_resource()->type . " key='" . $unlock->get_resource()->key . "' />\n";
         $command .= $c;
      }
      $command .=
         "</command>";

      $this->metagame->comms->send($command);
   }

This part would need some sort of change. faction_resources XML command accepts an additional parameter soldier_group_name, which defaults to default.

E.g.
Code:
      $command =
         "<command class='faction_resources' soldier_group_name='custom_group_player' faction_id='" . $this->faction_id . "'>\n";


Similar change for drop_resource function might be in order if you want the unlocked resources to be removed after a time.

Author:  Insano-Man [ Sun Jun 28, 2015 6:47 pm ]
Post subject:  Re: Campaign Unlocks & Modded Player Classes

It's always a pleasure to see a developer active on their home turf and a pleasant surprise to see one willing to help the little guy out. Much appreciated!

As much as I realize this is a late reply, I'd also like to extend thanks to The Soldier. I realize how specific this question is and getting me on the right track is more than I probably should have expected.

Now I just need to see how badly I can mangle PHP code and how much bludgeoning I'll need to do to get it to work for me. Thanks again.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/