Adding to the weapon menu
#1
What part of 'Menu_settings' do i need to change to add a custom weapon to the weapons list?

So far I have the menu to list my weapon but wont load menu skin (The spinning display animation) or the weapon itself.

const isprimary [ return (|| (|| (|| (= $arg1 $SNIPER) (= $arg1 $SHOTGUN)) (|| (= $arg1 $AR) (= $arg1 $SMG))) (= $arg1 $CARBINE)) ]

const getcustomprimarydirs [
  customprimarydirs = []
  loop gcp $NUM_WEAPONS [
    if (! (isprimary $gcp)) [ add2list customprimarydirs (addpunct [ ]) ] [
      add2list customprimarydirs (at $ALTERNATIVE_WEAPONS (+ (* $gcp 3) 2))
    ]
  ]
  return $customprimarydirs
]

const loadcustomprimary [
  nargs = $numargs
  if (> $nargs 0) [
    li = $arg1
    if (isprimary $li) [
      tmp = (getalias (at $WEAPONS $li))
      customphud = (format modmdlweap%1 $tmp)
      custompwld = (format modmdlvwep%1 $tmp)
      if (> $nargs 1) [ // revert to default primary HUD model if any 2nd argument is given
        delalias $customphud; delalias $custompwld
      ] [ // else try loading the custom primary models
        cdirlist = (getcustomprimarydirs)
        if (listlen $cdirlist) [
          dirtotry = (at $cdirlist $li)
          if (strlen $dirtotry) [
            $customphud = $dirtotry
            $custompwld = $dirtotry
          ]
        ]
      ]
    ]
  ]
]

const DEFAULT_PRIMARIES ["MTP-57 Assault Rifle" "A-ARD/10 Submachine Gun" "Precision Tech AD-81 Sniper Rifle" "V-19 Combat Shotgun" "TMP-M&A Carbine" "MG-5 Snipe Rifle"]
const DEFAULT_PRALIASES [AR SMG SNIPER SHOTGUN CARBINE MG-5]
const DEFAULT_PRMDLDIRS [assault subgun sniper shotgun carbine MG-5]

const CUSTOM_PRIMARIES ["AR-15 Assault Rifle" "Mac11 Submachine Gun" "Dragunov SVD Sniper Rifle" "Sawed-off Shotgun" "Marlin Guide Carbine 1895"]
const CUSTOM_PRMDLDIRS [assault2 subgun2 sniper2 shotgun2 carbine2 MG-52]

newmenu Weapons

@@@@@menumdl weapons/MG-5/menu mapmodel 75 12@@@@@
menumdl weapons/assault/menu mapmodel 75 12
loop gwm (listlen $DEFAULT_PRIMARIES) [
  execute (format [menuitem [%1] [ nextprimary (getalias %2); loadcustomprimary (getalias %2) 0; echo %1 selected ] [ chmenumdl Weapons weapons/%3/menu mapmodel 75 12 ]] (at $DEFAULT_PRIMARIES $gwm) (at $DEFAULT_PRALIASES $gwm) (at $DEFAULT_PRMDLDIRS $gwm))
]

// menuitem [] -1
// menuitem [Alternative weapons...] [ showmenu [Alternative Weapons] ]

// newmenu [Alternative Weapons]

// menumdl weapons/assault2/menu mapmodel 75 12
// loop cwm (listlen $CUSTOM_PRIMARIES) [
//   execute (format [menuitem [%1] [ nextprimary (getalias %2); loadcustomprimary (getalias %2); echo %1 selected ] [ chmenumdl [Alternative Weapons] weapons/%3/menu mapmodel 75 12 ]] (at $CUSTOM_PRIMARIES $cwm) (at $DEFAULT_PRALIASES $cwm) (at $CUSTOM_PRMDLDIRS $cwm))
// ]
// menuitem [] -1
// menuitem [Other alternative weapons...] [ showmenu [Alternative Weapon Models] ]
EDIT: So the text you see inbetween the "@" symbols have displayed the "spinning weapon" animation when selecting the weapon, but when actually selected does not change the weapon. Although the console quotes "nextprimary= (Random number) Then "MG-5 Sniper Rifle Selected"

The weapon is just a reskin of the snipe but i'd like to add it to the list as a seperate weapon.. Can this be done?
Thanks given by:


Messages In This Thread
Adding to the weapon menu - by MykeGregory - 29 May 14, 04:07PM
RE: Adding to the weapon menu - by D3M0NW0LF - 29 May 14, 08:22PM
RE: Adding to the weapon menu - by MykeGregory - 29 May 14, 09:29PM
RE: Adding to the weapon menu - by D3M0NW0LF - 29 May 14, 11:46PM
RE: Adding to the weapon menu - by MykeGregory - 31 May 14, 11:31AM
RE: Adding to the weapon menu - by Cleaner - 31 May 14, 09:23PM
RE: Adding to the weapon menu - by MykeGregory - 31 May 14, 11:22PM