Jump to content
Vandeanson

remoteExec from initplayerlocal.sqf

Recommended Posts

Good evening,

 

I have been looking into remoteExec as a mean to create a random loadout generator that would work in MP.

 

This would be the code to execute:

 

Spoiler

VD_Player_Equipper = {
     
      removeUniform player;
      player forceAddUniform selectRandom VD_EquipmentUniforms;
      _rifle =  selectRandom VD_WeaponArrayRifles;
      [player, _rifle, VD_PLRifleAmmo + VD_PLRifleAmmoAdd, 0] call BIS_fnc_addWeapon;

      };

 

 

The initplayerlocal.sqf file contains this code:

 

Spoiler


remoteExec ["VD_Player_Equipper", player, false];

 

 

From the BI wiki I understood that the target could be an object, so i understand player or player would receive a unit ID and the script would only execute this on the client where initplayerlocal was initialized.

I have no means to test this atm (with another client or dedicated server) - could someone advise if i use this correctly?

 

thanks a ton!

vd

Share this post


Link to post
Share on other sites

Why do you want to remoteExec this code which apply to player???

You just have to run it from your initPlayerLocal.sqf

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

hiho!

 

it was my idea and expectation that initplayerlocal would execute the loadout script per client indeed.

However I got feedback from users, that my loadout script would not work for their partymembers online, hence I assumed that I need to change my code as above.

 

what I personally experienced aswell, is that other players in your game do not get the weapon. 

is it possible that the issue lies only with this line?

 

[player, _rifle, VD_PLRifleAmmo + VD_PLRifleAmmoAdd, 0] call BIS_fnc_addWeapon;

 

if that bis fnc is supposed to work under these circumstances as well, then i am overseeing something else..

 

however, this was already a very helpful feedback, thanks!

 

cheers

vd

 

 

 

Share this post


Link to post
Share on other sites
Quote

This function does not remove magazines nor weapons prior to adding the new weapon, so that still has to be done manually.

Does the unit already have a weapon? it won't get a new one if it already has one.

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, Dedmen said:

Does the unit already have a weapon? it won't get a new one if it already has one.

good hint, thank you for that. I will check!

 

Edit: oddly enough, when calling the script multiple times, it has overwritten the weapon. 

in general however, the players spaen as survivors, with no gear.

 

cheers

vd

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

×