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

[Solved] Item drop / delayed destroy effect

Status
Not open for further replies.
I have a system that lets certain unarmed heroes pick up weapons and then the weapons attaches. If you put the weapon down or sell it, then the weapon disappears. However, there is about a 2 second delay on the destroy special effect. Can someone explain?

I give the sword to the princess
  • Event -
    • Unit - unit acquires an item
  • Condition -
    • Item-type Comparison (Item-type) Equal to (My Sword Item)
    • Unit-type comparison (unit-type) Equal to (My Hero with Empty Hands)
  • Actions -
    • Set Variable - Item[1] = (item being manipulated)
    • Special Effect - Create Special Effect at hand , right of (My Unit with Empty Hands) using (Some sword model I downloaded)
    • Set Variable - Attachment[1] = (last created special effect)
She puts the sword down.

  • Event -
  • Unit - loses an item
  • Conditions -
    • Item-type comparison (item-type) equal to (my item-type variable)
  • Actions -
    • Special Effect - Destroy Special effect - (variable effect [x])
2 seconds later the special effect disappears, no more sword.

Ok, so I wrote this from memory, but I'm at work and I don't have my home CPU, please don't tell my boss. My apologies to anyone who wants to help but needs to see more. This is fairly simple. I think it might be somewhere else in my triggers and not in my inventory system. I know I have other triggers that leak but I have them set to be turned off after use. Ya, I know (call destroy) is better, but there has been no lag / delay in anything until now.
 
Level 20
Joined
Apr 14, 2012
Messages
2,901
Right now I don't see anything wrong, maybe you forgot something that's in your triggers. Also, how about try using a periodic trigger that runs actions every 0.03 seconds, that checks if the hero has an item or not?

If the hero has the item, the effect stays. If not, destroy the effect. The removal then should be pretty quick.
 
Level 5
Joined
May 6, 2013
Messages
125
Some sfx's may have an incredibly long death animation. Note that destroying an sfx does not actually remove it, but merely plays its death animation. If it is 2 seconds long, then it will disappear after 2 seconds (the vampire aura sfx is a great example for this)
 
Level 8
Joined
Feb 3, 2013
Messages
277
I think this issue is similar to how auras work. If your issue is what I think it is.

You can remove an aura from a unit, but there's a little delay before the buff is actually gone from the unit. Similarly, there are some effects, whether it be their die animation or die time - that causes the same lingering process after its been removed.

Having said that, I think your triggers are working just fine.
 
Level 16
Joined
Dec 15, 2011
Messages
1,423
Right now I don't see anything wrong, maybe you forgot something that's in your triggers. Also, how about try using a periodic trigger that runs actions every 0.03 seconds, that checks if the hero has an item or not?

If the hero has the item, the effect stays. If not, destroy the effect. The removal then should be pretty quick.

Events are much faster. The timer is redundant.

Anyway the issue is caused by the model having no death animation and thus it takes some time to decay and disappear. Or the death animation is too long as mentioned by Imp Midna.

There are 2 solutions:

1/ Add a death animation to those models. Modify the existed one if needed.
2/ Mimic some Blizzard items that create sfx on the unit when carried. I don't remember the exact details but you can tinker with that on your own :)

On a side note, you can use this custom script to remove auras immediately call UnitRemoveAbility (<udg_YourUnitVar>, <YourAuraBuffID>)
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Doomlord is right.

Effects that have no death animation take the default effect decay time (specified in gameplay constants) to decay. By default it is 5 seconds.

One option is to use a transform the unit into another and back instantly, and then reapplying the other effetcs. Destroy the effects before the transform process.
 
Doomlord is right.

Effects that have no death animation take the default effect decay time (specified in gameplay constants) to decay. By default it is 5 seconds.

One option is to use a transform the unit into another and back instantly, and then reapplying the other effetcs. Destroy the effects before the transform process.
Can I just change the default gameplay constant (without changing every units death animation time)? If not ...
How would your transformation be done in the simplest way? Do you mean use a trigger that replaces the unit with another unit (which would actually be the same type-unit) and them back again without delay? What I'm hearing is that because there is no death animation, the game is adding a default death animation which is a set period of time and its playing the stand animation. Is there a way to just remove the death animation without using a model editor? Maybe a trigger that removes the models death animation when it is picked up?

Here is the sword I am using. The same thing happens with the shields and other swords. I don't know how to edit models, though maybe this might be a good time to learn and a simple project to learn with.

EDIT: Here is the first part of the trigger which seems to work great.
  • Enchanted Blade of Escape
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Valkyrie
          • (Unit-type of (Triggering unit)) Equal to Warden
          • (Unit-type of (Triggering unit)) Equal to Renegade
      • (Item-type of (Item being manipulated)) Equal to Kelen's Dagger of Escape
    • Actions
      • Special Effect - Create a special effect attached to the hand, right of (Hero manipulating item) using war3mapImported\Shocklotus.mdx
      • Set Attachment[1] = (Last created special effect)
      • Set Item[1] = (Item being manipulated)
