• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Item doing random trigger

Level 3
Joined
Oct 21, 2023
Messages
25
I'm currently on updating my random unit map. I want to add items to the map that are random, but need help creating triggers for healing, damage and summoning items.

My idea: trigger does a random 1 to 9999 healing or damage (2 different items), and is an ability attached to an item. How do I make a trigger that randomizes the ability's damage or healing?

Also an item that spawns a random unit from the variable F, for the player using the item(1 to 323 units)
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,585
Item abilities are no different from a unit ability and can be treated as such:
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to YourHealAbility
  • Actions
    • Set Variable RandomReal = (Random number between 1.00 and 9999.00)
    • Unit - Set life of (Target unit of ability being cast) to (Life of (Target unit of ability being cast) + RandomReal)
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to YourDamageAbility
  • Actions
    • Set Variable RandomReal = (Random number between 1.00 and 9999.00)
    • Unit - Cause (Triggering unit) to deal RandomReal damage to (Target unit of ability being cast)...
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to YourSummonAbility
  • Actions
    • Set Variable RandomInteger = (Random number between 1 and 323)
    • Unit - Create 1 F[RandomInteger] for (Triggering player)...
    • Unit - Add Summoned classification to (Last created unit)
    • Unit - Add a 60.00 second Generic expiration timer to (Last created unit)
 
Level 3
Joined
Oct 21, 2023
Messages
25
Item abilities are no different from a unit ability and can be treated as such:
As always, thank you Uncle :thumbs_up:

One more thing...
I got an issue with my dialogue box, if I move the triggers (the file itself) and drag it to the top, it causes PvP (Trigger - Turn on GameMode02 <gen>) to trigger twice. The game thinks i'm clicking the PvP dialogue twice because I use the following trigger, and the dilogue box opens up with second options.

I've tried making a new trigger and seperate GameMode02, but then GameMode02 won't activate at all. I also uploaded the map if you want to test it, just move the Start folder at the top.

(Also in the process of cleaning up my triggers, making them better and easier to modify)

  • GameSelected
    • Events
      • Dialog - A dialog button is clicked for GameBoard
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Board_Button[1]
        • Then - Actions
          • Trigger - Run Selectmiddlearea <gen> (ignoring conditions)
          • Trigger - Turn on GameSelected 02 <gen>
          • Trigger - Turn off (This trigger)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Board_Button[2]
        • Then - Actions
          • Trigger - Run SetPvPPoint <gen> (ignoring conditions)
          • Trigger - Turn on GameMode02 <gen>
          • Trigger - Turn off (This trigger)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Board_Button[3]
        • Then - Actions
          • Trigger - Run Allenemy <gen> (ignoring conditions)
          • Trigger - Run SetWinPoint <gen> (ignoring conditions)
          • Trigger - Turn on GameMode03 <gen>
          • Trigger - Turn off If Enter <gen>
          • Trigger - Turn off (This trigger)
        • Else - Actions
  • SetPvPPoint
    • Events
    • Conditions
    • Actions
      • Dialog - Clear GameBoard
      • Dialog - Change the title of GameBoard to Team Life Point
      • Dialog - Create a dialog button for GameBoard labelled 25
      • Set VariableSet Board_Button[1] = (Last created dialog Button)
      • Dialog - Create a dialog button for GameBoard labelled 50
      • Set VariableSet Board_Button[2] = (Last created dialog Button)
      • Dialog - Create a dialog button for GameBoard labelled 75
      • Set VariableSet Board_Button[3] = (Last created dialog Button)
      • Dialog - Create a dialog button for GameBoard labelled 100
      • Set VariableSet Board_Button[4] = (Last created dialog Button)
      • Dialog - Create a dialog button for GameBoard labelled 125
      • Set VariableSet Board_Button[5] = (Last created dialog Button)
      • Dialog - Create a dialog button for GameBoard labelled 150
      • Set VariableSet Board_Button[6] = (Last created dialog Button)
      • Dialog - Create a dialog button for GameBoard labelled 175
      • Set VariableSet Board_Button[7] = (Last created dialog Button)
      • Dialog - Create a dialog button for GameBoard labelled 200
      • Set VariableSet Board_Button[8] = (Last created dialog Button)
      • Dialog - Show GameBoard for Host
