Jump to content
Sloppy on pc

need help!! making a repair bay script.

Recommended Posts

hi guys, i'm in the middle of creating an mp mission. It's my first project and i'm excited to see how far it's come, but i have hit a snag. I've customized the new jets main cannons (i.e added more ammo to the gryphons cannon and so on).  but unfortunately every time i pull into the rearm bay to refuel and rearm it changes the main cannon back to what it was originally. is anyone able to help me with this problem?

Share this post


Link to post
Share on other sites
1 minute ago, Sloppy on pc said:

hi guys, i'm in the middle of creating an mp mission. It's my first project and i'm excited to see how far it's come, but i have hit a snag. I've customized the new jets main cannons (i.e added more ammo to the gryphons cannon and so on).  but unfortunately every time i pull into the rearm bay to refuel and rearm it changes the main cannon back to what it was originally. is anyone able to help me with this problem?

What does your current script look like? For rearming.

Share this post


Link to post
Share on other sites
Just now, cookies2432 said:

What does your current script look like? For rearming.

veh = vehicle player;

_spd = speed veh;
engOn = false;
 veh engineOn false;
 waitUntil {!isEngineOn veh};

 _i = 20;
 while {_i > 0} do {
     _i = _i -1;
     sleep (1);
     if (engOn) exitWith {};
     hintSilent format [   "%1 Seconds Left"  ,   _i   ];
 };
 hint "GO GO GO!!";

veh setFuel 1;

veh setDamage 0;

veh setVehicleAmmo 1;

Share this post


Link to post
Share on other sites
1 minute ago, Sloppy on pc said:

veh = vehicle player;

_spd = speed veh;
engOn = false;
 veh engineOn false;
 waitUntil {!isEngineOn veh};

 _i = 20;
 while {_i > 0} do {
     _i = _i -1;
     sleep (1);
     if (engOn) exitWith {};
     hintSilent format [   "%1 Seconds Left"  ,   _i   ];
 };
 hint "GO GO GO!!";

veh setFuel 1;

veh setDamage 0;

veh setVehicleAmmo 1;

And your script for the customization of the cannons (gryphon for example).

 

Share this post


Link to post
Share on other sites
Just now, cookies2432 said:

And your script for the customization of the cannons (gryphon for example).

 

if (_checkClassName == "I_Plane_Fighter") then {
_wep = (getArray (configfile >> "CfgVehicles" >> _vehClassName >> "weapons")) select 0;
_jet removeWeapon _wep;
_jet removeWeapon "weapon_AMRAAMLauncher";
_jet removeWeapon "weapon_AGM_65Launcher";
_jet removeWeapon "Laserdesignator_pilotCamera";
_jet removeWeapon "weapon_GBU12Launcher";
[_jet,"weapon_Fighter_Gun20mm_AA",1] call BIS_fnc_addWeapon;
};
 

Share this post


Link to post
Share on other sites

To confirm, you want to add ammo to every type of ammunition (bombs, etc) but you want to also make sure that it adds the extra bit of ammo to the main cannon, am I correct?

Share this post


Link to post
Share on other sites

no all i want it to do is resupply the main cannon with 450 rnds + 1 magazine and 2 short range aa missiles. 

Share this post


Link to post
Share on other sites
Just now, Sloppy on pc said:

no all i want it to do is resupply the main cannon with 450 rnds + 1 magazine and 2 short range aa missiles. 

Alright

Share this post


Link to post
Share on other sites

Well, I was looking at a far more complex solution than was needed. All you need to do is to repeat your code to remove the weapons from the jet after you have rearmed it. It would look something like this:

 

veh = vehicle player;
_spd = speed veh;
engOn = false;
 veh engineOn false;
 waitUntil {!isEngineOn veh};
 _i = 20;
 while {_i > 0} do {
     _i = _i -1;
     sleep (1);
     if (engOn) exitWith {};
     hintSilent format [   "%1 Seconds Left"  ,   _i   ];
 };
 hint "GO GO GO!!";
veh setFuel 1;
veh setDamage 0;
veh setVehicleAmmo 1;

_veh removeWeapon "weapon_AMRAAMLauncher";
_veh removeWeapon "weapon_AGM_65Launcher";
_veh removeWeapon "Laserdesignator_pilotCamera";
_veh removeWeapon "weapon_GBU12Launcher";
};

All you need to do is basicly have the weapons' removal code after you rearm it (and modify it so it has more ammo, did not include it.) so it rearms every gun and then removes the ones you don't want.

  • Like 1

Share this post


Link to post
Share on other sites
2 minutes ago, cookies2432 said:

Well, I was looking at a far more complex solution than was needed. All you need to do is to repeat your code to remove the weapons from the jet after you have rearmed it. It would look something like this:

 


veh = vehicle player;
_spd = speed veh;
engOn = false;
 veh engineOn false;
 waitUntil {!isEngineOn veh};
 _i = 20;
 while {_i > 0} do {
     _i = _i -1;
     sleep (1);
     if (engOn) exitWith {};
     hintSilent format [   "%1 Seconds Left"  ,   _i   ];
 };
 hint "GO GO GO!!";
veh setFuel 1;
veh setDamage 0;
veh setVehicleAmmo 1;

if (_checkClassName == "I_Plane_Fighter") then {
_wep = (getArray (configfile >> "CfgVehicles" >> _vehClassName >> "weapons")) select 0;
_jet removeWeapon _wep;
_jet removeWeapon "weapon_AMRAAMLauncher";
_jet removeWeapon "weapon_AGM_65Launcher";
_jet removeWeapon "Laserdesignator_pilotCamera";
_jet removeWeapon "weapon_GBU12Launcher";
[_jet,"weapon_Fighter_Gun20mm_AA",1] call BIS_fnc_addWeapon;
};

All you need to do is basicly have the weapons' removal code after you rearm it (and modify it so it has more ammo, did not include that here.) so it rearms every gun and then removes the ones you don't want.

that worked!! thank you for your help with this, i really appreciate it. :)

Share this post


Link to post
Share on other sites
Just now, Sloppy on pc said:

that worked!! thank you for your help with this, i really appreciate it. :)

Np, glad I could help :)

  • Like 1

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

×