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

Simple Timed SFX System v1.3 [GUI]

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
- This system will let the user to spawn your SFX with a timed duration.
- You don't need to do the hardwork, it will do it for you.
- You can spawn SFX either on a Unit or on Ground.
- It's in GUI.


Internal Instructions
- If you want to use this system, you would have to only follow these lines;
Point SFX
  • Actions
    • -------- SFX_Duration sets the duration of the SFX --------
    • -------- SFX_StringPath sets the path for the SFX --------
    • -------- SFX_Loc sets where does the SFX spawns --------
    • Set SFX_Duration = 5.00
    • Set SFX_StringPath = Abilities\Spells\Other\AcidBomb\BottleImpact.mdl
    • Set SFX_Loc = (Target point of ability being cast)
    • Trigger - Run SfxPoint <gen> (ignoring conditions)
OR

Unit SFX
  • Actions
    • -------- SFX_Duration sets the duration of the SFX --------
    • -------- SFX_StringPath sets the path for the SFX --------
    • -------- SFX_AttachmentPoint sets which point does the SFX affect on the unit --------
    • -------- SFX_Unit sets which unit has to take the SFX --------
    • Set SFX_Duration = 5.00
    • Set SFX_StringPath = Abilities\Spells\Other\AcidBomb\BottleImpact.mdl
    • Set SFX_AttachmentPoint = overhead
    • Set SFX_Unit = (Target unit of ability being cast)
    • Trigger - Run SfxUnit <gen> (ignoring conditions)
- So, before you call those function, you must set your variable first before calling them.

- If you are want to spawn SFX on unit, you must use this action after you have set the desired variables for SFX Unit
  • Trigger - Run SfxUnit <gen> (ignoring conditions)
For example;
  • Actions
    • Set SFX_Duration = 5.00
    • Set SFX_StringPath = Abilities\Spells\Other\AcidBomb\BottleImpact.mdl
    • Set SFX_AttachmentPoint = overhead
    • Set SFX_Unit = (Target unit of ability being cast)
    • Trigger - Run SfxUnit <gen> (ignoring conditions)
For Point, just do this: Trigger - Run SfxPoint <gen> (ignoring conditions)

External Instructions
- Open World Editor -> File > Preferences... > General Tab > Tick the Automatically create unknown variables while pasting trigger data
- Copy the Simple Timed SFX System folder and paste it in your map (Trigger Editor)


  • SFX Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- This hashtable is for checking unit is dead or not, if dead, properly destroys its own SFX --------
      • Custom script: set udg_SFX_Hashtable = InitHashtable()
      • Set SFX_Dummy = Dummy (SFX)
  • SfxUnit
    • Events
    • Conditions
    • Actions
      • Set SFX_Loc = (Position of SFX_Unit)
      • Special Effect - Create a special effect attached to the SFX_AttachmentPoint of SFX_Unit using SFX_StringPath
      • Unit - Create 1 SFX_Dummy for (Triggering player) at SFX_Loc facing Default building facing degrees
      • Set SFX_Unit = (Last created unit)
      • Unit - Add a SFX_Duration second Generic expiration timer to SFX_Unit
      • Set SFX = (Last created special effect)
      • Custom script: set udg_SFX_Key = GetHandleId(udg_SFX_Unit)
      • Hashtable - Save Handle OfSFX as 0 of SFX_Key in SFX_Hashtable
      • Unit Group - Add SFX_Unit to SFX_Group
      • Custom script: call RemoveLocation(udg_SFX_Loc)
      • Trigger - Turn on SFX Clear <gen>
  • SfxPoint
    • Events
    • Conditions
    • Actions
      • Special Effect - Create a special effect at SFX_Loc using SFX_StringPath
      • Unit - Create 1 SFX_Dummy for (Triggering player) at SFX_Loc facing Default building facing degrees
      • Set SFX_Unit = (Last created unit)
      • Unit - Add a SFX_Duration second Generic expiration timer to SFX_Unit
      • Set SFX = (Last created special effect)
      • Custom script: set udg_SFX_Key = GetHandleId(udg_SFX_Unit)
      • Hashtable - Save Handle OfSFX as 0 of SFX_Key in SFX_Hashtable
      • Unit Group - Add SFX_Unit to SFX_Group
      • Custom script: call RemoveLocation(udg_SFX_Loc)
      • Trigger - Turn on SFX Clear <gen>
  • SFX Clear
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to SFX_Dummy
    • Actions
      • Set SFX_Unit = (Triggering unit)
      • Custom script: set udg_SFX_Key = GetHandleId(udg_SFX_Unit)
      • Set SFX = (Load 0 of SFX_Key in SFX_Hashtable)
      • Special Effect - Destroy SFX
      • Hashtable - Clear all child hashtables of child SFX_Key in SFX_Hashtable
      • Unit Group - Remove SFX_Unit from SFX_Group
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (SFX_Group is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
- Magtheridon96 > Hashtable SFX destroy
- KnnO > Global variable to Local Variable
- mckill2009 > RemoveLocation() placing


v1.0
- Initial release

v1.1
- Optimized the trigger a bit.

v1.2
- Changed the function name to a proper ones (instead camel-casing).
- call RemoveLocation() is now in correct location.

v1.3
- Removed JASS function
- Uses Hashtable instead TriggerSleepAction
- New instructions


Keywords:
timed, sfx, special effect, defskull, system, duration, ground, unit, magtheridon96.
Contents

Just another Warcraft III map (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. 12:28, 17th Jul 2012 Magtheridon96: I see what you did there. The dummy unit method is still not a good idea. :/ Timers bro, timers. <;

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.

12:28, 17th Jul 2012
Magtheridon96: I see what you did there.
The dummy unit method is still not a good idea. :/
Timers bro, timers. <;
 
Level 8
Joined
Sep 18, 2011
Messages
195
Nice, simple and useful system.

local effect udg_SFX ?
local and udg (user-defined global) ?
f5ecab30_epic-jackie-chan-template.png

Suggestions:
  • Make the functions' prefix letter uppercased: (sfxGround -> SfxGround)
  • Or even make the name EffectGround (because it comes in mind first to users)
  • Make alternate function names such as:
    JASS:
    function SpecialEffectGround takes nothing returns nothing
    call sfxGround()
    endfunction
    
    function EffectGround takes nothing returns nothing
    call sfxGround()
    endfunction
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Nice, simple and useful system.
Thanks :)

local and udg (user-defined global) ?
Yes, you can turn a global variable into local variable
Actually, in the start, I'm planning to make my work easier by making global variable into local, I can still use GUI function to refer to that SFX variable, but since I'm using scripting all the way, I forgot to change it pure local variable, I had uploaded a new version, fixed that.

Make the functions' prefix letter uppercased: (sfxGround -> SfxGround)
I used a camel-casing, it's one of the style of writing in programming language, don't know for you, for me, it's easy to read.

Or even make the name EffectGround (because it comes in mind better)
Make alternate functions names such as:
sfxGround and sfxUnit is pretty understandable to me :)
Will consider of changing the functions' name to a more appropriate one :)
 
