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

Make units use the "cannibalism" ability

Status
Not open for further replies.
Level 13
Joined
Jun 9, 2008
Messages
260
So on one of my maps I rely on units killing and consuming other units to stay alive, as they themselves gradually lose health.

However, it does not seem to work really well overall. One unit type occasionally does heal itself that way, but another (and yes, I checked, it has "cannibalism" as well, and belongs to the same NPC player) simply keeps on hunting or stands stupidly next to a juicy cadaver until it has starved to death.

I tried triggers to force "cannibalism", making the unit move to its own location, stop, repeatedly order "cannibalism", to no avail. I removed its attack to discourage going after dessert until it has finished its dinner.

Is there something inherent in the "cannibalism" ability, or triggering abilities in general, that I am missing here?

for reference, here is the trigger I use, though I am not convinced the trigger is really the problem, as I made the trigger in the first place precisely because the desired behaviour wasn't happening:
  • Feasting
    • Ereignisse
      • Einheit - A unit dies
    • Bedingungen
      • (Owner of (Killing unit)) Equal Spieler 7 (Green)
    • Aktionen
      • Custom script: call RemoveLocation(udg_HerdLeaderPosition)
      • Set HerdLeaderPosition = (Position of (Dying unit))
      • Set Killer = No Unit
      • Set Killer = (Killing unit)
      • Einheit - Order Killer to Move to HerdLeaderPosition
      • Einheit - Set life of Killer to ((Life of Killer) + 5.00)
      • Einheit - Remove A Predator from Killer
      • Einheit - Order Killer to Stop
      • Einheit - Order Killer to Untoten-Ghul - 'Kannibalismus'
      • Einheit - Add Attack Out to Killer
      • Einheit - Order Killer to Move to HerdLeaderPosition
      • Einheit - Set Killer movement speed to 0.00
      • Einheit - Set Killer acquisition range to 0.00
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Bedingungen
          • (Life of Killer) Greater Than ((Max. Life of HerdLeader) / 1.20)
        • 'THEN'-Aktionen
          • Einheit - Set Killer movement speed to ((Default movement speed of Killer) / 2.00)
        • 'ELSE'-Aktionen
          • Einheit - Set Killer movement speed to (Default movement speed of Killer)
      • Custom script: call RemoveLocation(udg_HerdLeaderPosition)
      • Set Killer = No Unit
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,569
I think you're under the impression that you're queuing the Orders but that's not how it works. For example, you're telling the unit to Move somewhere but then immediately telling it to Stop, the end result is it Stops.

For example, in this trigger the Footman will never Move to the center of the map since it's ordered to Stop immediately afterwards:
  • Ex 1
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Unit - Create 1 Footman for Player 1 (Red) at ((Center of (Playable map area)) offset by (-500.00, 0.00)) facing Default building facing degrees
      • Unit - Order (Last created unit) to Move To (Center of (Playable map area))
      • Unit - Order (Last created unit) to Stop.
In this trigger the Footman will never cast Thunder Clap since it's ordered to Move immediately afterwards:
  • Ex 2
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Unit - Create 1 Footman for Player 1 (Red) at ((Center of (Playable map area)) offset by (-500.00, 0.00)) facing Default building facing degrees
      • Unit - Order (Last created unit) to Human Mountain King - Thunder Clap.
      • Unit - Order (Last created unit) to Move To (Center of (Playable map area))
Also, this action looks pointless, I'm pretty sure you can delete all instances of it:
  • Set Killer = No Unit
If I were you I would track these units in a Unit Group and periodically Order them to Cannibalize. You could even check if there are nearby corpses or if their health meets a certain threshold before doing so. [db]east's method could work as well but I think the "A unit dies" Event will never really produce the results you want.
 
Last edited:
Status
Not open for further replies.
Top