Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate
Collapse

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. Randomize an array of names in gsc for gun game mp

Randomize an array of names in gsc for gun game mp

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
3 Posts 2 Posters 104 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Cocnutsballsundefined Offline
    Cocnutsballsundefined Offline
    Cocnutsballs
    wrote on last edited by
    #1

    I am trying to randomize a array of all the gun names to have a random gun game order but gsc doesn't have a 'shuffle' function. Is there another way to do this? The array is below.

    allgunslist = array("mp7_mp", "pdw57_mp", "vector_mp", "insas_mp", "qcw05_mp", "evoskorpion_mp", "peacekeeper_mp", "tar21_mp", "type95_mp", "sig556_mp", "sa58_mp", "hk416_mp", "scar_mp", "saritch_mp", "xm8_mp",
    "an94_mp", "870mcs_mp", "saiga12_mp", "ksg_mp", "srm1216_mp", "mk48_mp", "qbb95_mp", "lsat_mp", "hamr_mp", "svu_mp", "dsr50_mp", "ballista_mp", "as50_mp", "beretta93r_dw_mp", "fiveseven_mp", "fnp45_dw_mp",
    "judge_mp", "kard_mp", "smaw_mp", "usrpg_mp", "crossbow_mp", "knife_ballistic_mp", "minigun_wager_mp", "m32_wager_mp");```
    1 Reply Last reply
    0
    • Cocnutsballsundefined Offline
      Cocnutsballsundefined Offline
      Cocnutsballs
      wrote on last edited by
      #2

      Thanks to the discord I figured out to #include common_scripts\utility and use array_randomize(array)

      1 Reply Last reply
      0
      • Resxtundefined Offline
        Resxtundefined Offline
        Resxt
        Plutonium Staff
        wrote on last edited by
        #3

        In the future you can search in the game's code directly here, even with no experience searching "randomize" shows up array_randomize in the first results, and in case of unresolved external errors you can try adding the includes at the top of that file, of course pick ones that make sense

        https://github.com/search?q=repo%3Aplutoniummod%2Ft6-scripts randomize&type=code

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Donate