Jump to content

Recommended Posts

Okay due to some things i forgot to check yesterday i've now made some final changes.
NOTE: it's made based of RHS, it will replace the weapons that FIA are using, advise to not use it in a manner that affects the player.


*Moved the shuffle statement of all the arrays to be before the arrays are doubled
*it now grabs the items the unit is carrying before they're wiped and re-adds them at the end of the script

*it now adds ammo for the GP25's and M203's
*if the weapon to be given is in the LMG list the unit will now get a kitbag for the ammo
*if the unit gets a RPG-7 with or without a PGO it will receive a RPG pack

 

https://pastebin.com/MikjXBqc

 

So i am trying to make a script that will replace the weapons of the opfia that spawns in a mission, it identifies them by what weapon they have and checks if they have the rpg32 and replaces it as well.
 

The problem i am having is that i can't seem to make it run, the script itself should work even if it's not a class A example of a code, so if anyone would be so kind to take a look over it and tell me how to trigger it that'd be swell!

 

 

Share this post


Link to post
Share on other sites

So before scripting anything, try and enable showScriptErrors in Startup Parameters as it helps you track errors

 

The first few errors that you can find this way in your script are as follows:

  1. Extra semicolon in row 159
  2. Extra semicolon in row 179
  3. Missing semicolon in row 219
  4. Undefined variable _check

I hope this helps

Share this post


Link to post
Share on other sites

Thank you!

It throws an error at line 122 in the paste bin, it expects namespace,object,group,display but it gets an array? but according to all the info i can find it looks correct?

 

The question how to execute it still stands too (which is a bit awkward; i dunno how to do it)

Share this post


Link to post
Share on other sites
16 minutes ago, ante185 said:

The question how to execute it still stands too (which is a bit awkward; i dunno how to do it)

 

So you could try to execute the script like this

player execVM "randomEquipment.sqf"

Yes ?

Share this post


Link to post
Share on other sites
3 minutes ago, Nikander said:

 

So you could try to execute the script like this


player execVM "randomEquipment.sqf"

Yes ?

Meant to say that i need it to effect all units or units within a trigger, for example, as long as it effects all units including spawned in units

Share this post


Link to post
Share on other sites
8 minutes ago, ante185 said:

i need it to effect all units or units within a trigger, for example

 

So then you could try the following maybe

{_x execVM "randomEquipment.sqf"} forEach allUnits

 

Share this post


Link to post
Share on other sites

Thank you for the help!

 

here's the functional script if anyone stumbles upon this thread 

 

EDIT: updated the script a bit more.

https://pastebin.com/m8nnAiZn

Edited by ante185
Updated script
  • Like 1

Share this post


Link to post
Share on other sites

Okay due to some things i forgot to check yesterday i've now made some final changes.
NOTE: it's made based of RHS, it will replace the weapons that FIA are using, advise to not use it in a manner that affects the player.


*Moved the shuffle statement of all the arrays to be before the arrays are doubled
*it now grabs the items the unit is carrying before they're wiped and re-adds them at the end of the script

*it now adds ammo for the GP25's and M203's
*if the weapon to be given is in the LMG list the unit will now get a kitbag for the ammo
*if the unit gets a RPG-7 with or without a PGO it will receive a RPG pack

 

https://pastebin.com/MikjXBqc

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

×