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

fallow me sheep

Status
Not open for further replies.
Level 4
Joined
Jun 14, 2008
Messages
72
i was wondering if its posable to enter a cirten spot to activate a trigger that moves a region underneath you and repeat it... then after that you tell a sheep to move to that region so its fallowing you

this is what i thought might work...
  • fallow me sheep
    • Events
      • Unit - A unit enters Region 197 <gen>
    • Conditions
    • Actions
      • Wait 1.00 seconds
      • Region - Center Region 200 <gen> on (Position of (Triggering unit))
      • Set sheep = (Triggering unit)
      • Unit - Order Sheep 0148 <gen> to Move To (Random point in Region 200 <gen>)
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Wait 2.00 seconds
          • Region - Center Region 200 <gen> on (Position of sheep)
          • Unit - Order Sheep 0148 <gen> to Move To (Random point in Region 200 <gen>)
i know its bad to put waits in a loop but...
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
You can put it in a different trigger (disabled by default) which will do the moving and ordering on a timed event (every 0.5 seconds, for example), then you will simply enable/disable it when you want to.

Why can't you just order the sheep to follow the unit, though ?
 
Level 4
Joined
Jul 24, 2008
Messages
108
Damn dude how many regions do you have on your map? but anyways, here is a tip, dont use wait functions in a for loop.
But anyways. My suggestions to keep a region under your main guys is to have a trigger like this at map init

  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set regionarray[1] = redsregion
      • Set unitarray[1] = redsunit
a unit and region array, one for each player.

this sets up for the next trigger. Understand when i trigger maps, i always look for the easiest way in making them, i hate making one for each player, so i always try to make it generic enough so that it applies to everyone.

So now we need a trigger to move the correct region to the units

  • Untitled Trigger 001
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • isinregion[(Integer A)] Equal to True
            • Then - Actions
              • Region - Center regionarray[(Integer A)] on (Position of unitarray[(Integer A)])
            • Else - Actions
This every second moves a set region to the position of a set unit only if that boolean is true. which in the next trigger we will make it true or false.

  • Untitled Trigger 002
    • Events
      • Unit - A unit enters yourregion
    • Conditions
    • Actions
      • Set isinregion[(Player number of (Owner of (Triggering unit)))] = True
      • Wait 20.00 seconds
      • Set isinregion[(Player number of (Owner of (Triggering unit)))] = False
Ok, this will proc when the unit enters the region that you first had in your trigger, it sets the value to true for the right player, which in turn will allow the move region trigger to work for that player, then i just turned it back to false 20 seconds later because it looked like it was true only temporary in your first trigger. In the above trigger you may want to use a condition saying that entering unit is equal to unitarray[owner of entering unit] so the right unit has to enter.


So now you have essentially what you orrigenally wanted, pluse it works for more than one player at a time, the only thing left is to have sheeps move to the location, which im sure you can manage to do that by your self
 
Status
Not open for further replies.
Top