• 🏆 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] Reincarnation/Continuing Movement.

Status
Not open for further replies.
Level 5
Joined
Jun 8, 2009
Messages
101
In my current project I've come to a stand still in my triggering.

I have Computer owned guards patrolling the streets of my City. I have a skill on them Reincarnation that revives them 30 seconds after they die. The thing is, when they die, They come back and don't continue thier movements. I've tried Triggers like

Unit begins casting ability....
Unit begins effect of ability...
Unit Finishes Casting ability....

My conditions were
Casting Unit owned by player 11 = true
and
Casting unit is Town Guard = True

etc... etc...

I don't necessarily want them to continue patrol from where they are at, It would be great to have.

That or Them Reviving back at the guards original Spawn Point and continuing.

Note that I have them on Revive to Not Give robbers Exp.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
The unit type of your guards should replace Footman here. Temp_Loc_1 is the default position of the unit, Temp_Loc_2 is the patrol to location. You need to manually set them for each unit, I just used the same location for all units here.

  • Default Loc
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Set Temp_Group = (Units in Region 004 <gen> matching ((Unit-type of (Matching unit)) Equal to Footman))
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Set Temp_Loc_1 = (Position of (Picked unit))
          • Set Temp_Loc_2 = (Center of Region 003 <gen>)
          • -------- -------------------- --------
          • Unit - Order (Picked unit) to Patrol To Temp_Loc_2
          • -------- -------------------- --------
          • Hashtable - Save Handle OfTemp_Loc_1 as (Key defaultPos) of (Key (Picked unit)) in Order_Hash
          • Hashtable - Save Handle OfTemp_Loc_2 as (Key patTo) of (Key (Picked unit)) in Order_Hash
      • Custom script: call DestroyGroup(udg_Temp_Group)

Now a new unit is created, and it attack moves to the start position of the dying guard, and proceeds to patrol the same route.

  • Do THis Do That
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Footman
    • Actions
      • Wait 1.00 seconds
      • -------- -------------------- --------
      • Set Temp_Loc_1 = (Position of (Triggering unit))
      • Set Temp_Loc_3 = (Load (Key defaultPos) of (Key (Triggering unit)) in Order_Hash)
      • Set Temp_Loc_4 = (Load (Key patTo) of (Key (Triggering unit)) in Order_Hash)
      • -------- -------------------- --------
      • Unit - Create 1 (Unit-type of (Triggering unit)) for (Owner of (Triggering unit)) at Temp_Loc_1 facing (Facing of (Triggering unit)) degrees
      • Unit - Set life of (Last created unit) to 10.00
      • -------- -------------------- --------
      • Hashtable - Save Handle OfTemp_Loc_3 as (Key defaultPos) of (Key (Last created unit)) in Order_Hash
      • Hashtable - Save Handle OfTemp_Loc_4 as (Key patTo) of (Key (Last created unit)) in Order_Hash
      • -------- -------------------- --------
      • Unit - Order (Last created unit) to Attack-Move To Temp_Loc_3
      • -------- -------------------- --------
      • Custom script: call RemoveLocation(udg_Temp_Loc_1)
      • -------- -------------------- --------
      • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in Order_Hash

Add all patrol start locations to events. Maybe even add a check that the entered rect is the unit's starting loc.

  • Unit At Patrol Start
    • Events
      • Unit - A unit enters Region 004 <gen>
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Footman
    • Actions
      • Set Temp_Loc_4 = (Load (Key patTo) of (Key (Triggering unit)) in Order_Hash)
      • -------- -------------------- --------
      • Unit - Order (Triggering unit) to Patrol To Temp_Loc_4
      • -------- -------------------- --------
      • Custom script: call RemoveLocation(udg_Temp_Loc_1)

And initialize the hashtable at map initialization trigger:

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Order_Hash = (Last created hashtable)
 
Last edited:
Status
Not open for further replies.
Top