Home   Help Search Login Register  

Author Topic: Creating customized weapon loadout scripts - help  (Read 1519 times)

0 Members and 1 Guest are viewing this topic.

Offline MattyDienhoff

  • Members
  • *
Creating customized weapon loadout scripts - help
« on: 13 Sep 2009, 10:58:49 »
I'm creating a mission in which I'm using some of the units from the WW4 modpack as OpFor. The thing is, I want them to use ORCS weapons, not the ones from the WW4 pack. Right now, the only way I know how to do this is, of course, in the init (removeallweapons and then add the new loadout).

That's easy enough to do, but we're talking hundreds of soldiers here, it'd be so much easier if I could simply create a number of scripts, one for each type of loadout I want to give my OpFor guys (say, riflemanloadout.sqs, officerloadout.sqs, etc.), and then exec the appropriate script in each soldier's init. That would also be a great boon if I want to change one of those loadouts, because I'd just have to edit the script instead of hundreds of inits (opening the .sqm in Notepad++ and using the replace function helps, but even that is a bit fiddly)

So, the problem is that I'm hopeless with scripts and wouldn't have the first clue how to create such a thing. I've looked at various tutorials, but most of this stuff is beyond comprehension for me.  :dunno:

By the way, I have seen this and, while it's a nice idea, it's too complex for this purpose. Like I said, my OpFor soldier's loadouts are standardized based on their role (soldier, machine gunner, rpg, etc.), so I don't need to mix and match. To recap, what I need is a simple script that, when executed by any unit, removes that unit's equipment and replaces it with something else.
« Last Edit: 13 Sep 2009, 11:05:00 by MattyDienhoff »

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Creating customized weapon loadout scripts - help
« Reply #1 on: 13 Sep 2009, 12:10:49 »
So long as the loadout is standard for the type of unit, you could use the typeOF command to determine which type of unit it is, then change the loadout accordingly. In pseudocode:

  • map-sized trigger, activated by side present, on activation allSide = thislist
  • in the init file, wait a second or two until the mission has started (us a fade in from black), then run the loadout script
  • in the loadout script, loop through each unit in allSide, detect the type of unit, then jump to the relevant marker in the script

Offline Zombie

  • Members
  • *
  • Beware the night, the zombie walks among you
    • USI
Re: Creating customized weapon loadout scripts - help
« Reply #2 on: 13 Sep 2009, 13:33:10 »
you could use Chris Hendersons OFP edit or Armaedit to make the seperate scripts that you describe and implement them the way you want.  You would still have to either a)edit the data files in the tool, or b) edit the script with the proper classnames.  Here is an example of what the tool does for you
Code: [Select]
; ****************************************************************
; Custom unit script for Armed Assault
; Created with ArmA Edit - Version 1.3.4000
; HELP: Run this script from the INITIALIZATION box of the unit.
; CODE: [this] exec "soldierguy.sqs"
; ****************************************************************

; Get the unit parameter given
_unit = _this select 0

; Strip the units current gear
removeAllWeapons _unit

; Add the new gear to the unit
_unit addMagazine "30Rnd_556x45_Stanag"
_unit addMagazine "30Rnd_556x45_Stanag"
_unit addMagazine "30Rnd_556x45_Stanag"
_unit addMagazine "30Rnd_556x45_Stanag"
_unit addMagazine "30Rnd_556x45_Stanag"
_unit addMagazine "30Rnd_556x45_Stanag"
_unit addMagazine "30Rnd_556x45_StanagSD"
_unit addMagazine "30Rnd_556x45_StanagSD"
_unit addMagazine "30Rnd_556x45_StanagSD"
_unit addMagazine "FlareWhite_M203"
_unit addMagazine "FlareWhite_M203"
_unit addMagazine "FlareWhite_M203"
_unit addWeapon "M16A2GL"
_unit selectWeapon "M16Muzzle"
_unit addMagazine "M136"
_unit addMagazine "M136"
_unit addWeapon "M136"
_unit addMagazine "15Rnd_9x19_M9"
_unit addMagazine "15Rnd_9x19_M9"
_unit addWeapon "M9"
_unit addWeapon "Binocular"
_unit addWeapon "NVGoggles"

Exit

Offline MattyDienhoff

  • Members
  • *
Re: Creating customized weapon loadout scripts - help
« Reply #3 on: 13 Sep 2009, 17:33:25 »
Thanks for the prompt response gents, that script is exactly the kind of thing I had in mind. Thanks!

EDIT: Hm, while I'm here, I have a second question. How would I go about rigging it so respawning is 'GROUP' if there are any NPCs left in the player's squad, but switch it to 'BASE' if there no NPCs left? And is that even possible? Since it's something that's defined in the description.ext, my best guess is it's impossible to change it on the fly like this, but since I'm a bit ignorant on the subject of scripting, I'm loathe to disregard the idea.
« Last Edit: 13 Sep 2009, 19:10:59 by MattyDienhoff »

Offline Zombie

  • Members
  • *
  • Beware the night, the zombie walks among you
    • USI
Re: Creating customized weapon loadout scripts - help
« Reply #4 on: 14 Sep 2009, 10:55:42 »
I've never tried changing the respawn like that.  I don't think it will be easy to do, but I usually don't say anything is impossible because scripts can do amazing things.  I have never seen respawn changing like that though.  My first idea, off the cuff, would be to create a new group member when 1 dies, then hold them somewhere on the map until all of them have been killed and replaced, then let the "created" group members out at the original starting point.