Which causes it to trigger this twice:

  • GameMode02
    • Events
      • Dialog - A dialog button is clicked for GameBoard
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Board_Button[1]
        • Then - Actions
          • Set VariableSet VersusLife[1] = 25
          • Set VariableSet VersusLife[2] = 25
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Board_Button[2]
        • Then - Actions
          • Set VariableSet VersusLife[1] = 50
          • Set VariableSet VersusLife[2] = 50
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Board_Button[3]
        • Then - Actions
          • Set VariableSet VersusLife[1] = 75
          • Set VariableSet VersusLife[2] = 75
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Board_Button[4]
        • Then - Actions
          • Set VariableSet VersusLife[1] = 100
          • Set VariableSet VersusLife[2] = 100
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Board_Button[5]
        • Then - Actions
          • Set VariableSet VersusLife[1] = 125
          • Set VariableSet VersusLife[2] = 125
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Board_Button[6]
        • Then - Actions
          • Set VariableSet VersusLife[1] = 150
          • Set VariableSet VersusLife[2] = 150
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Board_Button[7]
        • Then - Actions
          • Set VariableSet VersusLife[1] = 175
          • Set VariableSet VersusLife[2] = 175
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Board_Button[8]
        • Then - Actions
          • Set VariableSet VersusLife[1] = 200
          • Set VariableSet VersusLife[2] = 200
        • Else - Actions
      • Quest - Display to (All players) the Quest Discovered message: (|cFF00FFFF + ((Name of Host) + select PvP Mode.|r))
      • Quest - Display to (All players) the Quest Discovered message: (|cFF00FFFF + (Team Life: + (String(VersusLife[1]))))
      • Unit - Remove Main Castle 0000 <gen> from the game
      • Unit - Remove Main Castle 0001 <gen> from the game
      • Player Group - Pick every player in (All players) and do (Player - Turn Gives bounty On for (Picked player))
      • Trigger - Run OpenMiddle <gen> (ignoring conditions)
      • Unit - Make Main Castle 0000 <gen> Invulnerable
      • Unit - Make Main Castle 0001 <gen> Invulnerable
      • Trigger - Run PointBoard <gen> (ignoring conditions)
      • Trigger - Turn on PointLose <gen>
      • Trigger - Turn on VersusCheck <gen>
      • Trigger - Turn on IfPlayerUnitDie <gen>
      • Unit - Move Circle of Power 0006 <gen> instantly to (Center of VWest1 <gen>)
      • Unit - Move Circle of Power 0007 <gen> instantly to (Center of VWest2 <gen>)
      • Unit - Move Circle of Power 0008 <gen> instantly to (Center of VWest3 <gen>)
      • Unit - Move Circle of Power 0005 <gen> instantly to (Center of VWest4 <gen>)
      • Unit - Move Circle of Power 0004 <gen> instantly to (Center of VWest5 <gen>)
      • -------- ------------------------------------------------------------------------ --------
      • Unit - Move Circle of Power 0013 <gen> instantly to (Center of VEast1 <gen>)
      • Unit - Move Circle of Power 0012 <gen> instantly to (Center of VEast2 <gen>)
      • Unit - Move Circle of Power 0011 <gen> instantly to (Center of VEast3 <gen>)
      • Unit - Move Circle of Power 0010 <gen> instantly to (Center of VEast4 <gen>)
      • Unit - Move Circle of Power 0009 <gen> instantly to (Center of VEast5 <gen>)
      • -------- ----------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 2 (Blue) slot status) Equal to Is playing
        • Then - Actions
          • Unit - Create 1 F[(Random integer number between 1 and Z)] for Player 2 (Blue) at (Center of VWest1 <gen>) facing Default building facing degrees
          • Set VariableSet VSUnit[1] = (Last created unit)
          • Unit Group - Add (Last created unit) to PointLostUnit[1]
          • Player Group - Pick every player in Player Group - Player 2 (Blue) and do (Camera - Pan camera for Player 2 (Blue) to (Position of (Last created unit)) over 0.50 seconds)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 3 (Teal) slot status) Equal to Is playing
        • Then - Actions
          • Unit - Create 1 F[(Random integer number between 1 and Z)] for Player 3 (Teal) at (Center of VWest2 <gen>) facing Default building facing degrees
          • Set VariableSet VSUnit[2] = (Last created unit)
          • Unit Group - Add (Last created unit) to PointLostUnit[1]
          • Player Group - Pick every player in Player Group - Player 3 (Teal) and do (Camera - Pan camera for Player 3 (Teal) to (Position of (Last created unit)) over 0.50 seconds)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 4 (Purple) slot status) Equal to Is playing
        • Then - Actions
          • Unit - Create 1 F[(Random integer number between 1 and Z)] for Player 4 (Purple) at (Center of VWest3 <gen>) facing Default building facing degrees
          • Set VariableSet VSUnit[3] = (Last created unit)
          • Unit Group - Add (Last created unit) to PointLostUnit[1]
          • Player Group - Pick every player in Player Group - Player 4 (Purple) and do (Camera - Pan camera for Player 4 (Purple) to (Position of (Last created unit)) over 0.50 seconds)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 5 (Yellow) slot status) Equal to Is playing
        • Then - Actions
          • Unit - Create 1 F[(Random integer number between 1 and Z)] for Player 5 (Yellow) at (Center of VWest4 <gen>) facing Default building facing degrees
          • Set VariableSet VSUnit[4] = (Last created unit)
          • Unit Group - Add (Last created unit) to PointLostUnit[1]
          • Player Group - Pick every player in Player Group - Player 5 (Yellow) and do (Camera - Pan camera for Player 5 (Yellow) to (Position of (Last created unit)) over 0.50 seconds)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 6 (Orange) slot status) Equal to Is playing
        • Then - Actions
          • Unit - Create 1 F[(Random integer number between 1 and Z)] for Player 6 (Orange) at (Center of VWest5 <gen>) facing Default building facing degrees
          • Set VariableSet VSUnit[5] = (Last created unit)
          • Unit Group - Add (Last created unit) to PointLostUnit[1]
          • Player Group - Pick every player in Player Group - Player 6 (Orange) and do (Camera - Pan camera for Player 6 (Orange) to (Position of (Last created unit)) over 0.50 seconds)
        • Else - Actions
      • -------- ----------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 8 (Pink) slot status) Equal to Is playing
        • Then - Actions
          • Unit - Create 1 F[(Random integer number between 1 and Z)] for Player 8 (Pink) at (Center of VEast1 <gen>) facing Default building facing degrees
          • Set VariableSet VSUnit[6] = (Last created unit)
          • Unit Group - Add (Last created unit) to PointLostUnit[2]
          • Player Group - Pick every player in Player Group - Player 8 (Pink) and do (Camera - Pan camera for Player 8 (Pink) to (Position of (Last created unit)) over 0.50 seconds)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 9 (Gray) slot status) Equal to Is playing
        • Then - Actions
          • Unit - Create 1 F[(Random integer number between 1 and Z)] for Player 9 (Gray) at (Center of VEast2 <gen>) facing Default building facing degrees
          • Set VariableSet VSUnit[7] = (Last created unit)
          • Unit Group - Add (Last created unit) to PointLostUnit[2]
          • Player Group - Pick every player in Player Group - Player 9 (Gray) and do (Camera - Pan camera for Player 9 (Gray) to (Position of (Last created unit)) over 0.50 seconds)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 10 (Light Blue) slot status) Equal to Is playing
        • Then - Actions
          • Unit - Create 1 F[(Random integer number between 1 and Z)] for Player 10 (Light Blue) at (Center of VEast3 <gen>) facing Default building facing degrees
          • Set VariableSet VSUnit[8] = (Last created unit)
          • Unit Group - Add (Last created unit) to PointLostUnit[2]
          • Player Group - Pick every player in Player Group - Player 10 (Light Blue) and do (Camera - Pan camera for Player 10 (Light Blue) to (Position of (Last created unit)) over 0.50 seconds)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 11 (Dark Green) slot status) Equal to Is playing
        • Then - Actions
          • Unit - Create 1 F[(Random integer number between 1 and Z)] for Player 11 (Dark Green) at (Center of VEast4 <gen>) facing Default building facing degrees
          • Set VariableSet VSUnit[9] = (Last created unit)
          • Unit Group - Add (Last created unit) to PointLostUnit[2]
          • Player Group - Pick every player in Player Group - Player 11 (Dark Green) and do (Camera - Pan camera for Player 11 (Dark Green) to (Position of (Last created unit)) over 0.50 seconds)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 12 (Brown) slot status) Equal to Is playing
        • Then - Actions
          • Unit - Create 1 F[(Random integer number between 1 and Z)] for Player 12 (Brown) at (Center of VEast5 <gen>) facing Default building facing degrees
          • Set VariableSet VSUnit[10] = (Last created unit)
          • Unit Group - Add (Last created unit) to PointLostUnit[2]
          • Player Group - Pick every player in Player Group - Player 12 (Brown) and do (Camera - Pan camera for Player 12 (Brown) to (Position of (Last created unit)) over 0.50 seconds)
        • Else - Actions
 

