Jump to content
Kackarot58

Is it possibly to make more Classes?

Recommended Posts

EntityAI assaultClass(PlayerBase player)

{

    EntityAI gun = player.GetHumanInventory().CreateInHands("M4A1");

    gun.GetInventory().CreateAttachment("M4_RISHndgrd_Black");

    gun.GetInventory().CreateAttachment("M4_MPBttstck_Black");

    gun.GetInventory().CreateAttachment("ACOGOptic");

    addMags(player, "Mag_STANAG_30Rnd", 3);

 

    return gun;

}

 

If I used this class more than once I get a error popup before  the server even starts. Can i use different ones or do I need to create moar?

Share this post


Link to post
Share on other sites

I suspect the error would be one that says the Entity is declared multiple times.
If you look through the original code for the multiple class loadouts, each class is named differently, and called at random in a select case statement

// This is pseudo code, not directly implementable. You must add and adjust things as needed.



// these go inside the class, but outside of functions

EntityAI classOne (PlayerBase player) {
    // class One Code here
  return gun;
}

EntityAI classTwo (PlayerBase player) {
    // class Two Code here
  return gun;
}

EntityAI classThree (PlayerBase player) {
    // class Three Code here
  return gun;
}

// This goes inside the trigger code where you are adding the gear
EntityAI yourGunEntity;

Select (Math.Rand(0, 2)) {
    case 0:
		yourGunEntity = classOne(player);
        break;
    case 1:
		yourGunEntity = classTwo(player);
        break;
    case 2:
		yourGunEntity = classThree(player);
        break;
}

 

Edited by Aussie Cleetus
  • Like 1

Share this post


Link to post
Share on other sites

Thanks! I will report back when I get a chance to try new loadouts. Is there a list of actually working guns for the server files?

Share this post


Link to post
Share on other sites
On 10/2/2018 at 6:49 AM, Aussie Cleetus said:

I suspect the error would be one that says the Entity is declared multiple times.
If you look through the original code for the multiple class loadouts, each class is named differently, and called at random in a select case statement


// This is pseudo code, not directly implementable. You must add and adjust things as needed.



// these go inside the class, but outside of functions

EntityAI classOne (PlayerBase player) {
    // class One Code here
  return gun;
}

EntityAI classTwo (PlayerBase player) {
    // class Two Code here
  return gun;
}

EntityAI classThree (PlayerBase player) {
    // class Three Code here
  return gun;
}

// This goes inside the trigger code where you are adding the gear
EntityAI yourGunEntity;

Select (Math.Rand(0, 2)) {
    case 0:
		yourGunEntity = classOne(player);
        break;
    case 1:
		yourGunEntity = classTwo(player);
        break;
    case 2:
		yourGunEntity = classThree(player);
        break;
}

hey there! thanks for throwing this together! I'm trying to use it but seem to be having an issue compiling the case 0:  it says I'm missing a ;... any thoughts?

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×