Level 8
Joined
Sep 18, 2011
Messages
195
Yes, you can turn a global variable into...
Oh, I was testing that, yes until if you used it in GUI, so that is why I though why not use another var name.
I used a camel-casing...
It doesn't matter, but just to be the same style for Jass writing.
sfxGround and sfxUnit is pretty...
Yes for me too :p but it is used in Jass as effect, however adding alternatives is enough.
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
Since you're using jass, better is;
JASS:
function sfxGround takes string sfx, location loc, real dur returns nothing
   local effect SFX = AddSpecialEffectLoc(sfx, loc)
   call TriggerSleepAction(dur)
   call DestroyEffect(SFX)
   call RemoveLocation(loc)
   set SFX = null
endfunction

function sfxUnit takes string sfx, unit u, string ap, real dur returns nothing
   local effect SFX = AddSpecialEffectTarget(sfx, u, ap)
   call TriggerSleepAction(dur)
   call DestroyEffect(SFX)
   set SFX = null
endfunction

How to call?
  • Custom script: call sfxGround(What SFX would you like ?, Where do you want to spawn ?, How long you want it ?)
Why so many arguments?
- Coz some users would preffer direct creation than storing it to a global/locals first...

your call RemoveLocation(udg_SFX_Loc) should be in the sfxGround btw...
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
@Mag and KnnO
Alright, alright I change the function name :(
okayguy.jpg


I do not understand why do you use TriggerSleppAction and not a timer.
It is MUI enough to me, also, I'm not used to JASS and stuffs, I'll try to learn to use timers in later future.

This system does not support stacking,non-stacking effect.
What do you mean it does not support stacking ?
Try cast it multiple times on a single unit, all those SFX gets removed with their own duration.

Since you're using jass, better is;
Jass:
JASS:
function sfxGround takes string sfx, location loc, real dur returns nothing
   local effect SFX = AddSpecialEffectLoc(sfx, loc)
   call TriggerSleepAction(dur)
   call DestroyEffect(SFX)
   call RemoveLocation(loc)
   set SFX = null
endfunction

function sfxUnit takes string sfx, unit u, string ap, real dur returns nothing
   local effect SFX = AddSpecialEffectTarget(sfx, u, ap)
   call TriggerSleepAction(dur)
   call DestroyEffect(SFX)
   set SFX = null
endfunction
Are you telling me that some user prefer to use local variable instead, creating a global variable ?
That would make his variable list, not grows ?
Yes I agree with that, but that will make it harder for those people who don't know to call native function such GetSpellTargetLoc() or even GetTriggerUnit().

Plus, it will make the user's job easier by setting the variable via GUI function (this system is in favor of GUI user since I used some kind of unefficient method of JASS)

But I will take your consideration, I'll try to put a list for all native function they should call in the documentations.

your call RemoveLocation(udg_SFX_Loc) should be in the sfxGround btw...
Haha fixed that :)

