Create Special Effect at position of unit in jass

Squishinator

New Member
Reaction score
3
I know this is probably a really dumb question, but i have no knowledge of jass whatsoever and cant find a straight answer when i search.
 

Flare

Stops copies me!
Reaction score
662
If you are using an 'instant' effect (i.e. it plays its effect and is removed immediately after, such as Thunderclap)
JASS:
call DestroyEffect (AddSpecialEffect (modelFile, GetUnitX (whichUnit), GetUnitY (whichUnit))
//or
call DestroyEffect (AddSpecialEffectTarget (modelFile, whichUnit, attachmentPoint))


If you want something that needs to last for a period of time, you would need to store the effect to a variable, wait (or use a timer, whichever you prefer) and destroy it later i.e.
JASS:
local effect sfx
...
set sfx = AddSpecialEffectTarget (modelFile, whichUnit, attachmentPoint)
//You -NEED- to use AddSpecialEffectTarget here, AddSpecialEffect isn't suitable, unlike above
call TriggerSleepAction (timeDelay)
call DestroyEffect (sfx)


Although, unless you have NewGen WE or use timers, the second example will delay the remaining execution of your function, so it's advisable that you do all your actions bar local destruction/nulling (they can be done either side of the wait, as long as they aren't in use) before the wait, unless you have other waits for some reason
 

Squishinator

New Member
Reaction score
3
even this is kind of confusing to me. What i want to do is create special effect at position of sfxUnit and wont loop
 

Flare

Stops copies me!
Reaction score
662
even this is kind of confusing to me. What i want to do is create special effect at position of sfxUnit and wont loop
Telling us what particular SFX(s) you want to use would be useful. If it's something like Fan of Knives, Warstomp, Thunderclap, Frost Nova's 'burst' effect and all those one-shot effects, you need
JASS:
call DestroyEffect (AddSpecialEffect (modelFile, GetUnitX (whichUnit), GetUnitY (whichUnit))
//or
call DestroyEffect (AddSpecialEffectTarget (modelFile, whichUnit, attachmentPoint))

One of those two.
 

Squishinator

New Member
Reaction score
3
Could u just give me a code that says in jass: create special effect at sfxUnit(variable). The special effect is the Raise Skeleton Warrior effect.
 

Flare

Stops copies me!
Reaction score
662
JASS:
call DestroyEffect (AddSpecialEffect ("Abilities\\Spells\\Undead\\RaiseSkeletonWarrior\\RaiseSkeleton.mdl", GetUnitX (sfxUnit), GetUnitY (sfxUnit)))

For future reference (since I don't plan on doing everything for someone much more, if ever), you will need two backslashes instead of one for the model path i.e.
JASS:
"Abilities\Spells\Undead\RaiseSkeletonWarrior\RaiseSkeleton.mdl"
//becomes
"Abilities\\Spells\\Undead\\RaiseSkeletonWarrior\\RaiseSkeleton.mdl"

Otherwise, you will receive an error from the syntax checker
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top