Home   Help Search Login Register  

Author Topic: Returning weapon names and mags  (Read 887 times)

0 Members and 3 Guests are viewing this topic.

StonedSoldier

  • Guest
Returning weapon names and mags
« on: 01 Jun 2004, 11:27:39 »
is it possible for a script to detect what weapon the player has then return the weapons name and magazine type...

so if the player was a basic western soldier the returned strings would be,

m16
m16mag

a script like this would be really helpful when finding easily the weapon types and magazine types of weapons for addons.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Returning weapon names and mags
« Reply #1 on: 01 Jun 2004, 11:50:59 »
First of all, the M16 magazine is also called M16... ;) (oh, I just had to say this  ::) )

But, you could manufacture a script using 'commands' like primaryWeapon, secondaryWeapon, weapons, magazines, etc...

The ComRef has them all...
« Last Edit: 01 Jun 2004, 11:51:26 by HateR_Kint »
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

PsyWarrior

  • Guest
Re:Returning weapon names and mags
« Reply #2 on: 01 Jun 2004, 11:51:40 »
Greets,

Returning a soldiers Primary Weapon is fairly easy:

_weap = primaryWeapon _unit
hint format ["%1's Primary Weapon = %2", _unit, _weap]

Returning magazines can be done using the magazines command, which returns an array of all the magazines a unit has.

eg:
_mags = magazines _unit
hint format ["%1's magazines: %2", _unit, _mags]

I've attatched a demo script for you. I've initialised all the variables at the top, so you can see what I'm doing...

It should pop up a hint in the corner of the screen giving the primary weapon, secondary weapon and mags of the unit, with a 6 second delay.

Untested at the moment, so try it and see... ::)

-Supr. Cmdr. PsyWarrior
-Psychic Productions

UPDATE: Fixed attatchment. Missed out a bracket... ::)
« Last Edit: 01 Jun 2004, 14:07:39 by PsyWarrior »

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Returning weapon names and mags
« Reply #3 on: 01 Jun 2004, 11:53:04 »
lol  ;D

'The Boss' made it all already... ::) ;D
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.