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