Jump to content

Recommended Posts

Hi all,

 

I trying to make a custom mission using CUP Terrains and RHS US and Russia weapons, and after making a custom loadout my AI won't respawn with their main weapon, just a pistol. They have everything else from their custom loadout and the method I've used has worked perfectly before so I'm unsure what the issue is. I've created the description.ext, onPlayerKilled.sqf and onPlayerRespawn.sqf and put in the necessary code which has worked before. Any help will be appreciated.

 

Also the code for onPlayerKilled is

p1 setVariable["Saved_Loadout_p1",getUnitLoadout p1];

p2 setVariable["Saved_Loadout_p2",getUnitLoadout p2];

p3 setVariable["Saved_Loadout_p3",getUnitLoadout p3];

p4 setVariable["Saved_Loadout_p4",getUnitLoadout p4];

p5 setVariable["Saved_Loadout_p5",getUnitLoadout p5];

p6 setVariable["Saved_Loadout_p6",getUnitLoadout p6];

p7 setVariable["Saved_Loadout_p7",getUnitLoadout p7];

p8 setVariable["Saved_Loadout_p8",getUnitLoadout p8];
 

And for onPlayerRespawn

removeAllWeapons p1;
removeAllWeapons p2;
removeAllWeapons p3;
removeAllWeapons p4;
removeAllWeapons p5;
removeAllWeapons p6;
removeAllWeapons p7;
removeAllWeapons p8;

 

removeGoggles p1;
removeGoggles p2;
removeGoggles p3;
removeGoggles p4;
removeGoggles p5;
removeGoggles p6;
removeGoggles p7;
removeGoggles p8;

 

removeHeadgear p1;
removeHeadgear p2;
removeHeadgear p3;
removeHeadgear p4;
removeHeadgear p5;
removeHeadgear p6;
removeHeadgear p7;
removeHeadgear p8;

 

removeVest p1;
removeVest p2;
removeVest p3;
removeVest p4;
removeVest p5;
removeVest p6;
removeVest p7;
removeVest p8;

 

removeUniform p1;
removeUniform p2;
removeUniform p3;
removeUniform p4;
removeUniform p5;
removeUniform p6;
removeUniform p7;
removeUniform p8;

 

removeAllAssignedItems p1;
removeAllAssignedItems p2;
removeAllAssignedItems p3;
removeAllAssignedItems p4;
removeAllAssignedItems p5;
removeAllAssignedItems p6;
removeAllAssignedItems p7;
removeAllAssignedItems p8;

 

clearAllItemsFromBackpack p1;
clearAllItemsFromBackpack p2;
clearAllItemsFromBackpack p3;
clearAllItemsFromBackpack p4;
clearAllItemsFromBackpack p5;
clearAllItemsFromBackpack p6;
clearAllItemsFromBackpack p7;
clearAllItemsFromBackpack p8;

 

removeBackpack p1;
removeBackpack p2;
removeBackpack p3;
removeBackpack p4;
removeBackpack p5;
removeBackpack p6;
removeBackpack p7;
removeBackpack p8;

 

p1 setUnitLoadout(p1 getVariable["Saved_Loadout_p1",[]]);

p2 setUnitLoadout(p2 getVariable["Saved_Loadout_p2",[]]);

p3 setUnitLoadout(p3 getVariable["Saved_Loadout_p3",[]]);

p4 setUnitLoadout(p4 getVariable["Saved_Loadout_p4",[]]);

p5 setUnitLoadout(p5 getVariable["Saved_Loadout_p5",[]]);

p6 setUnitLoadout(p6 getVariable["Saved_Loadout_p6",[]]);

p7 setUnitLoadout(p7 getVariable["Saved_Loadout_p7",[]]);

p8 setUnitLoadout(p8 getVariable["Saved_Loadout_p8",[]]);
 

 

Share this post


Link to post
Share on other sites

It's a wild guess but I think what's happening is that when you call getUnitLoadout in onPlayerKilled.sqf, the player is already missing their main weapon (it drops at the moment of death).

I'm sure there was a topic on this, maybe someone can link?

  • Like 1

Share this post


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

It's a wild guess but I think what's happening is that when you call getUnitLoadout in onPlayerKilled.sqf, the player is already missing their main weapon (it drops at the moment of death).

I'm sure there was a topic on this, maybe someone can link?


I think I've seen that post, in the end I ignored it as I wasn't sure that was the same problem I was having and I didn't want to make things worse by messing with the code further. I'll look up the post again and give that a try. Thanks man!

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

×