• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[GUI Trigger] Random Number Rolls

Status
Not open for further replies.
Level 3
Joined
Jan 26, 2008
Messages
38
Hello everyone. I recently started creating a nostalgic Mario Party style map. I have most of the map and idea figured out, but I need help with a roadblock.

I'm trying to start the initial dice roll, where four players roll the dice to find the turn order.
I need help triggering the roller so that it doesn't repeat numbers for each player.

Currently, my dice roll will roll a random number between 1 and 10. It'll post the number above the corresponding unit's head, much like Mario Party. But sometimes, actually every time, at least two units have the same number. Is there a way to trigger it so that when it picks a random number, it removes it from the random number queue? Or does anyone have a better idea of how to go about this setup?

  • Roll Effect
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Roll
    • Actions
      • Set Roll[(Player number of (Owner of (Casting unit)))] = (Random integer number between 1 and 10)
      • Trigger - Turn off (This trigger)
 
Level 12
Joined
Sep 11, 2011
Messages
1,176
why did you set it to random number from 1 to 10 if it's only 4 player ?

here is the trigger and it's currently for 10 player, i will set it to 4 if you need so.

Map Initialization

Roll

Screenshot

  • Map Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set NumberTotal = 10
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Set Number[(Integer A)] = (Integer A)
  • Roll Start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Thunder Clap
    • Actions
      • Set Roll = (Random integer number between 1 and NumberTotal)
      • Floating Text - Create floating text that reads (String(Number[Roll])) above (Triggering unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Set Number[Roll] = Number[NumberTotal]
      • Set NumberTotal = (NumberTotal - 1)

210329-albums5809-picture62236.jpg


Variable needed :
all of them is Integer Variable.

and a test map, enjoy
 

Attachments

  • Random Rolls Fixed.w3x
    16.9 KB · Views: 96
Last edited:
You should also set at start the Number of used arrays (10 in your case), in another variable (let's call it NumberTotal)

Now, in the roll trigger, do this :

Set TempInt (or another name) = Random Number between 1 and NumberTotal (here we choose a random array for the variable)
--Put Your actions here / You will use Number[TempInt] in the actions--
...
...
...
--Now at end of the roll dice :--
Set Number[TempInt] = Number[NumberTotal] (like this, you replace the picked number by the last one from the list)
Set NumberTotal = NumberTotal - 1 (here you decrease the NumberTotal since there is one less number to roll)
 
Level 12
Joined
Sep 11, 2011
Messages
1,176
i just got owned. I wasted my time doing these if then else and alot of testing. thank you very much, Vladadamm. fixed. +rep

  • Map Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set NumberTotal = 10
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Set Number[(Integer A)] = (Integer A)


  • Roll Start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Thunder Clap
    • Actions
      • Set Roll = (Random integer number between 1 and NumberTotal)
      • Floating Text - Create floating text that reads (String(Number[Roll])) above (Triggering unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Set Number[Roll] = Number[NumberTotal]
      • Set NumberTotal = (NumberTotal - 1)
 
Level 3
Joined
Jan 26, 2008
Messages
38
To the people that misunderstood, which was pretty much everyone but Vlad, this is not a hero selection. It's a DICE ROLL. As in, you roll a 10 sided die. Mario Party is a four player game, at least the one I'm referencing.

Okay, so Venomous' trigger works, but I have an issue.
I'm trying to make the game understand who won the roll, using a playernumber integer, which clearly doesn't work.
I want to make it so that it checks for the highest roll, and sets that player to the FirstTurnPlayer. Does anyone know how to do that?
 
Last edited:
Level 3
Joined
Jan 26, 2008
Messages
38
I looked at it and tried changing it to fit my map, but I can't seem to get it to work. Remember that it's a roll between 1 and 10, not 1 and 4.

The point of the system is that when all four players roll, it takes the one with the highest roll and makes him first player, and then so on until all four players are assigned. So far, yours is perfect, except that it's only a number between 1 and 4.
I really don't feel comfortable with this because you're the only person doing this work and I apologize.

If you feel like adding that to your example, I'd be really appreciative. If you have any questions about my request, I can explain further.
 
Level 3
Joined
Jan 26, 2008
Messages
38
Yeah, I guess your right. His system does hide the number so it works out. It's the point of the system. But I think I can make it work. I'm satisfied with it.

If you haven't read my other post yet, Venom, then please don't do any more. You've done enough. Thank you very much.
 
Status
Not open for further replies.
Top