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

Possession Help

Status
Not open for further replies.
Level 2
Joined
Dec 13, 2010
Messages
4
I'm designing a neutral hostile unit that will only be able to possess other units. The problem I'm running into is it won't cast possession unless I enable an attack with damage.

Is there any way to get them to immediately attempt to possess a unit without them having an attack?

Seems like there should be I just can't figure it out.
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
There are two ways you can do this that requires using a trigger.
1. If the unit gets attacked, order it to possess the attacker.
  • CastPossession1
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of Possession for (Triggering unit)) Greater than 0
      • ((Attacking unit) is A Hero) Equal to False
      • ((Attacking unit) is A flying unit) Equal to False
      • ((Attacking unit) is Mechanical) Equal to False
      • ((Attacking unit) is Magic Immune) Equal to False
      • ((Attacking unit) belongs to an enemy of (Triggering player)) Equal to True
      • ((Attacking unit) is Magic Immune) Equal to False
    • Actions
      • Unit - Order (Triggering unit) to Undead Banshee - Possession (Attacked unit)
  • Simple, but less versatile since the unit will only cast possession if it gets attacked.
  • Note the only necessary condition is
    • (Level of Possession for (Triggering unit)) Greater than 0
    All the other ones are there to stop the unit from trying to possess something it can't.
2. Enumerate through all units that have the ability on the map and make it possess a random nearby target.
  • CastPossession2
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by Neutral Hostile matching ((((Matching unit) is alive) Equal to True) and ((Level of Possession for (Matching unit)) Greater than 0))) and do (Actions)
        • Loop - Actions
          • Set TempLoc = (Position of (Picked unit))
          • Set TempGroup = (Units within 450.00 of TempLoc matching (((((Matching unit) is alive) Equal to True) and (((Matching unit) is Magic Immune) Equal to False)) and ((((Matching unit) is A Hero) Equal to False) and ((((Matching unit) is Mechanical) Equal to False) and ((((Match
          • Unit - Order (Picked unit) to Undead Banshee - Possession (Random unit from TempGroup)
          • Custom script: call DestroyGroup(udg_TempGroup)
          • Custom script: call RemoveLocation(udg_TempLoc)
  • A bit more complex for the sake of better control.
  • In this case, it makes the unit possess a random nearby enemy unit.
 
Status
Not open for further replies.
Top