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

A trigger to create an item when a tree/destructible dies?

Status
Not open for further replies.
I want to make a trigger that creates an item when a tree/destructible dies. I looked at the triggers for dying destructible and theres no if any destructible dies, only specific destructibles. I also saw it does destructible within region, but it only does up to 64 and i have way more than 64 destructibles on the map. So i tried just making a small region that follows my unit thinking that it would detect up to 64 destructibles in that small region around the unit as it moved. But that didn't work either. Does anyone have a way of doing this?
 
Level 7
Joined
May 18, 2010
Messages
264
I want to make a trigger that creates an item when a tree/destructible dies. I looked at the triggers for dying destructible and theres no if any destructible dies, only specific destructibles. I also saw it does destructible within region, but it only does up to 64 and i have way more than 64 destructibles on the map. So i tried just making a small region that follows my unit thinking that it would detect up to 64 destructibles in that small region around the unit as it moved. But that didn't work either. Does anyone have a way of doing this?


1st': Make it Destructible (so it can drop item)<- i mean just so its destructible (not invanurable)Edit:
2nd: Place it somwhere on ur map
3rd: Double click it
4th: (switch tab from (General) to (Items Droped)
5th: On item droped on death (Open it) and select(Use custom set table)
6th (New Set) then ( new item ) and add items u want (it will have % to drop the item's
 
Nevermind I just figured it out. I used 2 triggers and a variable for the destructible. I made one that said everytime the player issued an order targeting a destructible to set it to that variable then another that said every .01 seconds create item at that variable destructible then set the variable to no destructible.




1st': Make it Destructible (so it can drop item)<- i mean just so its destructible (not invanurable)Edit:
2nd: Place it somwhere on ur map
3rd: Double click it
4th: (switch tab from (General) to (Items Droped)
5th: On item droped on death (Open it) and select(Use custom set table)
6th (New Set) then ( new item ) and add items u want (it will have % to drop the item's

And no that doesnt work bc im using it on hundreds of destructibles and they are created AFTER the game starts.
 
Level 7
Joined
May 18, 2010
Messages
264
Nevermind I just figured it out. I used 2 triggers and a variable for the destructible. I made one that said everytime the player issued an order targeting a destructible to set it to that variable then another that said every .01 seconds create item at that variable destructible then set the variable to no destructible.



And no that doesnt work bc im using it on hundreds of destructibles and they are created AFTER the game starts.
Chould just say what u need now what u tryed didnt understand nothing...
u proly get it
create variable (destructible ( array ))
and just use
set (youre destructible name((youre destructible name) + 1) = last created destructible
 

Chould just say what u need now what u tryed didnt understand nothing...
u proly get it
create variable (destructible ( array ))
and just use
set (youre destructible name((youre destructible name) + 1) = last created destructible

What do you mean I don't understand anything? The triggers I made work fine and don't cause lag and I figured them out on my own. And didn't use arrays. I just made a trigger that said when a unit attacks a destructible that it sets it to the destructible variable. Then I made another trigger that said every .01 seconds if that variable=dead then create an item at that destructible then set that variable= no destructible. It works great.
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
Egzample of such trigger.
Customize item (variable of type - Item type).
Chance of drop (by value of variable i) is just my desire.

  • Destructible
    • Events
      • Destructible - A destructible within (Playable map area) dies
    • Conditions
    • Actions
      • Set item = Crown of Kings +5
      • Set i = (Random integer number between 1 and 2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • i Equal to 1
        • Then - Actions
          • Set tempp = (Position of (Dying destructible))
          • Item - Create item at tempp
          • Custom script: call RemoveLocation (udg_tempp)
        • Else - Actions
Just create many regions (because only 64 destructibles counts per one), and add them to events. Thats it.

EDIT
What do you mean I don't understand anything? The triggers I made work fine and don't cause lag and I figured them out on my own. And didn't use arrays. I just made a trigger that said when a unit attacks a destructible that it sets it to the destructible variable. Then I made another trigger that said every .01 seconds if that variable=dead then create an item at that destructible then set that variable= no destructible. It works great.

Man, it wont work if you use unit's AoE attack (siege attack) like mortals, catapults. Their order doesn't count as 'attack' order.
Your trigger is also ineffective. If you want to use it anyways, remove lagging 0.01 periodic event and in first trigger, when any unit attacks destructible, set is to variable and use:
  • Trigger - Add to (This trigger) the event (Destructible - d dies)
Where 'd' is variable of type destructible.
 
Level 7
Joined
May 18, 2010
Messages
264
What do you mean I don't understand anything? The triggers I made work fine and don't cause lag and I figured them out on my own. And didn't use arrays. I just made a trigger that said when a unit attacks a destructible that it sets it to the destructible variable. Then I made another trigger that said every .01 seconds if that variable=dead then create an item at that destructible then set that variable= no destructible. It works great.

i was sleepy i meant i dont understand...
 
Egzample of such trigger.
Customize item (variable of type - Item type).
Chance of drop (by value of variable i) is just my desire.

  • Destructible
    • Events
      • Destructible - A destructible within (Playable map area) dies
    • Conditions
    • Actions
      • Set item = Crown of Kings +5
      • Set i = (Random integer number between 1 and 2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • i Equal to 1
        • Then - Actions
          • Set tempp = (Position of (Dying destructible))
          • Item - Create item at tempp
          • Custom script: call RemoveLocation (udg_tempp)
        • Else - Actions
Just create many regions (because only 64 destructibles counts per one), and add them to events. Thats it.

EDIT

Man, it wont work if you use unit's AoE attack (siege attack) like mortals, catapults. Their order doesn't count as 'attack' order.
Your trigger is also ineffective. If you want to use it anyways, remove lagging 0.01 periodic event and in first trigger, when any unit attacks destructible, set is to variable and use:
  • Trigger - Add to (This trigger) the event (Destructible - d dies)
Where 'd' is variable of type destructible.
It works fine if im not using siege attacks. And theres no lag. 0.01 triggers only lag if there is no condition to stop them from happening only when they need to. Also my way takes a little less time. Making all of those regions would take a very very long time for a big map. I guess everyone has thier way though, but this is mine.
 
Status
Not open for further replies.
Top