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

Make runes spawn in region in middle of map.

Level 14
Joined
Jul 19, 2007
Messages
772
I have made 5 different runes in my map and I want them to start spawning in middle of map after 5 minutes of gameplay. I also want only 1 rune to be spawned in the region at a time like in Dota. If a Hero uses the rune then I want it to wait 1 minute and then create a new rune at a random spot in the region. I have made 1 of the runes to be more rare then the rest of them so it should have less chance to be spawned than the rest 4 runes. I really have no idéa how to make this so I hope someone can help...
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
It's not too complicated once you get the hang of Arrays, For Loops, and Timers:
  • Setup First Rune
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • -------- CUSTOMIZE: --------
      • -------- ----------------------------------------------------------------------------------------------- --------
      • Set VariableSet Rune_Total_Types = 5
      • -------- --------
      • Set VariableSet Rune_Types[1] = Rune of Greater Healing
      • Set VariableSet Rune_Types[2] = Rune of Greater Mana
      • Set VariableSet Rune_Types[3] = Rune of Dispel Magic
      • Set VariableSet Rune_Types[4] = Rune of Spirit Link
      • Set VariableSet Rune_Types[5] = Rune of the Watcher
      • -------- --------
      • -------- Make sure that the chances add up to 100: --------
      • Set VariableSet Rune_Chance[1] = 25
      • Set VariableSet Rune_Chance[2] = 25
      • Set VariableSet Rune_Chance[3] = 25
      • Set VariableSet Rune_Chance[4] = 20
      • Set VariableSet Rune_Chance[5] = 5
      • -------- --------
      • Set VariableSet Rune_Point = (Center of (Playable map area))
      • -------- --------
      • -------- Create the first rune: --------
      • Countdown Timer - Start Rune_Timer as a One-shot timer that will expire in 300.00 seconds
      • -------- ----------------------------------------------------------------------------------------------- --------
      • -------- --------
      • -------- Do NOT change: --------
      • For each (Integer Rune_Index) from 2 to Rune_Total_Types, do (Actions)
        • Loop - Actions
          • Set VariableSet Rune_Chance[Rune_Index] = (Rune_Chance[Rune_Index] + Rune_Chance[(Rune_Index - 1)])
I made the first 3 runes have a 25% chance to spawn, the 4th rune has a 20% chance to spawn, and the 5th rune has a 5% chance to spawn.
  • Setup Next Rune
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-class of (Item being manipulated)) Equal to Powerup
    • Actions
      • For each (Integer Rune_Index) from 1 to Rune_Total_Types, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item being manipulated)) Equal to Rune_Types[Rune_Index]
            • Then - Actions
              • -------- Create another rune: --------
              • Countdown Timer - Start Rune_Timer as a One-shot timer that will expire in 60.00 seconds
              • Custom script: exitwhen true
            • Else - Actions
  • Spawn Rune
    • Events
      • Time - Rune_Timer expires
    • Conditions
    • Actions
      • Set VariableSet Rune_Roll = (Random integer number between 1 and 100)
      • -------- --------
      • For each (Integer Rune_Index) from 1 to Rune_Total_Types, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Rune_Roll Greater than Rune_Chance[(Rune_Index - 1)]
              • Rune_Roll Less than or equal to Rune_Chance[Rune_Index]
            • Then - Actions
              • Item - Create Rune_Types[Rune_Index] at Rune_Point
              • Custom script: exitwhen true
            • Else - Actions
You can change Rune_Point to be a Random point in your region:
  • Item - Create Rune_Types[Rune_Index] at (Random point in Region...)
 

Attachments

  • Rune System 1.w3m
    18.6 KB · Views: 1
Last edited:
Level 14
Joined
Jul 19, 2007
Messages
772
It's not too complicated once you get the hang of Arrays, For Loops, and Timers:
  • Setup First Rune
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • -------- CUSTOMIZE: --------
      • -------- ----------------------------------------------------------------------------------------------- --------
      • Set VariableSet Rune_Total_Types = 5
      • -------- --------
      • Set VariableSet Rune_Types[1] = Rune of Greater Healing
      • Set VariableSet Rune_Types[2] = Rune of Greater Mana
      • Set VariableSet Rune_Types[3] = Rune of Dispel Magic
      • Set VariableSet Rune_Types[4] = Rune of Spirit Link
      • Set VariableSet Rune_Types[5] = Rune of the Watcher
      • -------- --------
      • -------- Make sure that the chances add up to 100: --------
      • Set VariableSet Rune_Chance[1] = 25
      • Set VariableSet Rune_Chance[2] = 25
      • Set VariableSet Rune_Chance[3] = 25
      • Set VariableSet Rune_Chance[4] = 20
      • Set VariableSet Rune_Chance[5] = 5
      • -------- --------
      • Set VariableSet Rune_Point = (Center of (Playable map area))
      • -------- --------
      • -------- Create the first rune: --------
      • Countdown Timer - Start Rune_Timer as a One-shot timer that will expire in 300.00 seconds
      • -------- ----------------------------------------------------------------------------------------------- --------
      • -------- --------
      • -------- Do NOT change: --------
      • For each (Integer Rune_Index) from 2 to Rune_Total_Types, do (Actions)
        • Loop - Actions
          • Set VariableSet Rune_Chance[Rune_Index] = (Rune_Chance[Rune_Index] + Rune_Chance[(Rune_Index - 1)])
I made the first 3 runes have a 25% chance to spawn, the 4th rune has a 20% chance to spawn, and the 5th rune has a 5% chance to spawn.
  • Setup Next Rune
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-class of (Item being manipulated)) Equal to Powerup
    • Actions
      • For each (Integer Rune_Index) from 1 to Rune_Total_Types, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item being manipulated)) Equal to Rune_Types[Rune_Index]
            • Then - Actions
              • -------- Create another rune: --------
              • Countdown Timer - Start Rune_Timer as a One-shot timer that will expire in 60.00 seconds
              • Custom script: exitwhen true
            • Else - Actions
  • Spawn Rune
    • Events
      • Time - Rune_Timer expires
    • Conditions
    • Actions
      • Set VariableSet Rune_Roll = (Random integer number between 1 and 100)
      • -------- --------
      • For each (Integer Rune_Index) from 1 to Rune_Total_Types, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Rune_Roll Greater than Rune_Chance[(Rune_Index - 1)]
              • Rune_Roll Less than or equal to Rune_Chance[Rune_Index]
            • Then - Actions
              • Item - Create Rune_Types[Rune_Index] at Rune_Point
              • Custom script: exitwhen true
            • Else - Actions
You can change Rune_Point to be a Random point in your region:
  • Item - Create Rune_Types[Rune_Index] at (Random point in Region...)
Oh thank you so much! I thought it was more complicated than that.
 
Top