• 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.

Kills hero when item 'dies'

Status
Not open for further replies.
Level 7
Joined
May 15, 2009
Messages
192
I thought I was making a rather simple trigger which would kill a specific hero once a specific item was destroyed.

In a sort of Lich is tied to Phylactery, whomever controls the Phylactery controls the hero. And if the phylactery is destroyed, the Lich hero is removed from the game.

But the trigger to remove the Lich won't work any more, I had it working at one point though... Can anyone see anything wrong in the following? Or better yet, does anyone have an idea for a more effective/efficient system?


  • Moraenir Change Side
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Ancient Phylactery
    • Actions
      • Game - Display to (All players) the text: change
      • Unit - Change ownership of Moraenir Valdimoore (Switch Team) 0037 <gen> to (Owner of (Triggering unit)) and Change color
  • Moraenir Death
    • Events
      • Unit - A unit Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item carried by (Triggering unit) in slot 1)) Equal to Ancient Phylactery
          • (Item-type of (Item carried by (Triggering unit) in slot 2)) Equal to Ancient Phylactery
          • (Item-type of (Item carried by (Triggering unit) in slot 3)) Equal to Ancient Phylactery
          • (Item-type of (Item carried by (Triggering unit) in slot 4)) Equal to Ancient Phylactery
          • (Item-type of (Item carried by (Triggering unit) in slot 5)) Equal to Ancient Phylactery
          • (Item-type of (Item carried by (Triggering unit) in slot 6)) Equal to Ancient Phylactery
    • Actions
      • Game - Display to (All players) the text: text
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Moraenir Valdimoore (Switch Team))) and do (Actions)
        • Loop - Actions
          • Unit - Kill (Picked unit)
          • Unit - Remove (Picked unit) from the game


Help appreciated.
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
Hard to say what's wrong.
Did you change anything with this trigger? Or did it work, then you focused on creating some other unrelated triggers or imported some systems and now it doesn't work? It may be that some other trigger is affecting the second trigger.
Or does the second trigger even fire?

I suggest you try to remove the unit specifically, not by using unit group. Just like you changed ownership of specific unit (the lich), remove the lich specifically in the second trigger.

Other things:
Since it seems there's only one lich you can control, it's better efficiency-wise to save the unit into variable (instead of finding that specific unit through unit group).
Also, the whole condition block in second trigger can be changed for boolean comparison "Hero - Hero has item"
  • ((Triggering unit) has an item of type Phylactery) Equal to True
and it should still work imo
 
Level 7
Joined
May 15, 2009
Messages
192
Hard to say what's wrong.
Did you change anything with this trigger? Or did it work, then you focused on creating some other unrelated triggers or imported some systems and now it doesn't work? It may be that some other trigger is affecting the second trigger.
Or does the second trigger even fire?

I suggest you try to remove the unit specifically, not by using unit group. Just like you changed ownership of specific unit (the lich), remove the lich specifically in the second trigger.

Other things:
Since it seems there's only one lich you can control, it's better efficiency-wise to save the unit into variable (instead of finding that specific unit through unit group).
Also, the whole condition block in second trigger can be changed for boolean comparison "Hero - Hero has item"
  • ((Triggering unit) has an item of type Phylactery) Equal to True
and it should still work imo

Thanks for the last tip on the boolean, will implement that.

And if memory serves, the only thing I did to make the trigger malcfunction was:

Add the Change Owner trigger
Place a unit on the map carrying the item (the unit was player 2, to be killed by player 1, whereafter the Phylactery item would be dropped and Player 1 could take it to control the Lich)

And I did initially just change owner of a specific unit, I tried the unit group afterwards to make sure that the specific targeting was not the problem.
 
Level 7
Joined
May 15, 2009
Messages
192
BUMP

I tried changing the trigger a bit, to make sure that it would at least run. It now triggers when a transport ship dies, and then tries to select units within the transport, but it still doesn't seem to work. Here's the trigger as of now:

  • Moraenir Death
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Orc Transport Ship
    • Actions
      • Game - Display to (All players) the text: text
      • Set Tempug1 = (Units owned by Player 1 (Red) matching (((Matching unit) is loaded into (Triggering unit)) Equal to True))
      • Unit Group - Pick every unit in Tempug1 and do (Actions)
        • Loop - Actions
          • Game - Display to (All players) the text: ((String((Number of units in Tempug1))) + units in group)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has an item of type Ancient Phylactery) Equal to True
            • Then - Actions
              • Game - Display to (All players) the text: Item carrier died
              • Unit - Kill Moraenir_u
              • Unit - Remove Moraenir_u from the game
            • Else - Actions
              • Game - Display to (All players) the text: No go
      • Custom script: call DestroyGroup(udg_Tempug1)
 
Level 7
Joined
May 15, 2009
Messages
192
I didn't test it, but, if the transport dies, the other units are not considered to be loaded anymore.

You could add each loaded unit in a unit group (when a unit is loaded in this transport) and enumerate through that group.

Will try it out, thanks. I shall report back with my success or failiure!


EDIT: I was just thinking; that would just introduce the problem of having to remove units from the transport group. Otherwisely any unit that had ever been in a transport would be able to trigger the Item "death" - even though the item would just be dropped upon the ground.

Anyway, I found a more elegant work-around using Bribe's amazing GUI Damage Engine.
Instead of letting the Transport Ship die, I just check to see if it ever takes damage greater than it's health. That way I can check for loaded units in the instant before its death, when they are still classified as loaded. The trigger is as follows, if anyone should be interested.

+rep to anyone that helped :)

  • Moraenir Transport Death
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • (Unit-type of DamageEventTarget) Equal to Orc Transport Ship
      • DamageEventAmount Greater than or equal to (Life of DamageEventTarget)
    • Actions
      • Set Moraenir_TransGroup = (Units owned by Player 1 (Red) matching (((Matching unit) is loaded into DamageEventTarget) Equal to True))
      • Unit Group - Pick every unit in Moraenir_TransGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has an item of type Ancient Phylactery) Equal to True
            • Then - Actions
              • Game - Display to (All players) the text: Moraenir's Phylacte...
              • Unit - Kill Moraenir_u
              • Unit - Remove Moraenir_u from the game
              • Unit Group - Remove (Picked unit) from Moraenir_TransGroup
            • Else - Actions
      • Custom script: call DestroyGroup(udg_Moraenir_TransGroup)
 
Last edited:
Status
Not open for further replies.
Top