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

Special Effect

Status
Not open for further replies.
Level 33
Joined
Mar 27, 2008
Messages
8,035
I don't know is it me, or is it Destroy SFX function is bugged ?

Okay, try these triggers above;

  • Wait 2 seconds
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Special Effect - Create a special effect attached to the overhead of (Target unit of ability being cast) using Abilities\Spells\Other\AcidBomb\BottleImpact.mdl
      • Set sfx = (Last created special effect)
      • Wait 2.00 seconds
      • Special Effect - Destroy sfx
  • Wait 6 seconds
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Special Effect - Create a special effect attached to the overhead of (Target unit of ability being cast) using Abilities\Spells\Other\AcidBomb\BottleImpact.mdl
      • Set sfx = (Last created special effect)
      • Wait 6.00 seconds
      • Special Effect - Destroy sfx
If you can test both triggers above, the Trigger 2 seconds will destroy SFX appropriately but the Trigger 6 seconds won't destroy SFX at all, why ?
And yes, I cast this spell separate at a time (meaning that only 1 unit casting this spell during the duration respectively, so there's no case of MUi/non-MUI involved)

My question, why and how to solve it ?
I mean I want SFX longer than 2 seconds and I want to destroy them after 6 seconds, how ?

Actually, this is not the actual trigger, if this is the actual trigger, I would just make it as local variable (because local variable strangely works).

Actually, my trigger is that, I saved an SFX to a hashtable with a duration of 5.00 seconds, and in the loop trigger as usually, I would decrease the value of duration per interval until it reaches <0 and then I end the operation and destroy the SFX.

Problem now is that the SFX never gets destroyed, because somehow it relates the problem with local variable (because as I have mentioned earlier, local variable works with the Trigger 6 seconds), and I'm thinking if I link Cast and Loop trigger with local variable, I might be able to pull this off, but how would I link them since local variable only works within given trigger ?

If you have any idea, do tell :)
That is just my current idea and I don't know how to execute it.

