• 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.

[Trigger] Rects as variables

Status
Not open for further replies.
Level 4
Joined
Jun 7, 2008
Messages
87
I'm trying to make a trigger that will cause generated peasant units to move from one rect to another. I have 9 rects, and I want it so when a unit enters a rect = peasant it will randomly choose which one to (order move) to.

I can make a unit generate at one and set it on a set course of rects that will loop back to the origional, but I wanted to make it more random. To simulate the "living city" feel.

Thank you for your time and assistance.
 
Level 4
Joined
Jun 7, 2008
Messages
87
Thats part of the problem, every time I try to make a variable I can't set the initial value to anything other then No Rect. In fact I can't even make variables that even show in the GUI for some reason.
 
Level 4
Joined
Jun 7, 2008
Messages
87
so if i enter this trigger:

Events:
Map Install
Actions:
Set (variableA) to (RectA)

and do that for each rect they will be set to variables?
 
Level 4
Joined
Jun 7, 2008
Messages
87
Um... I'm going to work on this for a while. Its not working and I don't quite even know what to ask help on so yeah lol

Thanks any way, +rep for your troubles
 
Level 28
Joined
Mar 25, 2008
Messages
2,955
Ok, first set the rects as b_a_d said.
You further need a point-variable named i.e. tmppointA and a integer-variable named i.e. int
Then do the following:

  • Events
    • Unit - A Unit enters 'your rect'
  • Conditions
    • (fill in if you want)
  • Actions
    • Set int = Random Integer number between 0 and 8
    • If
      • int equal to 0
    • Then
      • Set tmppointA = Center of Rect[0]
      • Unit - Order (Entering Unit to move to tmppointA
    • Else
      • If
        • int equal to 1
      • Then
        • Set tmppointA = Center of Rect[0]
        • Unit - Order (Entering Unit to move to tmppointA
      • Else
        • and so on
    • Custom script: call RemoveLocation(udg_tmppointA)
Shall do it ;)
 
Level 12
Joined
Mar 16, 2006
Messages
992
rect[0]= a rect
rect[1]=. ..
rect[2]=...

a unit enters a rect, move unit to rect[random integer from 0 to #]
 
Level 4
Joined
Jun 7, 2008
Messages
87
+rep for EVE-RY-ONE

I'm compiling the whole shebang at the moment but I think I got this now. I freakin love THW, do y'all sell t-shirts?
 
Status
Not open for further replies.
Top