Attachments

  • Random Unit Game V4.5a.w3x
    9.8 MB · Views: 0
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,585
Is GameMode02 turned off by default? Because it should be.

If that doesn't work then there's a bug. You can fix it by using a Boolean variable to control when these triggers should run their Actions:
  • GameSelected
    • Events
      • Dialog - A dialog button is clicked for GameBoard
    • Conditions
      • Selecting_Life_Points Equal to False
    • Actions
      • Set Variable Selecting_Life_Points = True
      • ...
  • GameMode02
    • Events
      • Dialog - A dialog button is clicked for GameBoard
    • Conditions
      • Selecting_Life_Points Equal to True
    • Actions
      • ...
Remember, a Boolean is set to False by default. We can use it like a switch to turn things on and off as well as to track their status.
 
Last edited:
Level 3
Joined
Oct 21, 2023
Messages
25
Yeah GameMode02 is off by default, what a weird bug. I don't understand how to implement it into my triggers though. Do I set the Boolean to switch off GameMode02 in GameSelected then back on after SetPvPPoint? Then turn it on?
 
Last edited:
Level 3
Joined
Oct 21, 2023
Messages
25
I get it now, but it's not working and still activates twice. But, I understand it now. I'll try to fix it.

Did as you said:
  • GameSelected
    • Events
      • Dialog - A dialog button is clicked for GameBoard
    • Conditions
      • Selecting_Life_Points Equal to False
    • Actions
      • Set VariableSet Selecting_Life_Points = True
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Board_Button[1]
        • Then - Actions
          • Trigger - Run Selectmiddlearea <gen> (ignoring conditions)
          • Trigger - Turn on GameSelected 02 <gen>
          • Trigger - Turn off (This trigger)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Board_Button[2]
        • Then - Actions
          • Trigger - Run SetPvPPoint <gen> (ignoring conditions)
          • Trigger - Turn on GameMode02 <gen>
          • Trigger - Turn off (This trigger)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Board_Button[3]
        • Then - Actions
          • Trigger - Run Allenemy <gen> (ignoring conditions)
          • Trigger - Run SetWinPoint <gen> (ignoring conditions)
          • Trigger - Turn on GameMode03 <gen>
          • Trigger - Turn off If Enter <gen>
          • Trigger - Turn off (This trigger)
        • Else - Actions
  • GameMode02
    • Events
      • Dialog - A dialog button is clicked for GameBoard
    • Conditions
      • Selecting_Life_Points Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Board_Button[1]
        • Then - Actions
          • Set VariableSet VersusLife[1] = 25
          • Set VariableSet VersusLife[2] = 25
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Board_Button[2]
        • Then - Actions
          • Set VariableSet VersusLife[1] = 50
          • Set VariableSet VersusLife[2] = 50
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Board_Button[3]
        • Then - Actions
          • Set VariableSet VersusLife[1] = 75
          • Set VariableSet VersusLife[2] = 75
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Board_Button[4]
        • Then - Actions
          • Set VariableSet VersusLife[1] = 100
          • Set VariableSet VersusLife[2] = 100
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Board_Button[5]
        • Then - Actions
          • Set VariableSet VersusLife[1] = 125
          • Set VariableSet VersusLife[2] = 125
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Board_Button[6]
        • Then - Actions
          • Set VariableSet VersusLife[1] = 150
          • Set VariableSet VersusLife[2] = 150
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Board_Button[7]
        • Then - Actions
          • Set VariableSet VersusLife[1] = 175
          • Set VariableSet VersusLife[2] = 175
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Board_Button[8]
        • Then - Actions
          • Set VariableSet VersusLife[1] = 200
          • Set VariableSet VersusLife[2] = 200
        • Else - Actions
      • Quest - Display to (All players) the Quest Discovered message: (|cFF00FFFF + ((Name of Host) + select PvP Mode.|r))
      • Quest - Display to (All players) the Quest Discovered message: (|cFF00FFFF + (Team Life: + (String(VersusLife[1]))))
      • Unit - Remove Main Castle 0000 <gen> from the game
      • Unit - Remove Main Castle 0001 <gen> from the game
      • Player Group - Pick every player in (All players) and do (Player - Turn Gives bounty On for (Picked player))
      • Unit - Make Main Castle 0000 <gen> Invulnerable
      • Unit - Make Main Castle 0001 <gen> Invulnerable
      • Trigger - Run PointBoard <gen> (ignoring conditions)
      • Trigger - Turn on PointLose <gen>
      • Trigger - Turn on VersusCheck <gen>
      • Trigger - Turn on IfPlayerUnitDie <gen>
      • Unit - Move Circle of Power 0006 <gen> instantly to (Center of VWest1 <gen>)
      • Unit - Move Circle of Power 0007 <gen> instantly to (Center of VWest2 <gen>)
      • Unit - Move Circle of Power 0008 <gen> instantly to (Center of VWest3 <gen>)
      • Unit - Move Circle of Power 0005 <gen> instantly to (Center of VWest4 <gen>)
      • Unit - Move Circle of Power 0004 <gen> instantly to (Center of VWest5 <gen>)
      • -------- ------------------------------------------------------------------------ --------
      • Unit - Move Circle of Power 0013 <gen> instantly to (Center of VEast1 <gen>)
      • Unit - Move Circle of Power 0012 <gen> instantly to (Center of VEast2 <gen>)
      • Unit - Move Circle of Power 0011 <gen> instantly to (Center of VEast3 <gen>)
      • Unit - Move Circle of Power 0010 <gen> instantly to (Center of VEast4 <gen>)
      • Unit - Move Circle of Power 0009 <gen> instantly to (Center of VEast5 <gen>)
      • -------- ----------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 2 (Blue) slot status) Equal to Is playing
        • Then - Actions
          • Unit - Create 1 F[(Random integer number between 1 and Z)] for Player 2 (Blue) at (Center of VWest1 <gen>) facing Default building facing degrees
          • Set VariableSet VSUnit[1] = (Last created unit)
          • Unit Group - Add (Last created unit) to PointLostUnit[1]
          • Player Group - Pick every player in Player Group - Player 2 (Blue) and do (Camera - Pan camera for Player 2 (Blue) to (Position of (Last created unit)) over 0.50 seconds)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 3 (Teal) slot status) Equal to Is playing
        • Then - Actions
          • Unit - Create 1 F[(Random integer number between 1 and Z)] for Player 3 (Teal) at (Center of VWest2 <gen>) facing Default building facing degrees
          • Set VariableSet VSUnit[2] = (Last created unit)
          • Unit Group - Add (Last created unit) to PointLostUnit[1]
          • Player Group - Pick every player in Player Group - Player 3 (Teal) and do (Camera - Pan camera for Player 3 (Teal) to (Position of (Last created unit)) over 0.50 seconds)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 4 (Purple) slot status) Equal to Is playing
        • Then - Actions
          • Unit - Create 1 F[(Random integer number between 1 and Z)] for Player 4 (Purple) at (Center of VWest3 <gen>) facing Default building facing degrees
          • Set VariableSet VSUnit[3] = (Last created unit)
          • Unit Group - Add (Last created unit) to PointLostUnit[1]
          • Player Group - Pick every player in Player Group - Player 4 (Purple) and do (Camera - Pan camera for Player 4 (Purple) to (Position of (Last created unit)) over 0.50 seconds)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 5 (Yellow) slot status) Equal to Is playing
        • Then - Actions
          • Unit - Create 1 F[(Random integer number between 1 and Z)] for Player 5 (Yellow) at (Center of VWest4 <gen>) facing Default building facing degrees
          • Set VariableSet VSUnit[4] = (Last created unit)
          • Unit Group - Add (Last created unit) to PointLostUnit[1]
          • Player Group - Pick every player in Player Group - Player 5 (Yellow) and do (Camera - Pan camera for Player 5 (Yellow) to (Position of (Last created unit)) over 0.50 seconds)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 6 (Orange) slot status) Equal to Is playing
        • Then - Actions
          • Unit - Create 1 F[(Random integer number between 1 and Z)] for Player 6 (Orange) at (Center of VWest5 <gen>) facing Default building facing degrees
          • Set VariableSet VSUnit[5] = (Last created unit)
          • Unit Group - Add (Last created unit) to PointLostUnit[1]
          • Player Group - Pick every player in Player Group - Player 6 (Orange) and do (Camera - Pan camera for Player 6 (Orange) to (Position of (Last created unit)) over 0.50 seconds)
        • Else - Actions
      • -------- ----------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 8 (Pink) slot status) Equal to Is playing
        • Then - Actions
          • Unit - Create 1 F[(Random integer number between 1 and Z)] for Player 8 (Pink) at (Center of VEast1 <gen>) facing Default building facing degrees
          • Set VariableSet VSUnit[6] = (Last created unit)
          • Unit Group - Add (Last created unit) to PointLostUnit[2]
          • Player Group - Pick every player in Player Group - Player 8 (Pink) and do (Camera - Pan camera for Player 8 (Pink) to (Position of (Last created unit)) over 0.50 seconds)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 9 (Gray) slot status) Equal to Is playing
        • Then - Actions
          • Unit - Create 1 F[(Random integer number between 1 and Z)] for Player 9 (Gray) at (Center of VEast2 <gen>) facing Default building facing degrees
          • Set VariableSet VSUnit[7] = (Last created unit)
          • Unit Group - Add (Last created unit) to PointLostUnit[2]
          • Player Group - Pick every player in Player Group - Player 9 (Gray) and do (Camera - Pan camera for Player 9 (Gray) to (Position of (Last created unit)) over 0.50 seconds)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 10 (Light Blue) slot status) Equal to Is playing
        • Then - Actions
          • Unit - Create 1 F[(Random integer number between 1 and Z)] for Player 10 (Light Blue) at (Center of VEast3 <gen>) facing Default building facing degrees
          • Set VariableSet VSUnit[8] = (Last created unit)
          • Unit Group - Add (Last created unit) to PointLostUnit[2]
          • Player Group - Pick every player in Player Group - Player 10 (Light Blue) and do (Camera - Pan camera for Player 10 (Light Blue) to (Position of (Last created unit)) over 0.50 seconds)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 11 (Dark Green) slot status) Equal to Is playing
        • Then - Actions
          • Unit - Create 1 F[(Random integer number between 1 and Z)] for Player 11 (Dark Green) at (Center of VEast4 <gen>) facing Default building facing degrees
          • Set VariableSet VSUnit[9] = (Last created unit)
          • Unit Group - Add (Last created unit) to PointLostUnit[2]
          • Player Group - Pick every player in Player Group - Player 11 (Dark Green) and do (Camera - Pan camera for Player 11 (Dark Green) to (Position of (Last created unit)) over 0.50 seconds)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 12 (Brown) slot status) Equal to Is playing
        • Then - Actions
          • Unit - Create 1 F[(Random integer number between 1 and Z)] for Player 12 (Brown) at (Center of VEast5 <gen>) facing Default building facing degrees
          • Set VariableSet VSUnit[10] = (Last created unit)
          • Unit Group - Add (Last created unit) to PointLostUnit[2]
          • Player Group - Pick every player in Player Group - Player 12 (Brown) and do (Camera - Pan camera for Player 12 (Brown) to (Position of (Last created unit)) over 0.50 seconds)
        • Else - Actions
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,585
Try adding a Wait 0.01 seconds before setting the variable to True.
  • GameSelected
    • Events
      • Dialog - A dialog button is clicked for GameBoard
    • Conditions
      • Selecting_Life_Points Equal to False
    • Actions
      • ...
      • Wait 0.01 seconds
      • Set Variable Selecting_Life_Points = True
      • Dialog - Show GameBoard for Host
