• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Warp to a random region?

Status
Not open for further replies.
Level 3
Joined
Mar 30, 2007
Messages
26
Okay, I just need a simple teleportation trigger. I want it so a unit is moved to a random region.
Here is what I have right now, and it doesn't seem to be working:

Events:
A Unit enters [Region]

Action:
Unit - Move (Entering unit) instantly to (Center of [Other Region][(Random integer number between 1 and 12)])

[Other Region] is a region variable with an array size of 12, but whenever I test this in-game, my units are always only warped at [Other Region][1], and not at the arrays 2-12.

Any suggestions or solutions?

Thanks. ~Panda
 

Rui

Rui

Level 41
Joined
Jan 7, 2005
Messages
7,550
This trigger might help you:

  • PrincePanda
    • Events
      • Unit - A unit enters ([I]Region[/I])
    • Conditions
    • Actions
      • Set RandomPointInRegion = (Random point in Other_Region)
      • Unit - Move (Entering unit) instantly to RandomPointInRegion
      • Custom script: call RemoveLocation(udg_RandomPointInRegion)
The RandomPointInRegion is a variable of type Point. I must first set the RandomPointInRegion so that when I use the Move Unit instantly, the action already knows what point I am referring to. Afterwards I use the script so the memory leak is completly destroyed.
 
Level 9
Joined
Jun 26, 2007
Messages
659
Your trigger looks to be correct, the only way to make an error if you've done exactly this is a bad initialisation of the [Other Region] variable. (with some too fast cpoy-paste maybe)
can you check this?

@Rui: that's not what he wants to do ;p
 
Last edited:
Level 21
Joined
Aug 21, 2005
Messages
3,699
As Yoshiryu said, you must initialise the other Region variables in a good way: for example

  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Region[0] = Region 000 <gen>
      • Set Region[1] = Region 001 <gen>
      • Set Region[2] = Region 002 <gen>
      • Set Region[3] = Region 003 <gen>
I'd be surprised if there would still be a problem. Anyway, if that's the case, do this in your trigger:
Actions:
set Integer_Variable = (random integer between 1 and 12)
Unit - Move (Entering unit) instantly to (Center of [Other Region][(Integer_Variable)])

and for testing purposes, add the following action:

Game - text message: convert Integer (Integer_Variable) to string

This way you'll see the value of the Integer_variable after randomizing it. If it remains 1, something weird is going on...
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
because if you take 12 regions, you can place them all over the map. If you only take 1 region, it almost has to be as big as the whole map. If you use 1 region you might get unwanted effects such as units teleporting to a point on the map you do NOT want the guy to be teleported at.

a good example would be: take a portal at the center of the map. If this portal is used, the unit should teleport to one of the 4 corners of the map. How are you going to do that when using only 1 region?
 
Status
Not open for further replies.
Top