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

Item Death/Health Loss Event Problem

Status
Not open for further replies.
Level 6
Joined
Aug 12, 2007
Messages
201
I'm trying to make an item blow up on death. Right now this is my trigger but for some reason it doesn't work. Since there are no Event Item Dies or Event Item attacks or event anything to do with items besides using them, I made this, and it seems like it should fire but doesn't.

  • DetonateFuel
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Item - Pick every item in (Playable map area) and do (Actions)
        • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Picked item)) Equal to Fuel
          • (Current life of (Picked item)) Less than or equal to 990.00
        • Then - Actions
          • Game - Display to (All players) the text: Item Trigger Fired
          • Item - Remove (Picked item)
          • Set TempHeroPoint = (Position of (Picked item))
          • Unit - Create 1 MolotovDummy for Neutral Hostile at TempHeroPoint facing Default building facing degrees
          • Unit - Create 1 Goblin Land Mine for Neutral Hostile at TempHeroPoint facing Default building facing degrees
          • Unit - Add a 8.00 second Generic expiration timer to (Last created unit)
          • Set TempUnit2 = (Last created unit)
          • Unit - Order TempUnit2 to Human Blood Mage - Flame Strike TempHeroPoint
          • Custom script: call RemoveLocation( udg_TempHeroPoint)
        • Else - Actions
I never see 'Item Trigger Fired' so I know its not getting past the conditions point. Fixing this trigger is not necessarily what I want, I just want some system or anything that lets me detect when a specific item type is damaged or destroyed, this is just what I tried to work out from that and it doesn't seem to want to work.

The item Health is so high because if it dies from a single attack it won't fire the trigger, this way it makes up for the chance that would happen.
 
Level 3
Joined
Dec 18, 2008
Messages
36
Your trigger should work. I tested it as you presented and theres nothing wrong with what you have down. Double check your trigger.

If you want you could have an event that when a unit drops an item, it replaces the item with a unit. Then you could detect when the unit is attacked. The only problem you would have to get around is picking the fuel item once it has been dropped once -- but im sure its possible.
 
Level 6
Joined
Aug 12, 2007
Messages
201
Your trigger should work. I tested it as you presented and theres nothing wrong with what you have down. Double check your trigger.

If you want you could have an event that when a unit drops an item, it replaces the item with a unit. Then you could detect when the unit is attacked. The only problem you would have to get around is picking the fuel item once it has been dropped once -- but im sure its possible.

I had considered that idea before but the problem is the Fuel item stacks its charges with other fuel items and I couldn't figure out how to make it remember which fuel item/units were supposed to have how much fuel charges in them.

And I've looked my trigger over head to toe, it looks completely sound so I can't figure out why it doesn't fire.

EDIT: I removed the health condition and had only the Item Type Picked = Fuel, but for some reason it still doesn't fire, even though it should be automatically blowing up all fuels items in the map, and I made sure the right item is checked and that the item is in the map. Maybe the pick every item in playable map area inst picking properly?

I tried making an actual region around the fuel items and telling it to pick from there but still no luck.

I set the item to Claws of Attack instead of my Fuel item and it fired properly instantly. I don't know what it is about my custom item that it doesn't see as a real item though.

  • DetonateFuel
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Item - Pick every item in (Playable map area) and do (Actions)
        • Loop - Actions
          • Set PickedItemTemp = (Picked item)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of PickedItemTemp) Equal to fak eClaws of Attack +3
              • (Current life of PickedItemTemp) Less than or equal to 990.00
            • Then - Actions
              • Item - Remove PickedItemTemp
              • Set TempHeroPoint = (Position of PickedItemTemp)
              • Unit - Create 1 Goblin Land Mine for Player 12 (Brown) at TempHeroPoint facing Default building facing degrees
              • Unit - Create 1 MolotovDummy for Player 12 (Brown) at TempHeroPoint facing Default building facing degrees
              • Unit - Add a 8.00 second Generic expiration timer to (Last created unit)
              • Set TempUnit2 = (Last created unit)
              • Unit - Order TempUnit2 to Human Blood Mage - Flame Strike TempHeroPoint
              • Custom script: call RemoveLocation( udg_TempHeroPoint)
            • Else - Actions
Trigger looks like this now but for some reason it won't make the dummies cast on the right spot, instead they cast in some random location like 800 away for no reason at all. I'm starting to think item related triggers were not coded that well or something.

I moved the Set TempHeroPoint up to be next to the other set and it seems to be accurate now where it works.
 
Last edited:
Hm, the trigger doesn't seem to be false. Since Claws of Attack is a single item, try some other item with charges (like your Fuel) and check if it works; if it doesn't, it's a matter of charges, so we will have to figure out something new.
In Jass, to make a check of something being dead, you use life comparison, but not that value you added, unless you want a custom death system.
Since Real value in GUI can't afford "0.405", you will do:
  • (Current life of (Picked item)) Less than or Equal to (0.41 - 0.05)
This will check if the item is dead almost instantly.

In case the problem lies in charges, you can check when the life is the value I described above, to remove the charges:
  • Item - Set charges remaining in (Picked item) to 0
 
Status
Not open for further replies.
Top