It is currently Thu Mar 28, 2024 12:38 pm

RUNNING WITH RIFLES Multiplayer

test

Game servers 49 List provided by EpocDotFr | Players online 118


All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Sun Jul 23, 2017 10:13 pm 
Offline

Joined: Sun Jul 23, 2017 9:53 pm
Posts: 3
Hello!

I have been messing around with modding the game and eventually went ahead and created multiple vest models for my green faction. I accomplished this by editing the green_default.model file and adding this code:

Code:
<model filename="soldier_aX_vest.xml">
      <requirement class="carry_item" slot="1" key="vest2.carry_item"/>
      <requirement class="rank" range="0 100" />
   </model>   
   <model filename="soldier_aX_vest.xml">
      <requirement class="carry_item" slot="1" key="vest2_2"/>
      <requirement class="rank" range="0 100" />
   </model>
   <model filename="soldier_aX_vest.xml">
      <requirement class="carry_item" slot="1" key="vest2_3"/>
      <requirement class="rank" range="0 100" />
   </model>


While this works fine regarding getting the models ingame, it has created the unintended consequence of the models swapping whenever I get shot (the vest takes damage). When considering how to rectify it, I thought of two solutions:

Either I create a single model to use for whenever a vest is damaged, but ideally I'd like a way for the game to recognize the model I am currently using and then keep using that model for the damaged vest until I swap the vest out for a new one. I have some coding background in C++ and java, but this is my first time working in XML so I will need help getting the syntax correct.

After some quick googling I tried adding this:

Code:
<if model filename="soldier_aX_vest.xml">
      <model filename="soldier_aX_vest.xml">
         <requirement class="carry_item" slot="1" key="vest2_2"/>
         <requirement class="rank" range="0 100" />
      </model>
      <model filename="soldier_aX_vest.xml">
         <requirement class="carry_item" slot="1" key="vest2_3"/>
         <requirement class="rank" range="0 100" />
      </model>
   </if>


as a primitive way to add a condition for each damaged vest state model (as I assume that's what Vest2_2 and Vest2_3 refer to), but I had no luck. I'm fairly certain my syntax is just plain wrong, but what I really want to know if my reasoning is sound, or if the game doesn't actually support this sort of thing.

Thanks for your help!


Top
 Profile  
 
PostPosted: Sun Jul 23, 2017 11:52 pm 
Offline

Joined: Sat Oct 05, 2013 12:19 am
Posts: 635
Hello! Welcome to the forum. Good first post. :)

So, what's your overall goal with this? From what I can tell, the game's code can already handle what you want to do (if not a bit clunkily), but it is possible. You can keep the same vest or modify the vest based on whatever weapon, rank, or wearable / wearable state the soldier has - you just need to explicitly state all of them. Explaining the end goal for this could help me understand a bit better.


Top
 Profile  
 
PostPosted: Mon Jul 24, 2017 12:36 am 
Offline

Joined: Sun Jul 23, 2017 9:53 pm
Posts: 3
Thanks for the reply!

Sorry for explaining it poorly. Ideally I'd like it so I can use my custom vest models (I have 5 using the vanilla naming structure), but the way the vest models are initialized (in vanilla, at least) leads to your player cycling the vest model once you are hit and the vest is damaged. My exact code for all the vests is:

