• 🏆 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] Bug on escape

Status
Not open for further replies.
Level 3
Joined
Apr 27, 2008
Messages
18
Im trying to make a escape for wc3,but its a wierd bug.
On the trigger spawn it spawns and order them to patrol,but only 6 of them works.I tryed to add wait,make 1 more trigger but it still doesnt work:sad:
Trigger:(Wait 1.00 between order and next create unit)
  • Events
  • Time - Elapsed Game Time is 3.00 Seconds
  • Conditions
  • Actions
  • Unit -Create 1 Unit killer for Player 12 Brown at (Center of region) facing default facing degrees
  • Unit - Order (Last Created Unit) to Patrol to (Region)
  • Unit -Create 1 Unit killer for Player 12 Brown at (Center of region) facing default facing degrees
  • Unit - Order (Last Created Unit) to Patrol to (Region)
  • Unit -Create 1 Unit killer for Player 12 Brown at (Center of region) facing default facing degrees
  • Unit - Order (Last Created Unit) to Patrol to (Region)
  • Unit -Create 1 Unit killer for Player 12 Brown at (Center of region) facing default facing degrees
  • Unit - Order (Last Created Unit) to Patrol to (Region)
  • Unit -Create 1 Unit killer for Player 12 Brown at (Center of region) facing default facing degrees
  • Unit - Order (Last Created Unit) to Patrol to (Region)
  • Unit -Create 1 Unit killer for Player 12 Brown at (Center of region) facing default facing degrees
  • Unit - Order (Last Created Unit) to Patrol to (Region)
And its 3 mortars in it but they work fine.
Part 2 of Trigger:
  • Events
  • (Activated by other trigger)
  • Conditions
  • Actions
  • Unit -Create 1 Unit killer for Player 12 Brown at (Center of region) facing default facing degrees
  • Unit - Order (Last Created Unit) to Patrol to (Region)
  • Unit -Create 1 Unit killer for Player 12 Brown at (Center of region) facing default facing degrees
  • Unit - Order (Last Created Unit) to Patrol to (Region)
  • Trigger - Run Visiblity 1<gen> checking conditions
Trigger 1 works fine but second doesnt work(i tryed adding them to trigger 1 but it still didnt work).Any idea why?:cute:
 
Level 16
Joined
Jun 25, 2008
Messages
1,043
Can't you just
  • Untitled Trigger 001
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 8, do (Actions)
        • Loop - Actions
          • Unit - Create 1 unit killer for Player 12 (Brown) at (Center of (region)) facing Default building facing degrees
          • Unit - Order (Last created unit) to Patrol To (Center of (region))
or are you creating them at different regions?
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
Exactly.

  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Region[1] = Region 001 <gen>
      • Set Region[2] = Region 002 <gen>
      • Set Region[3] = Region 003 <gen>
      • Set Region[4] = Region 004 <gen>
      • Set Region[5] = Region 005 <gen>
      • Set Region[6] = Region 006 <gen>
And to use them in trigger with a loop, you do something like this:

  • Move Order
    • Events
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Footman for Player 1 (Red) at (Center of CreateRegion) facing 0.00 degrees
          • Unit - Order (Last created unit) to Attack-Move To (Center of Region[(Integer A)])
          • Wait 1.00 seconds
Though I don't like waits in loops but since this wait is not too samll so its ok.

Hope I have helped you. :as:
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
Umm,i do like you in the move order but it wont do anything
For each integer a from 1 to 1 (Only test on 1 has only set 1 though:)
create unit at region 004
Order unit to patrol to (center of regionvariable[(Integer A)](
Stll it doesn wotrk:)

The underlined, are they variables or not ?

Becarful, if you created a unit then didn't refer to it by a unit variable you'll need to use (Last created unit) in order to issue any order to that unit but if you will issue the order to a variable then you need to set it first to the last created unit. Like this:

  • For each (Integer A) from 1 to 6, do (Actions)
    • Loop - Actions
      • Unit - Create 1 Footman for Player 1 (Red) at (Center of CreateRegion) facing 0.00 degrees
      • Set Unit = Last created unit
      • Unit - Order Unit to Attack-Move To (Center of Region[(Integer A)])
      • Wait 1.00 seconds
As you can see you have to set the variable Unit to the Last created unit in order to use that variable otherwise it will be null.

And by the way, if you will set the loop from 1 to 1 then there is no need to use a loop at all.
 
Level 3
Joined
Apr 27, 2008
Messages
18
Result

I've done 2 triggers,1 init and 1 integer a trigger
Integer A:
  • Untitled trigger 001
  • Events
  • Conditions
  • Actions
    • For Each Integer A(From 1 to 6) Do (Actions)
      • Loop - Actions
        • Unit - Create 1 Killer for player 1 red at center of region 005
        • Set Unit = Last Creted Unit
        • Unit -Order Unit to Patrol to (Center of Region[Integer A]
Init:
  • Map INIT
  • Events
    • Map Initialazition
  • Conditions
  • Actions
    • Set Region[1] = (Region 006)
It just spawns 6 units at region 005 and nothing else:sad:
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
OK, let me try it myself. Once I get it work I'll EDIT this post.

<<EDIT>>

Don't know whats your problem but its working fine.

Click of the Variable Editor button (Ctrl + B) then click New Variable (Ctrl + N) then create a Region variable and check the Array checkbox name the variable any name you want then click [OK]. Then create those triggers, that should work.

  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Region[1] = Region 001 <gen>
      • Set Region[2] = Region 002 <gen>
      • Set Region[3] = Region 003 <gen>
      • Set Region[4] = Region 004 <gen>
      • Set Region[5] = Region 005 <gen>
      • Set Region[6] = Region 006 <gen>
  • Move Order
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Footman for Player 1 (Red) at (Center of Region 000 <gen>) facing 0.00 degrees
          • Unit - Order (Last created unit) to Patrol To (Center of Region[(Integer A)])
          • Wait 1.00 seconds
This will create 6 footmen at the same location but they will patrol to different locations. Try this and tell me if it worked or not because if it didn't work am gonna suicide :grin:.
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
the wait is ruining the loop, it happens sometimes with WE :[ try it without the wait.

Not always, in fact I found that small waits ruin it as you say but 1 second is still concidered a long delay, also I tried it and works fine for me.

And if you don't want to use wait the other alternative is a repeating timer and increase an index like the loop exactly.
 
Level 3
Joined
Apr 27, 2008
Messages
18
The patrol worked and i copied patrol trigger but i dont understand one thing with it.It looks like they can only patrol two 1 spot.If you got a trigger for making two different patrols please post them here.
This trigger makes 1 of them patrol to a spot:
  • LoL
  • Events
  • Conditions
  • Actions
    • For Each Integer A From 1 to 2 do Actions
      • Loop - Actions
        • Set Point = Center of (region(Integer A))
        • Unit -Create 1 Killer for player 12 brown at Point
        • Custom Script: Call RemoveLocation(udg_Point)
        • Set Point = Center of (Region 24)
        • Unit - Order (Last Created Unit) To Patrol to (Point)
        • Custom Script: Call RemoveLocation(udg_Point)
 
Status
Not open for further replies.
Top