Gmod Fight Scene Idea Generator: Help with randomization.

This forum is currently in read-only mode.
From the Asset Store
3D Rendered, High Resolution elements to create an apocalytic scene or war zone
  • I am creating a Generator that can randomly generate two people that exist on the source engine, and have their names display on the screen so people can make fights in Gmod with the two characters and upload them to Youtube.

    I have it set so it randomly generates a number, 1 through 5, using "random(1.5)". However, the generation button doesn't work. It stays at "Unset".

    Here's a cap file:

    Help will be credited in the release once I finish it.

    (Dont worry, I am also using this to make games... XD)

  • "random(1.5)" does not generate a random number between 1 and 5. Use "random(5) + 1" instead.

    Random(5) will get a number between 0-4 (inclusive) which is why you must add + 1 to the end.

  • What he said, and since you were giving random() a floating-point number ( . = decimal point here, to be clear), it was generating one of those from 0 up to (not including)1.5, therefore making it impossible to match anything but the name for 1, which would still be a long-shot. Feed it an integer, and it acts as Citnarf said.

    Also, you could replace all of those events for the different names with something like this:

    + System: Is global variable 'person1_number' Greater than 0

    -> person1: Set text to {"Breen","Alyx","Barney","Freeman","Lammar"} global('person1_number')

    That expression returns the array value at the index provided, which is the global there.

    You can do a similar thing with the system expression GetToken and a string, as well. There is more info on that here: ... xpressions.

    Both of those use 1-based indices instead of 0-based.

    Anyway, I'm not looking for any credit for that.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks guys! Got it working right.

    The only reason a Decimal was used is because construct added it automatically...

    I will keep this information in Future Reference Notes on my hard drive.

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