You could also Show the Dialog AFTER the Wait rather than inside of your SetPvPPoint trigger. This way you give it time to take effect.

Also, make sure you aren't Turning Off these triggers anymore - maybe that's interfering somehow despite the bug (if there even is a bug).
 
Level 3
Joined
Oct 21, 2023
Messages
25
Adding a timer before <Set Variable Selecting_Life_Points = True> worked, lol. Thanks! I guess timers are important between actions. Also removed the Turning Off triggers.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,585
Adding a timer before <Set Variable Selecting_Life_Points = True> worked, lol. Thanks! I guess timers are important between actions. Also removed the Turning Off triggers.
What was happening was GameSelected and GameMode02 were both running at the same time when you clicked a Dialog button. But two things can't happen at once - so GameSelected ran first THEN GameMode02 executed immediately after it. The problem was that GameSelected was setting Selecting_Life_Points to True, allowing GameMode02 to run just fine.

But now with a Wait (which is not a Timer btw) you prevent this from occurring since the Boolean will still be False for a moment.

Note that it's very important to Show the Dialog after the Wait and not before! There could be potential for a bug where the user presses a Dialog button for GameMode02 before the Boolean is True, causing the Dialog to close but not running any Actions.
 
Level 3
Joined
Oct 21, 2023
Messages
25
What was happening was GameSelected and GameMode02 were both running at the same time when you clicked a Dialog button. But two things can't happen at once - so GameSelected ran first THEN GameMode02 executed immediately after it. The problem was that GameSelected was setting Selecting_Life_Points to True, allowing GameMode02 to run just fine.

