Jump to content
  • 0

Custom BackPack


Galian

Question

 
A simple question about backpacks, for a custom loadout. I have made a simple addon to make custom loadouts in server side, I pass the player as variable, and then the server does all the job. Everything is working and the player gets its custom loadout, everything but the backpack. This is my code:
_Player = _this select 0; //I pass the player as a parameter in a publicvariableserver;

//rest of the layout code here

/Backpac Code
diag_log "backpack selection";
_BackPacks = ["B_AssaultPack_ocamo","B_AssaultPack_rgr"];
_unitBP = _BackPacks select floor random count _BackPacks;
_Player addBackpack _unitBP;
diag_log "Backpack added";

The thing is that in the rpt file I get both messages, but the backpack is not added to the player. Any clue what can be happening? My best guess right now is related to the AH, but I m not sure.

 

Thanks for your help

 

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

 

 
A simple question about backpacks, for a custom loadout. I have made a simple addon to make custom loadouts in server side, I pass the player as variable, and then the server does all the job. Everything is working and the player gets its custom loadout, everything but the backpack. This is my code:
_Player = _this select 0; //I pass the player as a parameter in a publicvariableserver;

//rest of the layout code here

/Backpac Code
diag_log "backpack selection";
_BackPacks = ["B_AssaultPack_ocamo","B_AssaultPack_rgr"];
_unitBP = _BackPacks select floor random count _BackPacks;
_Player addBackpack _unitBP;
diag_log "Backpack added";

The thing is that in the rpt file I get both messages, but the backpack is not added to the player. Any clue what can be happening? My best guess right now is related to the AH, but I m not sure.

 

Thanks for your help

 

 

why not just do:

_Player = _this select 0; //I pass the player as a parameter in a publicvariableserver;

//rest of the layout code here

/Backpac Code
diag_log "backpack selection";
_BackPack = ["B_AssaultPack_ocamo","B_AssaultPack_rgr"]call BIS_fnc_selectrandom;
_Player addBackpack _BackPack;
diag_log "Backpack added";

?

 

in your example you will need some parenteses or it will be confused about what it is you want

Link to comment
Share on other sites

  • 0

Well the thing is that with both ways I get the class name for the backpack, but then it dont get to the player with the addBackpack

  command.

 

I have checked also the "addbackpackcargo.txt" and there is this sentence: !"B_AssaultPack_(cbr|dgtl|khk|mcamo|ocamo|rgr|sgg)" so I guess it is not something about AH... getting me crazzy
 

Link to comment
Share on other sites

  • 0

sorry, i must have misread the op ... i was sure it said you spawned it on the player, but nvm that.

 

but if you are doing as you are saying, then i need to know how you determin this is the player you want to add it too.

 

however, something like this would be best done on the client side (imo) to avoid too much network traffic between server and client ...

Link to comment
Share on other sites

  • 0

I pass the player as "PublicVariableServer" parameter, I know it does arrive to the server because I can add a custom uniform to that player, and port him to a random spawn location, this all work fine.The only thing I cant get to work is the backpack.

 

myF_PlayerLoadOut = [player];
publicVariableServer "myF_PlayerLoadOut";
Link to comment
Share on other sites

  • 0

obviusly thats why its not working ... i still feel this is the wrong way to go for this tho.

 

it should be done on the player and not bother the server with publicvariables unless you have to ...

 

i can understand that apparently there is some kind of trend going around, about adding everything into a pbo file, however this is not always the answer and you will most likely have to edit something in the mission anyway.

 

basicly what you are doing is taking a rocketship to the grocery ... its most likely a fast trip, sure ... but completly overkill and you will waste way too many resources on it aswell.

Link to comment
Share on other sites

  • 0

obviusly thats why its not working ... i still feel this is the wrong way to go for this tho.

 

it should be done on the player and not bother the server with publicvariables unless you have to ...

 

i can understand that apparently there is some kind of trend going around, about adding everything into a pbo file, however this is not always the answer and you will most likely have to edit something in the mission anyway.

 

basicly what you are doing is taking a rocketship to the grocery ... its most likely a fast trip, sure ... but completly overkill and you will waste way too many resources on it aswell.

 

Probably you are right, I was doing it on server side to perform some checks withing the database, and because it is only when a player is "reborn" so not really a big load to the server. But will think a way to improve this.

 

Thx a lot for your help!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...