• 🏆 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!

Simple Rolling System

This bundle is marked as awaiting update. A staff member has requested changes to it before it can be approved.
Simple Rolling System
Its a simple rolling system, when a unit use the roll ability in one item it creates a timer for all rolling players, then other players can roll that same item.
If a player try to roll another item while there is a roll ocurring an error message is displayed.
A player cant roll the same item twice.
At the end of the timer, the winning unit receives the item.
Player Roll :
  • New Roll
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Roll_ability
    • Actions
      • Set Roll_PlayerColor = (Player number of (Owner of (Casting unit)))
      • Set Rolling_Unit[Roll_PlayerColor] = (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Flag_Roll[Roll_PlayerColor] Equal to False
          • (Remaining time for timer) Less than or equal to 0.00
        • Then - Actions
          • Set rolled_item = (Target item of ability being cast)
          • Set Roll_Player[Roll_PlayerColor] = (Random integer number between 1 and 100)
          • Game - Display to (All players) the text: ((Name of (Owner of (Triggering unit))) + ( Rolled: + ((String(Roll_Player[Roll_PlayerColor])) + ( for: + (Name of (Target item of ability being cast))))))
          • Countdown Timer - Start timer as a One-shot timer that will expire in Roll_time seconds
          • Countdown Timer - Create a timer window for (Last started timer) with title (Rolling : + (Name of rolled_item))
          • Set Roll_Timer_Window = (Last created timer window)
          • Set Flag_Roll[Roll_PlayerColor] = True
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Flag_Roll[Roll_PlayerColor] Equal to False
              • (Remaining time for timer) Greater than or equal to 1.00
              • (Target item of ability being cast) Equal to rolled_item
            • Then - Actions
              • Set Roll_Player[Roll_PlayerColor] = (Random integer number between 1 and 100)
              • Game - Display to (All players) the text: ((Name of (Owner of (Triggering unit))) + ( Rolled: + ((String(Roll_Player[Roll_PlayerColor])) + ( for: + (Name of (Target item of ability being cast))))))
              • Set Flag_Roll[Roll_PlayerColor] = True
            • Else - Actions
              • Game - Display to (All players matching ((Owner of (Triggering unit)) Equal to (Matching player))) the text: Wait for the curren...
  • Roll Win
    • Events
      • Time - timer expires
    • Conditions
    • Actions
      • Set Winner_Roll = 0
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Roll_Player[(Integer A)] Greater than Roll_Player[Winner_Roll]
            • Then - Actions
              • Set Winner_Roll = (Integer A)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Roll_Player[(Integer A)] Equal to Roll_Player[Winner_Roll]
                • Then - Actions
                  • Set Flag_Draw = True
                • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Flag_Draw Equal to True
        • Then - Actions
          • Set Flag_Draw = False
          • Game - Display to (All players) the text: Draw! Roll Again!
        • Else - Actions
          • Set Roll_Position[Winner_Roll] = (Position of Rolling_Unit[Winner_Roll])
          • Game - Display to (All players) the text: ((Name of (Owner of Rolling_Unit[Winner_Roll])) + ( Won the item: + (Name of rolled_item)))
          • Item - Move rolled_item to Roll_Position[Winner_Roll]
          • Unit - Order Rolling_Unit[Winner_Roll] to Right-Click rolled_item
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Set Flag_Roll[(Integer A)] = False
          • Set Roll_Player[(Integer A)] = 0
      • Countdown Timer - Destroy Roll_Timer_Window
      • Set rolled_item = No item
      • Custom script: call RemoveLocation (udg_Roll_Position[udg_Winner_Roll])
To import, all you have to do is Enable automaticaly create unknown variables while pasting trigger data, copy the triggers and the spell to your map, and put the spell in a unit.
Contents

Just another Warcraft III map (Map)

Reviews
DD_legionTN
Not a bad idea, but there are some flaws you will need to fix for this system. Need Fix : 1. If player red rolls 10, player blue rolls 10, and another player rolls 50, the result will still be draw. 2. Game - Display to (All players matching ((Owner...
Level 10
Joined
Oct 5, 2008
Messages
355
The idea for the System is actually ok, but i think there are some flaws in this system.
Firstly, the item can just be picjed up, making the reason why you roll for it pretty nuch obsolete, because then the fastest one gets it (e.g. thats the case in Diablo 2)
When a Unit gains the item and drops it, anyone else can pick it up easiely. Or roll for it, for thst matter.

So what is firstly needed is any kind of saving system for the ownership of an item.


Secondly, you quite sigmificantly shorten the code of the Winning Event by using a loop and Arrays.

Eg:

Set Winning.Player = 0.

For each Loop.Integer from 1 to 12, do actions:
If Player.Roll[Loop.Integer] greater than Player.Roll[Winning.Player]
Then do:
Set Winning.Player = Loop.Integer

Arrays could also be used to unify all the Roll-Trigger into a single one.

Thirdly, the action of the kind:
Item - Move rolled_item to (Position of rolling_green)
Are leaking a location (Position of rolling_green)

The last thing that can be changed is making some Initialisation variables, so you can adjust the System to your liking. Like storing which spell is the roll spell or how long does the timer last. It makes implenenting the system much easier.

Overall, i recommend that you keep working on the system, because it got potential. Try to look up Tutorials for the use of arrays, loops and memory leaks, so you can grab a grasp of what can be done.
If yoz got questions, dont scare away from bringing them up in the Trigger help zone :).

By the way, im currently on the mobile phone, so sorry if this text isnt nicely formated and the help in the coding examples are quite short.
 
Level 2
Joined
Mar 7, 2011
Messages
15
Thanks very much for the reply, i'll be working on the leaks arrays and configurable initialisation, and reguarding the player picking up the item, if you test it you will notice that even if someone loots the item if its beeing rolled, after the roll the item aways goes to the victory player, also if you want a RPG game you could put the itens into a unreachable place, so only trough rolls you could get the itens so i dont think that is a problem, but i'll see what i can do.
 
Level 2
Joined
Mar 7, 2011
Messages
15
Thanks Very much for the suggestions, after learning a bit of arrays i've seen how much better and easier it is, and how much that will make all my maps better! Remade the system, and it works.... the only thing i could not make was the lock item thing for i dont know how to do that...
 
Some quick notes:
- You can use triggering unit instead of casting unit
- You need a consistent prefix (at least 3 characters long) for all your variables
- This system doesn't resolve equal rolls properly (player 1 will always win on an 100 roll regardless of if every other player also rolls an 100)
- You shouldn't destroy "last created timer window" you need to destroy the timer window used by the system specifically otherwise you'll get system collisions
- Use your references more, e.g. rolled_item is stored but when you want to get the name you don't reference that variable and instead use target item of ability being cast again
 
Level 11
Joined
Dec 19, 2012
Messages
411
Not a bad idea, but there are some flaws you will need to fix for this system.

Need Fix :
1. If player red rolls 10, player blue rolls 10, and another player rolls 50, the result will still be draw.
2.
  • Game - Display to (All players matching ((Owner of (Triggering unit)) Equal to (Matching player))) the text: Wait for the curren...
can just be
  • Game - Display to (Player group((Owner of (Triggering unit)))) the text: Wait for the curren...
But player group would leak, remember to clear the leak.
3. You might need to store repeated function calls into a temporary variable, not only for speed gaining, but for readability, optimizing and also develop a good habit.

Suggestions :
1. Roll result is calculated after the timer expired, maybe you could change it to after all existing player completed the rolls, directly calculate the result and give the item to winner. If you consider doing this, then you may need to implement "Give Up Roll" as there may present player wouldn't need or wouldn't want the item.
2. Perhaps adding that to enable various multiple rolls occurring at the same time for different items, but this would change the system drastically.
 
Top