But now with a Wait (which is not a Timer btw) you prevent this from occurring since the Boolean will still be False for a moment.

Note that it's very important to Show the Dialog after the Wait and not before! There could be potential for a bug where the user presses a Dialog button for GameMode02 before the Boolean is True, causing the Dialog to close but not running any Actions.
I see. Just adding the timer makes clicking dialogue boxes much smoother too.

I got another trigger question. I want to make random cast spell from a specific ability, is it similar to creating a random unit? Like pick random between 1 and XX, then "ability being cast equal to S(random spell)"? Or there is more to that? I can't find a thread on it.

Or, is it simpler to make a trigger that after a unit picks up an item, chose a spell between 1 and xx that goes in the item.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,585
I see. Just adding the timer makes clicking dialogue boxes much smoother too.

I got another trigger question. I want to make random cast spell from a specific ability, is it similar to creating a random unit? Like pick random between 1 and XX, then "ability being cast equal to S(random spell)"? Or there is more to that? I can't find a thread on it.

Or, is it simpler to make a trigger that after a unit picks up an item, chose a spell between 1 and xx that goes in the item.
The only way to cast extra spells is to use a Dummy unit to cast them for you. This would be done using triggers, so the idea would be: You cast your specific ability, create a Dummy unit, add your random ability to it, and order it to cast said ability.