New version uploaded with some minor changes.
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
no, I said direct creation such as;
  • Custom script: call sfxGround("string", Loc, "5.0")
OR
  • Set udg_SFX_String = What SFX would you like ?
  • Set udg_SFX_Duration = How long you want it ?
  • Set udg_SFX_Loc = Where do you want to spawn ?
  • Custom script: call sfxGround(udg_SFX_String,udg_SFX_Loc, udg_SFX_Duration)
so the option for them not to create those globals/locals...

I forgot to tell you but correct me if Im wrong that TriggerSleepAction doesnt stop if Game is paused
so your SFX may end prematurely coz of that...better to use a Timer...
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
no, I said direct creation such as;
  • Custom script: call sfxGround("string", Loc, "5.0")
That's why I said the user must know native function in order to call either Location or Unit.
You see, the Loc is definitely a local variable, right ? Since it has no prefix of udg_.
Okay now, where does Loc comes from ?
Surely we must set it first, right ?
In GUI, it's easy just;
  • Set udg_Loc = (Target point of ability being cast)
But everything in JASS is different (the user must memorize the syntax);
  • Custom script: local location Loc = GetSpellTargetLoc()
You see ?
The user has to memorize the GetSpellTargetLoc and many other native function.
It's both same thing but the execution to set the variable is totally different, I just make it easy for GUI user (just because they have to memorize the syntax, it's hard for them)

But then again, I might have change this to local variable and will include a full list of all possible native functions that they want to call.

Btw;
no, I said direct creation such as;
  • Custom script: call sfxGround("string", Loc, "5.0")
Haha duration is not string dude >.>" (I know you must have mistyped it)

I forgot to tell you but correct me if Im wrong that TriggerSleepAction doesnt stop if Game is paused
so your SFX may end prematurely coz of that...better to use a Timer...
I have tested it in LAN game where you have the ability to Pause a game;
1. I casted in on Ground
2. Directly pause the game (for 10 seconds)
3. Unpause the game and SFX seems not to be destroyed and wait for another 5 seconds (SFX_Duration) to destroy

TriggerSleepAction does obey the Game Pause.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
from this "Set udg_Loc = (Target point of ability being cast)"...I forgot the udg_ as well :)...
anyway its just my suggestion to make your function more dynamic...
You see;
My Way
  • Actions
    • Set SFX_String = Abilities\Spells\Other\AcidBomb\BottleImpact.mdl
    • Set SFX_Loc = (Target point of ability being cast)
    • Set SFX_Duration = 5.00
    • Custom script: call SfxGround()
JASS:
function SfxGround takes nothing returns nothing
   local effect SFX = AddSpecialEffectLoc(udg_SFX_String, udg_SFX_Loc)
   call RemoveLocation(udg_SFX_Loc)
   call TriggerSleepAction(udg_SFX_Duration)
   call DestroyEffect(SFX)
   set SFX = null
endfunction
Your Way
  • Actions
    • Set SFX_String = Abilities\Spells\Other\AcidBomb\BottleImpact.mdl
    • Set SFX_Loc = (Target point of ability being cast)
    • Set SFX_Duration = 5.00
    • Custom script: call SfxGround(udg_SFX_String, udg_SFX_Loc, udg_SFX_Duration)
JASS:
function SfxGround takes string whichString, location whichLocation, real whichDuration returns nothing
   local effect SFX = AddSpecialEffectLoc(udg_SFX_String, udg_SFX_Loc)
   call RemoveLocation(udg_SFX_Loc)
   call TriggerSleepAction(udg_SFX_Duration)
   call DestroyEffect(SFX)
   set SFX = null
endfunction
Both of these method works the same, even if you don't include the parameters inside the function, it still execute the right action because all the action is considered inside the function itself, not depends on parameters.

Because, the value in the custom function will refer to global/local variable that we have set, so basically, adding/removing parameter(s) to a custom function does not really affect anything.

@KnnO
that will confuse the new user even more so no need for that...
But then again, this will reduce the amount of global variable ?
But then again (one more time...), will be hard for new user, that's why he propose to make an advance function but I think I'll stick to this my current method first.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
You know you're awesome when people start using your username as a Keyword :D
I've put my name there because some people, wants to just find out what resources that I have created so that when they go to Spells Section, they just type out my name and there you go, list of my resources.
Also, I've usually put others' username in keywords/tags for credits.
 
Top