Home   Help Search Login Register  

Author Topic: Change standard arms  (Read 1015 times)

0 Members and 1 Guest are viewing this topic.

Offline Bankler

  • Members
  • *
Change standard arms
« 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

Offline Kendo J

  • Members
  • *
  • Britain Has more varieties of cheese than France
Re: Change standard arms
« Reply #1 on: 03 Sep 2008, 11:46:25 »
Here is a script, lets just call it equipment.sqs, obviously I just used standard west weapon loadouts for an example

Quote
; 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
Quote
[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,

Quote

? ( _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

Quote
[this, ""law""] exec ""equipment.sqs""

Regards
Kendo
« Last Edit: 04 Sep 2008, 12:53:03 by Kendo J »

Offline Bankler

  • Members
  • *
Re: Change standard arms
« Reply #2 on: 05 Sep 2008, 11:14:13 »
Thank you very much! I will try it out.