This entire process can be done fairly easily with some Arrays to track the random Abilities plus their Order ids and the use of Custom Script to issue the cast order since GUI doesn't offer full control over orders.

For the item question, you could try adding Abilities to the Item like this:
  • Untitled Trigger 001
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Item - Create Claws of Attack +15 at (Center of (Playable map area))
      • Item - Set Item: (Last created item)'s Boolean Field: Actively Used ('iusa') to Value: True
      • Item - For Item: (Last created item), Add Ability: Berserk (item)
I never tested this Add Ability Action but it should work.

So the Item could be missing an active Ability by default and when it's first created you generate one at random. Again, Arrays come to mind to track the different Abilities and other important settings like Cooldown Group if need be.
 
Level 3
Joined
Oct 21, 2023
Messages
25
The only way to cast extra spells is to use a Dummy unit to cast them for you. This would be done using triggers, so the idea would be: You cast your specific ability, create a Dummy unit, add your random ability to it, and order it to cast said ability.

This entire process can be done fairly easily with some Arrays to track the random Abilities plus their Order ids and the use of Custom Script to issue the cast order since GUI doesn't offer full control over orders.

For the item question, you could try adding Abilities to the Item like this:
  • Untitled Trigger 001
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Item - Create Claws of Attack +15 at (Center of (Playable map area))
      • Item - Set Item: (Last created item)'s Boolean Field: Actively Used ('iusa') to Value: True
      • Item - For Item: (Last created item), Add Ability: Berserk (item)