This is my version I mentioned above, I made it last night and posted it from memory above while I was at work. This works fine except the delay.
  • Item Drop 1
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • Item[1] Equal to (Item being manipulated)
    • Actions
      • Special Effect - Destroy Attachment[1]
Now here is my new version. I added the replace unit action and the set experience action, but this fails... bad. I know its not the set experience because I disabled it and it still crashed.
  • Item Drop 1
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • Item[1] Equal to (Item being manipulated)
    • Actions
      • Unit - Replace (Hero manipulating item) with a (Unit-type of (Hero manipulating item)) using The old unit's relative life and mana
      • Hero - Set (Hero manipulating item) experience to (Hero experience of (Last replaced unit)), Hide level-up graphics
      • Special Effect - Destroy Attachment[1]
This crashed the game. Isn't this what was suggested? Should I try setting variables first? Is it the leaks? I thought it should work even if it leaks and I figured I could clean up the leaks after I know it works. Can anyone suggest a better way?
 
Last edited:
Level 30
Joined
Nov 29, 2012
Messages
6,637
Why dont you just do is make an empty ability and make the Art - Target has the model of the attachment and make the attachment point, hand right or hand left. Just give this empty ability to the item and so when the item is picked up, it will attach to the hero and remove if dropped without delay.

And for your Item Drop, try removing the replace, it might be the one causing crash but better do the way I prefer. By the way, why are you even replacing a hero manipulating item with a same unit itself? I have adoubt that this is the causing the crash maybe.
 
Level 30
Joined
Nov 29, 2012
Messages
6,637
Lol there is no 'crashing' regarding the problem.

Legal_Ease said:
Now here is my new version. I added the replace unit action and the set experience action, but this fails... bad. I know its not the set experience because I disabled it and it still crashed.
  • Item Drop 1
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • Item[1] Equal to (Item being manipulated)
    • Actions
      • Unit - Replace (Hero manipulating item) with a (Unit-type of (Hero manipulating item)) using The old unit's relative life and mana
      • Hero - Set (Hero manipulating item) experience to (Hero experience of (Last replaced unit)), Hide level-up graphics
      • Special Effect - Destroy Attachment[1]
This crashed the game. Isn't this what was suggested? Should I try setting variables first? Is it the leaks? I thought it should work even if it leaks and I figured I could clean up the leaks after I know it works. Can anyone suggest a better way?

^ You should read this.
 
You guys are funny. Anyway.... where to begin ... @Hell_Master I did what you suggested and added the Art-Target attachment before I posted this. I scrapped that system quickly because I am using many models and some already have weapons, so that just looks bad. I end up with a hero with two swords in one hand or a sword and a shield in one hand. As you can see in my trigger, I have 3 heroes that use the item attachment system, rest do not. Next, it was Maker that suggested I "transform" the unit into the same unit to make the attachment disappear with no delay. I'm not sure I did exactly what he meant but I thought thats what he was telling me to do. My system works nicely except this stupid 2 second delay. What I need to do is learn how to edit models and add a death animation of nothing, so the Blizzard default animation does not run. +1 rep to both of you for trying, I do appreciate it. Hopefully the GUI gods will send me the solution in a dream.... or maybe one of you know a fix :)
 
Level 30
Joined
Nov 29, 2012
Messages
6,637
You guys are funny. Anyway.... where to begin ... @Hell_Master I did what you suggested and added the Art-Target attachment before I posted this. I scrapped that system quickly because I am using many models and some already have weapons, so that just looks bad. I end up with a hero with two swords in one hand or a sword and a shield in one hand. As you can see in my trigger, I have 3 heroes that use the item attachment system, rest do not. Next, it was Maker that suggested I "transform" the unit into the same unit to make the attachment disappear with no delay. I'm not sure I did exactly what he meant but I thought thats what he was telling me to do. My system works nicely except this stupid 2 second delay. What I need to do is learn how to edit models and add a death animation of nothing, so the Blizzard default animation does not run. +1 rep to both of you for trying, I do appreciate it. Hopefully the GUI gods will send me the solution in a dream.... or maybe one of you know a fix :)

You can just try editing the model if it is an original Warcraft 3 model and removing its weapon and let the attachments do the attaching of equips and stuffs but if it does belong to someone, you should ask for permission.

Only way to avoid overlap is edit the model and remove its weapon so it can be open on attachments.
 
Level 30
Joined
Nov 29, 2012
Messages
6,637
Maybe the easiest thing to do would be to find all heroes with no weapons, instead of picking through the ones I have. eh... I'm going to keep trying. Maybe I'll learn model editing basics.

