• 🏆 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] Problem with multiple executions of For Each Integer (A) and changing unit ownership removes order

Status
Not open for further replies.
Level 2
Joined
Dec 21, 2018
Messages
12
Hello everyone,

I am editing a map and I currently have two problems which I unfortunately cannot fix on my own. I was wondering if you are able to help and if yes I will be extremely grateful.

The first problem is I have a trigger when a player leaves to change ownership of each unit to a random teammate:
Code:
Unit Group - Pick every unit in (Units owned by Player 1 (Red)) and do (Actions)
    Loop - Actions
        Unit - Change ownership of (Picked unit) to (Random player from (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing)))) and Change color
This trigger works, but I noticed that the units changing owner will stop doing their order. Is there a way that I can change the ownership of the units and have them continue with their order as if nothing happened?

The second problem I have is with a trigger that spawns units for players 1-8:
Code:
For each (Integer A) from 1 to 8, do (Actions)
    Loop - Actions
        Unit - Create 10 Guards for (Player((Integer A))) at (Center of Spawn <gen>) facing Default building facing degrees
        Unit Group - Order (Last created unit group) to Attack-Move To ((Owner of (Last created unit)) start location)
What happens is that the trigger works and it has a wait function where it repeats the action with a wait of 2 minutes before creating stronger guards. I have noticed that when the trigger is triggered, other For Each Integer A will interfere and reset other currently running loops. I have tried to Google this and I think I need to do a local variable. Is this correct and how would I do that?

Thank you for reading this.
 
Status
Not open for further replies.
Top