• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[Solved] Move Units from Region to Region

Level 9
Joined
Mar 26, 2020
Messages
209
i saw a similar thread of this except mine is not loop, i want it once, i have a trigger where after the player finished a quest, i want his npc to move to another region and vanish
trigger works fine, only this part, it doesnt
  • Quest test
    • Events
      • Unit - A unit enters quest trigg player <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • Item - Remove (Item carried by (Triggering unit) of type (~insert item type))
      • Item - Create Tome of Knowledge at (Center of quest trigger player <gen>)
      • Quest - Mark (Last created quest) as Completed
      • Game - Display to (All players) for 9.00 seconds the text: ~NPC dialogue
      • Trigger - Turn off (This trigger)
      • Trigger - Turn on NPC route home <gen>
  • -----------------
  • NPC route home
    • Events
      • Unit - A unit enters quest trigg player <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Passive
    • Actions
      • Wait 1.00 seconds
      • Unit - Order (Triggering unit) to Move To (Center of (~Specific Region))
      • Unit - Remove (Triggering unit) from the game
 
I see a handful of things that need attention in these triggers.

To answer your main question, if I understand correctly, you want the NPC to walk to a specific region, and then disappear when they arrive in that region, correct? Without having the full context, I have to make some assumptions about this scenario. I'm assuming that the player is supposed to deliver an item to the NPC who is already inside the region (quest trigg player). If that's the case, then there are two reasons that the trigger (NPC route home) is not working.

If (NPC route home) is initially off, and then you turn it on while the NPC is already inside (quest trigg player), the event will not fire because the NPC entered the region during map initialization, while the trigger was off. The event (Unit Enters Region) only fires at the moment that a unit transits from outside the region to inside the region; it does not continuously check whether a unit is inside or outside the region.

If my assumption is correct, then instead of turning on (NPC route home) and trusting its event to fire, you should instead have no event or condition in (NPC route home) and instead run it directly.
Also, in trigger (NPC route home), you are removing the unit immediately after issuing the move order. The unit will have no time to complete the order and will vanish instantly. You should not have the (Remove Unit) function at that place.

The best way to make this work is to have a third trigger to remove the unit, that fires when the unit enters the destination region. In order to make sure the correct unit is the one that gets removed (in case another unit like a wandering critter enters that destination first), we should be using a Unit Variable to refer to the Quest NPC.
  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set QuestNPC = Villager (Female) 0000 <gen>
  • Quest test
    • Events
      • Unit - A unit enters quest trigg player <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • Item - Remove (Item carried by (Triggering unit) of type (~insert item type))
      • Item - Create Tome of Knowledge at (Center of quest trigger player <gen>)
      • Quest - Mark (Last created quest) as Completed
      • Game - Display to (All players) for 9.00 seconds the text: ~NPC dialogue
      • Trigger - Turn off (This trigger)
      • Trigger - Run NPC route home <gen> (checking conditions)
  • NPC route home
    • Events
    • Conditions
    • Actions
      • Wait 1.00 seconds
      • Unit - Order (Triggering unit) to Move To (Center of (~Specific Region))
  • NPC arrives home
    • Events
      • Unit - A unit enters (~Specific Region)
    • Conditions
      • (Triggering unit) Equal to QuestNPC
    • Actions
      • Trigger - Turn off (This trigger)
      • Unit - Remove (Triggering unit) from the game
That should answer your main question, and I have a few other suggestions too:

In the trigger (Quest test), when a Player 1 unit arrives in the region, you remove a carried item and proceed with the rest of the actions without actually checking whether the triggering unit even has the item. That means the quest will be completed if any Player 1 unit reaches the destination, regardless of whether they're actually holding the item. Unless there's some specific reason you're doing it this way, you should probably have a condition to check this.
  • Conditions
    • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • ((Triggering unit) has an item of type (~insert item type)) Equal to True
OR
  • Conditions
    • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • ((Triggering unit) has SpecificItemVariable) Equal to True
Also, in (Quest test), you display a Game Text Message instead of using a Transmission from Unit (which would give a flashing indicator on the speaking unit, as well as show their speaking portrait in the UI). It's not critical, but I would recommend replacing
  • Actions
    • Game - Display to (All players) for 9.00 seconds the text: ~NPC dialogue
with
  • Actions
    • Cinematic - Send transmission to (All players) from QuestNPC named Joe Peasant: Play No sound and display Thanks for deliveri.... Modify duration: Set to 9.00 seconds and Don't wait
 
ohh, you are correct with the context, i thought it was clear enough, sorry about that...
i need to try the first one you said, it fits perfectly to my ends

EDIT: ok im running the editor now, Question, what variable did you use for the questnpc?
EDIT2: nvm, i found it, i dont often use variables lol, also i dont want it cinematic way, think of it like the rexxar campaign npc stuffs

Thank you very much good sir~
 
Last edited:
Back
Top