Code:
   <model filename="soldier_a1_vest.xml">
      <requirement class="carry_item" slot="1" key="vest2.carry_item"/>
      <requirement class="rank" range="0 100" />
   </model>
        <model filename="soldier_a1_vest.xml">
      <requirement class="carry_item" slot="1" key="vest2_2"/>
      <requirement class="rank" range="0 100" />
   </model>
   <model filename="soldier_a1_vest.xml">
      <requirement class="carry_item" slot="1" key="vest2_3"/>
      <requirement class="rank" range="0 100" />
   </model>
   
   <model filename="soldier_a2_vest.xml">
      <requirement class="carry_item" slot="1" key="vest2.carry_item"/>
      <requirement class="rank" range="0 100" />
   </model>   
   <model filename="soldier_a2_vest.xml">
      <requirement class="carry_item" slot="1" key="vest2_2"/>
      <requirement class="rank" range="0 100" />
   </model>
   <model filename="soldier_a2_vest.xml">
      <requirement class="carry_item" slot="1" key="vest2_3"/>
      <requirement class="rank" range="0 100" />
   </model>
   
   <model filename="soldier_a3_vest.xml">
      <requirement class="carry_item" slot="1" key="vest2.carry_item"/>
      <requirement class="rank" range="0 100" />
   </model>
   <model filename="soldier_a3_vest.xml">
      <requirement class="carry_item" slot="1" key="vest2_2"/>
      <requirement class="rank" range="0 100" />
   </model>
   <model filename="soldier_a3_vest.xml">
      <requirement class="carry_item" slot="1" key="vest2_3"/>
      <requirement class="rank" range="0 100" />
   </model>
   
   <model filename="soldier_a4_vest.xml">
      <requirement class="carry_item" slot="1" key="vest2.carry_item"/>
      <requirement class="rank" range="0 100" />
   </model>
   <model filename="soldier_a4_vest.xml">
      <requirement class="carry_item" slot="1" key="vest2_2"/>
      <requirement class="rank" range="0 100" />
   </model>
   <model filename="soldier_a4_vest.xml">
      <requirement class="carry_item" slot="1" key="vest2_3"/>
      <requirement class="rank" range="0 100" />
   </model>
   
   <model filename="soldier_a5_vest.xml">
      <requirement class="carry_item" slot="1" key="vest2.carry_item"/>
      <requirement class="rank" range="0 100" />
   </model>
   <model filename="soldier_a5_vest.xml">
      <requirement class="carry_item" slot="1" key="vest2_2"/>
      <requirement class="rank" range="0 100" />
   </model>
   <model filename="soldier_a5_vest.xml">
      <requirement class="carry_item" slot="1" key="vest2_3"/>
      <requirement class="rank" range="0 100" />
   </model>


Now I figure the reason it does this is because this sets the models for vest2_2 and vest2_3 as soldier_a(1-5)_vest.model as I specified. My goal with the if statement was for the damaged vest models to be applied conditionally depending on what my current model is (So if I was using model solider_a1_vest.model It would only use that specific model when my vest is damaged without choosing another random one).

Roughly:
Code:
If model for"vest2.carry_item" = solider_a1_vest.model
then vest2_2 && vest2_3 = solider_a1_vest.model


There may be a nicer way to implement the multiple vest models than what I've done, but I just extended the vanilla implementation to include the new models.

Ultimately I'd like for my model to be randomized when I put on a vest (which currently is how it works), but I'd like to remain using that model even if the vest is damaged (which at the moment it randomly chooses one of the 5 models I made instead of keeping the current model). I guess the problem stems from me wanting it to randomly select one of the models when I put a vest on but I don't want it to keep randomly applying models when the vest is damaged.

I really appreciate the help (and the help that you've given others here in the past that has allowed me to get this far on my own)

Edit: This is all for a campaign mod, if that matters


Top
 Profile  
 
PostPosted: Mon Jul 24, 2017 12:47 am 
Offline

Joined: Sat Oct 05, 2013 12:19 am
Posts: 635
Far as I can tell, the game doesn't currently support what you want to do. No amount of your own code is going to help you there, neither will any campaign scripts (which don't handle such small-scale things).


Top
 Profile  
 
PostPosted: Mon Jul 24, 2017 12:56 am 
Offline

Joined: Sun Jul 23, 2017 9:53 pm
Posts: 3
Gotcha. I figured that might be the case. It seems a bit like having my (random cycling models) cake and eating it too lol.

I think I'll just end up making a "wounded" model for when the vest is damaged or make my current vest models more similar so I don't notice it as much when they swap. If I end up figuring out how to do what I initially set out to do I'll be sure to report back so the future generations of aspiring modders can see how its done.

Thanks again!


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 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