I never tested this Add Ability Action but it should work.

So the Item could be missing an active Ability by default and when it's first created you generate one at random. Again, Arrays come to mind to track the different Abilities and other important settings like Cooldown Group if need be.
I see, the dummy idea can work, but here is what I want to try and do, tried to simplified it to 3 steps. This seems simpler overall like random unit from a variable.

When an item is picked up, it chooses between 5 different items, then from 1 of those 5 preset "RItems" items randomly chosen, it gets a random spell from 25 preset "RSpell" spells. Is this possible?

something like this, random buff item is a specific item:
  • Item Type
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet RItems[0] = Random Buff Item
      • Set VariableSet RItems[1] = Random Damage Item
      • Set VariableSet RItems[2] = Random Debuff Item
      • Set VariableSet RItems[3] = Random Healing Item
      • Set VariableSet RItems[4] = Random Summon
  • Item Spawn
    • Events
      • Time - Every 30.00 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet SpawnPoint1 = (Random point in Item Spawn <gen>)
      • Item - Create RItems[(Random integer number between 0 and 4)] at SpawnPoint1
but that would require to create 100 of items, and have the game spawn them randomly
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,585
I see, the dummy idea can work, but here is what I want to try and do, tried to simplified it to 3 steps. This seems simpler overall like random unit from a variable.
I tried my idea which would've worked nicely but unfortunately all of these Set Item functions seem to be broken:
  • Random Items Setup
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Set VariableSet RI_Item_Ability[1] = Berserk (item)
      • Set VariableSet RI_Item_Name[1] = Gloves of Rage
      • Set VariableSet RI_Item_Icon[1] = ReplaceableTextures\CommandButtons\BTNBerserkForTrolls.blp
      • Set VariableSet RI_Item_Description[1] = Activate to gain bonus attack speed and take bonus damage for a duration.
      • -------- --------
      • Set VariableSet RI_Item_Ability[2] = Item Silence
      • Set VariableSet RI_Item_Name[2] = Staff of Silence
      • Set VariableSet RI_Item_Icon[2] = ReplaceableTextures\CommandButtons\BTNSilence.blp
      • Set VariableSet RI_Item_Description[2] = Activate to silence enemy units in the target area for a duration.
