Effective Weapon Assignment

0 favourites
  • 4 posts
From the Asset Store
Give your players the chance to choose their own keys or buttons!
  • I am making a shooter game that gives you a random weapon each round. Each weapon has its own unique properties and there's plans to be over 200 different weapons.

    Because of this, I want to code a random weapon assignment system as efficiently as possible. Can someone help me?

  • Set a variable to a random number and than have events for each weapon is the way. You could put all weapon data into an array I suppose so you can use one event for all weapons, depends on the data required.

  • I'm very new, but ill definitely look into the array.

    I currently use the 1st suggestion, where I set a global variable to a random number and set the guns properties according to the number.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The array works like a table of properties, so weapon 1 is on row 1, weapon 2 is on row 2 etc, that's how they relate to the weapon global variable in the event. Each column is different properties so 1st column could be name, 2nd column damage etc

    Then for the one event that assigns all is like an equip weapon function - using my example above, set weapon name to array.at(var,0) and set weapon damage to array.at(var,1) with the variable var giving the row/weapon

    You could attempt this with a few weapon examples. Create an array file in the side bar. On start of layout Load array file into the array. That fills the array with the table of data. When you see it working with a few then all you need to do is add more weapons to the file.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)