These are my actual triggers for those who want to further understand the problem;
  • Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Set dummy = (Last created unit)
      • Custom script: set udg_key = GetHandleId(udg_dummy)
      • Set duration = 5.00
      • Special Effect - Create a special effect attached to the overhead of (Target unit of ability being cast) using Abilities\Spells\Other\AcidBomb\BottleImpact.mdl
      • Set sfx = (Last created special effect)
      • Hashtable - Save duration as 0 of key in hashtable
      • Hashtable - Save Handle Ofsfx as 1 of key in hashtable
      • Unit Group - Add dummy to group
      • Trigger - Turn on Untitled Trigger 003 <gen>
  • Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in group and do (Actions)
        • Loop - Actions
          • Set dummy = (Picked unit)
          • Custom script: set udg_key = GetHandleId(udg_dummy)
          • Set duration = (Load 0 of key from hashtable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • duration Greater than 0.00
            • Then - Actions
              • Hashtable - Save (duration - 0.03) as 0 of key in hashtable
            • Else - Actions
              • -------- THIS PART DOES NOT WORKING --------
              • Set sfx = (Load 1 of key in hashtable)
              • Special Effect - Destroy sfx
Don't care about trigger efficient/leaks, I know how to handle them, just give me a solution on how to solve the SFX destroy problem
 
Level 31
Joined
Jun 27, 2008
Messages
2,557
These two upper triggers are active? It may launch both at the same time meaning the sfx is destroyed after 2 seconds no matter if spell is cast by one or two units.

You set variable is equal to something in both triggers, I guess second trigger variable lose the effect itself by reseting the variable.

Try condition duration Greater than 0.01.

After all, you can make a dummy instead of effect and set his hp to 36 points and life regeneration rate to -6 with the help of shift so it may die after 6 seconds and no triggers needed.

I'm really a rookie on these, but 6 seconds must work perfectly as it was 2 seconds. There must be others triggers that disable it somehow.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
These two upper triggers are active? It may launch both at the same time meaning the sfx is destroyed after 2 seconds no matter if spell is cast by one or two units.
That is trigger example and no, both of them do not run after another, these experiments are done by testing the map twice (change the Wait seconds for both test map)

You set variable is equal to something in both triggers, I guess second trigger variable lose the effect itself by reseting the variable.
As I said, those triggers do not run one after another, it's on separate map.

Try condition duration Greater than 0.01.
It's programming standard to use Greater than 0.00 to acknowledge the trigger that duration is still there, if it's 0.01, there is an error with the duration (the duration would end 0.01 second sooner than expected, although this is not related to the issue at all..)

After all, you can make a dummy instead of effect and set his hp to 36 points and life regeneration rate to -6 with the help of shift so it may die after 6 seconds and no triggers needed.
The trigger is actually part of a system which allows user to spawn SFX based on duration (see my signature - Timed SFX)

Currently I'm trying to convert the trigger from using TriggerSleepAction (known as Wait in GUI) to using Hashtable with Real as its Duration.

Currently, the system works fine (because I use local variable - works with TriggerSleepAction) but I have to adjust it since TriggerSleepAction can cause some weird bugs, that's why I decided to use Hashtable.

Everything works fine within the trigger itself, except SFX can't be referred at all when using Hashtable, or my method of saving/loading wrong ?

I tried saving Unit (Caster) to the Hashtable and when duration ends, I load the Unit (Caster) and kill it, and yes, it worked, meaning that my trigger is working fine as it is, only it does not accept SFX reference from a Hashtable.

I... hope you know what I said ? Haha ;p
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
It's because you're overwriting sfx.
That's why only one of those created effects will be destroyed.
I saved each SFX varied to one another, you see why I spawn those Footman ?
They are the ones that is responsible for holding SFX data, meaning that each of them varies to one another.

Also as I said earlier, I cast this only once in that map, there's no stacking SFX yet, but even there is only ONE SFX, that SFX is not destroyed at all, it remains there like there is not DestroySFX function ever occur to it.
Remember, this SFX only one, so there's no such thing as "perhaps you deleted your last SFX".
 
Last edited:
Level 33
Joined
Mar 27, 2008
Messages
8,035
Strange enough, with Real comparison, SFX never get recalled/referred.
With the event A unit Dies, I can load the SFX and destroy them, very strange indeed.

Never mind as I have solved the issue by using the event A unit Dies instead of Real comparison (Duration).

I've put expiration timers to dummy which holds the data so when it dies, I refer to it and it worked.

But I still wondering why it did not work with Real comparison ?

Oh and this trigger is for my Timed SFX system (you can check them in my signature), I have changed it to Hashtable rather than TriggerSleepAction, I thought that by using Hashtable, I would save the Real (Duration) to a dummy unit and decrease the value per interval and make a comparison when it is <0, terminate operation (destroy SFX), but strangely it did not work.
 

nGy

nGy

Level 11
Joined
Apr 15, 2011
Messages
123
I don't think you should use dummy units for this, as every created unit leaks somehow. Why don't you use a global timer? (ofc, this won't be very precise, but for special effects .03 seconds shouldn't really matter)
 

nGy

nGy

Level 11
Joined
Apr 15, 2011
Messages
123
So you think spells nowadays can't use dummy at all ?
Absurd.
Bit too much generalizing there o_O
You should use dummies if you need to and if you don't need them, don't use them (I'd say).

Also, do tell about this "leak" of creating units, please I want to know :)
I sense sarcasm here -.-
all I can tell you about this, is what DSG always tells us (and you already read that :p):
All units, hero and normal, leak anyway at the moment.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
You should use dummies if you need to and if you don't need them, don't use them (I'd say).
Yes I need them, because I would usually save Real variable to the Caster or anything, but since Real comparison can't recall SFX at all, I had to use dummy as Event (Unit dies) and it is finally worked.

all I can tell you about this, is what DSG always tells us (and you already read that :p):
Quote:
Originally Posted by Dr Super Good
All units, hero and normal, leak anyway at the moment.
DSG always talks about superiority on Warcraft III engines, and he always compare it to SCII (which is totally far more efficient).
He meant leaks in Warcraft III cannot be evaded such as unit creation and such but it is indeed a small leak compared to Point leak, SFX leak, etc (which these kinds of leaks that should be prioritize).

Therefore, spawning dummies does not "leak" to my opinion and capabilities of Warcraft III engines.

NOTE: I did not flame him or anything, just making him as an example, since you quoted him lulzor, no offense though DSG, peace ^_^
 

nGy

nGy

Level 11
Joined
Apr 15, 2011
Messages
123
Yes I need them, because I would usually save Real variable to the Caster or anything, but since Real comparison can't recall SFX at all, I had to use dummy as Event (Unit dies) and it is finally worked.
Sorry, I just didn't read properly and didn't get your problem -.-"
Anyway, I rebuilt the problematic trigger in your system's current version and it works fine for me. So, it should be possible to use indexing in order to avoid creating units (but as you don't like that, it doesn't matter .__. )
 
Ok, thx, I didn't know that.

But I seriously doubt the problem is some kind of weird bug. I'm sure you're using your sfx variable (or hashtable slot) somewhere else in the script. I tested your sample "6 seconds wait" trigger and there was absolutly no problem. Would you mind sharing a test map where this bug occurs?

Also, the "Abilities\Spells\Other\AcidBomb\BottleImpact.mdl" has a birth/stand/death animation set.

Incidentaly, I just made test about the "Destroy effect" function : it launches an internal timer (it doesn't use any handle index) that expires after 5 seconds in term of which the effect is actually destroyed (= model removed + handle recycled). You may use the action "Destroy effect" once again before the timer expires ; it will play the death animation once again and starts the timer for another 5 seconds.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
But I seriously doubt the problem is some kind of weird bug. I'm sure you're using your sfx variable (or hashtable slot) somewhere else in the script
I thought this at first too, but;
I tried saving Unit (Caster) to the Hashtable and when duration ends, I load the Unit (Caster) and kill it, and yes, it worked, meaning that my trigger is working fine as it is, only it does not accept SFX reference from a Hashtable.
You see ?
I saved (Triggering unit) to the dummy and Duration too and loop it in Unit Group.
When Duration <0, I load Caster and kill it, and yes, the Caster did die, but my SFX never got destroyed.
Meaning that I save/load perfectly but SFX never got recalled via Real Comparison, don't know why.
 
Status
Not open for further replies.
Top