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

[Solved] Random region teleport unit

Status
Not open for further replies.
Level 1
Joined
Jun 18, 2015
Messages
6
This is my first post so i will be quick about it
i found some trigger about random region teleport unit on map,the problem is that i dont understand some parts of that trigger,its someting like this:
for example when unit enter region teleport him to one of 3 random regions
the first part of trigger is:

Events
Map initialization
Conditions
Actions
Set Random_Regon[1] = (Region 1)
Set Random_Regon[2] = (Region 2)
Set Random_Regon[3] = (Region 3)
where Random_Regon[1],Random_Regon[2],Random_Regon[3] is Region Array variables.

now the second part is for spawning and i need to be for teleport:

Events
Time - Every 10.00 seconds of game time
Conditions
Actions
Set RandomRegion = (Center of Region[(Random interger number between 1 and 3)])
Unit - Create 1 Footman for Player 1 (Red) at RandomRegion facing Default building facing degrees
Custom script: call RemoveLocation(udg_Random_Region)

and the part i dont understand is:
Set RandomRegion = (Center of Region[(Random interger number between 1 and 3)])
i see that "RandomRegion" is variable but i dont know what kind,and i cant find this command:
"(Center of Region[(Random interger number between 1 and 3)])"
so if anyone know to explain me details how to make this trigger.
 
Level 12
Joined
May 22, 2015
Messages
1,051
RandomRegion there should be a point variable.

This line will probably cause problems:
Custom script: call RemoveLocation(udg_Random_Region)
It is trying to delete a point with your region array. I don't know what will happen but it's probably not good.

Make a new point variable and call it RandomPoint or something and change the second trigger actions to:
Set RandomPoint = (Center of Random_Region[(Random interger number between 1 and 3)])
Unit - Create 1 Footman for Player 1 (Red) at RandomPoint facing Default building facing degrees
Custom script: call RemoveLocation(udg_RandomPoint)
 
Level 1
Joined
Jun 18, 2015
Messages
6
okay i make first part
Events
Map initialization
Conditions
Actions
Set region[1] = (Center of Region 005 <gen>)
Set region2[2] = (Center of Region 002 <gen>)
Set region3[3] = (Center of Region 003 <gen>)

where:region[1] is point array(1),region2[2] is point array(2),region3[3] is point array(3).and RandomPoint is point variable without array,is that okay?

and i dont know how to make:
"(Center of Random_Region[(Random interger number between 1 and 3)])"
i dont know what is command name of this part
i used command "set variable"
Set variable=value
for variable i set RandomPoint but for value i dont know what to set.
 
Level 12
Joined
May 22, 2015
Messages
1,051
Okay that is not exactly what I had in mind, but it is actually more efficient lol. Let's roll with this.

First, you only need one point array. That is what arrays are for :) So just use the one called 'region'. You don't need region2 and region3. Your first trigger should look like this:
  • Events
    • Map initialization
  • Conditions
  • Actions
    • Set region[1] = (Center of Region 005 <gen>)
    • Set region[2] = (Center of Region 002 <gen>)
    • Set region[3] = (Center of Region 003 <gen>)
Your second trigger will be much simpler by having them as points in the first trigger. This is all you need for the second trigger:
  • Events
    • Time - Every 10.00 seconds of game time
  • Conditions
  • Actions
    • Unit - Create 1 Footman for Player 1 (Red) at region[Random integer between 1 and 3] facing Default building facing degrees
 
Level 1
Joined
Jun 18, 2015
Messages
6
ok i understand except one part that i dont understand from begining where did you find "region[Random integer between 1 and 3]" or what command did you use?
i have several in option
Hashtable-Load Location Table
Center of Region
Random point in region
point with offset
point with polar offset
and etc....
i dont know how to make
"region[Random integer between 1 and 3]"
that is my main problem.
 
Level 12
Joined
May 22, 2015
Messages
1,051
Okay so when you see that list of options:
Hashtable-Load Location Table
Center of Region
Random point in region
point with offset
point with polar offset
and etc....

There should be another select thing above that one. It should have all of your variables. In there, you want to choose region (your variable) and then it will ask you to choose which one in the array. Then you can put in the random integer part.
 
Level 1
Joined
Jun 18, 2015
Messages
6
you mean variable and function?
so i check variable?
there is random point variable and region variable,so i select region variable
and then i dont understand this part: "then it will ask you to choose which one in the array. Then you can put in the random integer part. "
i do someting like this :
Unit - Create 1 Footman for Player 1 (Red) at region[(Random integer number between 1 and 3)] facing Default building facing degrees is this good?
 
Level 1
Joined
Jun 18, 2015
Messages
6
one more ting i dont want ot spawn unit i want it to teleport it from one location to random one of those 3 locations can you make from this

Unit - Create 1 Footman for Player 1 (Red) at region[Random integer between 1 and 3] facing Default building facing degrees
to teleport command.
 
Level 12
Joined
May 22, 2015
Messages
1,051
First you need some event that will cause the unit to teleport. You can use a Unit enters region event, for example.

  • Events
    • Unit - A unit enters MyRegion
  • Conditions
  • Actions
    • Unit - Move unit instantly to (region[(Random integer number between 1 and 3)])
 
Status
Not open for further replies.
Top