Its just easy to remove weapons from models. To help you further: Here is a tutorial how... here is a thread with a question about removing weapons and someone provided some tuts: How to Remove Weapons
 
Its just easy to remove weapons from models. To help you further: Here is a tutorial how... here is a thread with a question about removing weapons and someone provided some tuts: How to Remove Weapons

Thank you. I'm not sure I want to do all that because that's a lot more than I intended to do for this map. It would create new problems too. For instance, would I then need to make it so only Mages could carry a staff? Well, maybe that's not so bad I'll think about it. There is a lot more going on in this map than just the item carry system. For example some of the heroes can morph, and a bird with a shield might look ... well ... hilarious really. I also use a model that morphs from a glaive thrower to a archer. I don't want to remove her weapons. I like the idea though and I might do it for the steelborn knight. Either way, I'm still going to need to use the item carry system for some but not all units.

Does any one have a simple GUI or OE solution to the item disappear delay that would allow me to use items with every hero but only show the weapon model on heroes with no weapons?
 
Level 30
Joined
Nov 29, 2012
Messages
6,637
Thank you. I'm not sure I want to do all that because that's a lot more than I intended to do for this map. It would create new problems too. For instance, would I then need to make it so only Mages could carry a staff? Well, maybe that's not so bad I'll think about it. There is a lot more going on in this map than just the item carry system. For example some of the heroes can morph, and a bird with a shield might look ... well ... hilarious really. I also use a model that morphs from a glaive thrower to a archer. I don't want to remove her weapons. I like the idea though and I might do it for the steelborn knight. Either way, I'm still going to need to use the item carry system for some but not all units.

Does any one have a simple GUI or OE solution to the item disappear delay that would allow me to use items with every hero but only show the weapon model on heroes with no weapons?

But still hoping you can find it useful at some point. Cheers =)
 
Level 30
Joined
Nov 29, 2012
Messages
6,637
[Solved] Turned "Decay time - effects" to .0 in gameplay constants. Problem Solved! I am becoming convinced that the solutions are often more simple than perceived. So far I have not noticed any difference in the look of buffs and effects.

Oh yes, that is quite simple when removing a weapon I forgot it plays its death animation, the removal. So that is really the solution. Good for you, bro. Hope we helped! =)
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
How do you mark forum as [SOLVED]

Thread tools -> Edit thread -> Perform Action
think.gif
 
I did know about the 5 second delay when destroying effects without a death animation, however, I didn't know about the gameplay constant! Always something new to learn :)
Does it also have an impact on effects with a death animation created and then instantly destroyed? Normally those would play the death animation just fine. Would the death animation still be played if I set the decay time to 0?

I usually edited all attachment models and added a death animation on my own (usually takes like 10 seconds to do that, but still, when using a lot of attachment models, it's a tedious task), but if this is as simple as reducing a gameplay constant, I would rather do that instead!
 
I did know about the 5 second delay when destroying effects without a death animation, however, I didn't know about the gameplay constant! Always something new to learn :)
Does it also have an impact on effects with a death animation created and then instantly destroyed? Normally those would play the death animation just fine. Would the death animation still be played if I set the decay time to 0?

I usually edited all attachment models and added a death animation on my own (usually takes like 10 seconds to do that, but still, when using a lot of attachment models, it's a tedious task), but if this is as simple as reducing a gameplay constant, I would rather do that instead!

I have found no interference with any other effects. If you use a lot of special effects in triggers, you might start to run into something but I con't even think of a special effect you would want to decay. I think the death animation stays just fine. "Decay" is a separate animation "time" allotment. Its how long the corpse takes to fade, so I can't really every see why turning off the "effect decay" would ever be bad. Corpse has its own decay time.
 
I have found no interference with any other effects. If you use a lot of special effects in triggers, you might start to run into something but I con't even think of a special effect you would want to decay. I think the death animation stays just fine. "Decay" is a separate animation "time" allotment. Its how long the corpse takes to fade, so I can't really every see why turning off the "effect decay" would ever be bad. Corpse has its own decay time.
Have you even tested this before posting?
I just did a quick test and setting the effect decay time to 0 does indeed what I expected: It makes destroyed effects instantly vanish, regardless of death animation!
... which basicly means the gameplay constant is useless, as NO EFFECT will ever play it's death animation.
 
Have you even tested this before posting?
I just did a quick test and setting the effect decay time to 0 does indeed what I expected: It makes destroyed effects instantly vanish, regardless of death animation!
... which basicly means the gameplay constant is useless, as NO EFFECT will ever play it's death animation.

Of course I tested it. I just didn't look closely enough. I just tested it again and yes, you're right. I think I will set it to .5 or something, I don't know what to do. I'll learn to edit models, I guess.
 
Status
Not open for further replies.
Top