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

Trigger For Moving To Random Region

Status
Not open for further replies.
Level 2
Joined
Aug 22, 2014
Messages
18
Hello guys! I've been away from the Warcraft III modding community for a while and i've recently returned! I'm making my own edited version of Angel Arena named LamboLighting's Hell Arena. I've been trying to make a trigger that when a character joins a specific region he will be moved to a random region between some specified ones. That is for random hero selection. I would appreciate your help and of course give credits to anyone who helps me with the trigger. Thanks in advance! :)
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
Hi, welcome back to Wacraft's Community.
First you should store your regions in variables
  • Set Region[1] = (Hero Selection 001) === First Region
  • Set Region[2] = (Hero Selection 002) === Second Region
  • Set Region[3] = (Hero Selection 003) === Third Region
  • Set RandomPoint = (Center of Region [(Random Integer from 1 to 3)]) === Here to select a random region
  • Unit - Move 'Your Hero' to Random Point instantly === Moving The Unit to the random Region
  • call RemoveLocation(udg_RandomPoint) ==== Removing the point's memory leak
Good luck in your project though :D
 
Level 2
Joined
Aug 22, 2014
Messages
18
Thanks for your quick reply! These are hashtable actions right? I can't find the set region, it has save region in actions but when i click it my editor crashes :/
Edit: Ok i've found the set value. Will try the commands now! :)
Edit 2: My problem now is when creating the "Set RandomPoint = ...." There's nowhere to select Center of Region. I've set RandomPoint as Region. What am i doing wrong here?
Edit 3: (Sorry for the too many edits) I've figured out that i should set it as point not region. My problem now is i can't find where to set "Random Integer from 1 to 3"
 
Last edited:
Level 15
Joined
Oct 29, 2012
Messages
1,474
Ok I will tell it to you briefly :
You have your regions created on your terrain , yes ? Let's assume you named each one of them 'HeroSpawnRegion 1', only the number changes. OK, you create on variable of type (Region) with an array ( Array option allows us to create just one variable instead of many ).
Now , we go to our trigger, we set variable ( Region[1] = HeroSpawnRegion 1 )
Now again set variable Region[2] = HeroSpawnRegion 2
If you have a third region again set variable Region[3] = HeroSpawnRegion 3
Now you create a point variable, without an array, that's just to directly select a random region and select its center, you set variable 'RandomPoint = (Center of (Region [X])'

It is not in the list where you find 'Playable Map area' , it's in the column above where you find 'Variables' ... When you click in the variable list , it expands, you select the variable 'Region', we go to the value between brackets which is [X], we have Region[1] and Region[2] and Region[3] set, we should select a random one between them, so we select a random array for it since they are all stored in the same Region , just a changed array,so we randomly select the array not the variable. for that , we click 'Array' or as we have here [X] value, and select from the list (Math - Random Number from 1 to 3), press Ok till you get back to the trigger editor since all values are blue and set ;)

NOTE : This is a custom script : call RemoveLocation(udg_RandomPoint) .
NOTE 2 : If nothing of the above works, I will attach a test map :p
 
Level 2
Joined
Aug 22, 2014
Messages
18
Thanks a lot man! I finally got it working all thanks to you!
Of course all credits for this trigger will go to you and when the map is at a point when i can upload it to hive workshop i hope you will check it out! ^^
 
Status
Not open for further replies.
Top