OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Bankler on 03 Sep 2008, 00:35:16
-
I would like to change all the russians weapons to the coresponding weapons in the Russian Weapons Addon.
For instance:
AK74 -> ICP_AK74
AK47 -> ICP_AK47
and
AK74mag -> ICP_AK74mag
AK47mag -> ICP_AK47mag
How can a do this in a smart way? Script init file where I replace with "this removeAllweapons" etc for all russian classes? Or something?
Would love a code snippet if possible, since I'm quite new to editing.
Regards
Bankler
-
Here is a script, lets just call it equipment.sqs, obviously I just used standard west weapon loadouts for an example
; this goes in units init line [this, "law"] exec "equipment.sqs"
_unit = _this select 0
_type = _this select 1
goto "loadout"
#loadout
? ( _type == "OFFICER") : goto "Officer"
? ( _type == "LAW") : goto "LAW"
exit
#Officer
removeallweapons _unit
_unit addmagazine "m16"
_unit addmagazine "m16"
_unit addmagazine "m16"
_unit addmagazine "m16"
_unit addmagazine "m16"
_unit addmagazine "m16"
_unit addmagazine "handgrenade"
_unit addmagazine "handgrenade"
_unit addmagazine "smokeshell"
_unit addmagazine "smokeshell"
_unit addweapon "m16"
_unit addweapon "binocular"
_unit addweapon "NVgoggles"
_unit addmagazine "berettamag"
_unit addmagazine "berettamag"
_unit addmagazine "berettamag"
_unit addmagazine "berettamag"
_unit addweapon "beretta"
exit
#Law
removeallweapons _unit
_unit addmagazine "m16"
_unit addmagazine "m16"
_unit addmagazine "m16"
_unit addmagazine "m16"
_unit addmagazine "lawlauncher"
_unit addmagazine "lawlauncher"
_unit addmagazine "handgrenade"
_unit addmagazine "handgrenade"
_unit addweapon "m16"
_unit addweapon "lawlauncher"
_unit addweapon "NVgoggles"
exit
It is not great but essentially you only have to write the loadout once...
This should work.... Make a script... "equipment.sqs" file put the above script in and add as many variants as you wish and for each soldier load out, put in his init line
[this, "law"] exec "equipment.sqs"
The second part of the execution of the script function "_type = _this select 1" can have as many types as you wish,
? ( _type == "SPECOP") : goto "SPECOP"
#Specop
removeallweapons _unit
_unit addmagazine "m4"
_unit addmagazine "m4"
_unit addmagazine "m4"
_unit addmagazine "M4"
_unit addmagazine "handgrenade"
_unit addmagazine "handgrenade"
_unit addmagazine "Pipebomb"
_unit addmagazine "lawlauncher"
_unit addweapon "XMS"
_unit addweapon "lawlauncher"
_unit addweapon "binocular"
_unit addweapon "NVgoggles"
_unit addmagazine "berettamag"
_unit addmagazine "berettamag"
_unit addmagazine "berettamag"
_unit addmagazine "berettamag"
_unit addweapon "beretta"
exit
Remember to "exit" after each loadout or the script will run through all the loadouts until the unit has the last one available
---
Sometimes especially when you spawn a new unit with "createunit" you will have to put two inverted commas ("") around the weapon _type and file name
[this, ""law""] exec ""equipment.sqs""
Regards
Kendo
-
Thank you very much! I will try it out.