If it worked you would only need to update the Setup trigger to add a new item to the system.

Then you could run this Create trigger to create one at random:
  • Random Items Create
    • Events
    • Conditions
    • Actions
      • Item - Create Random Item at (Center of (Playable map area))
      • Set VariableSet RI_Item = (Last created item)
      • -------- --------
      • Set VariableSet RI_Roll = (Random integer number between 1 and 2)
      • -------- --------
      • Item - For Item: RI_Item, Add Ability: RI_Item_Ability[RI_Roll]
      • Item - Set Icon Path of RI_Item to RI_Item_Icon[RI_Roll]
      • Item - Set Name of RI_Item to RI_Item_Name[RI_Roll]
      • Item - Set Description of RI_Item to RI_Item_Description[RI_Roll]
      • Item - Set Tooltip of RI_Item to RI_Item_Description[RI_Roll]
Maybe someone else knows how to get them to work.

Otherwise, creating a lot of different Item-Types will be necessary. Or I suppose you could use Dummy units and trigger the item abilities. But the icon/name/descriptions will be off.
 

Attachments

  • Random Item Abilities 1.w3m
    18.4 KB · Views: 0
Last edited:
Level 3
Joined
Oct 21, 2023
Messages
25
Ok thanks, it's a lot more simple than I thought.


Also I can't find the <Unit - Create 1 F[RandomInteger] for (Triggering player)...> trigger, I know it's not the whole thing. Can't find (Triggering player) either.
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to YourSummonAbility
  • Actions
    • Set Variable RandomInteger = (Random number between 1 and 323)
    • Unit - Create 1 F[RandomInteger] for (Triggering player)...
    • Unit - Add Summoned classification to (Last created unit)
    • Unit - Add a 60.00 second Generic expiration timer to (Last created unit)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,585
Use Search For Text to find an Action, don't be too specific though, the word "create" should be enough.

Alternatively, go into the Unit category to find the Action. We know it's categorized there because it says Unit - ...

(Triggering player) is an Event Response and will be in the function list among all of the other Event Responses like you see in every single Event/Condition/Action.
 
Top