Special effect with JASS not working

Komaqtion

You can change this now in User CP.
Reaction score
469
Hi!
I'm trying to do my first thing with JASS all alone, ive copied things like a revive timer from thehelper before.
im trying to make 2 special effects at the target unit of the ability Ardent Mist, from Drunken Haze. this should be a very easy thing to do rught? but i cant get it to work
JASS:
function Trig_Ardent_Mist1_Actions takes nothing returns nothing
    local point ARDENTLOC
    local unit ARDENTUNIT
    set ARDENTUNIT =  GetSpellTargetUnit
    set ARDENTLOC = GetUnitLoc(ARDENTUNIT())
    call AddSpecialEffectLocBJ( ARDENTLOC, "Abilities\\Spells\\Other\\Doom\\DoomTarget.mdl" )
    call AddSpecialEffectLocBJ( ARDENTLOC, "Abilities\\Spells\\Human\\CloudOfFog\\CloudOfFog.mdl" )
endfunction
 

Exide

I am amazingly focused right now!
Reaction score
448
Your special effects leak, and you never cleaned up the points.
Use this:

JASS:

call DestroyEffect( AddSpecialEffectLoc("Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl", ARDENTLOC))

//Also

call RemoveLocation(ARDENTLOC)
set ARDENTLOC = null
set ARDENTUNIT = null


EDIT: Of course, change the special effect model to whatever you want.
 

Exide

I am amazingly focused right now!
Reaction score
448

Exide

I am amazingly focused right now!
Reaction score
448
Yea, of course. :p
Stupid copy and paste.. his fault!
 

phyrex1an

Staff Member and irregular helper
Reaction score
447
and even better:



JASS:
    local unit ARDENTUNIT = GetSpellTargetUnit
    local location ARDENTLOC = GetUnitLoc(ARDENTUNIT)
And even better:
JASS:
    local unit ARDENTUNIT = GetSpellTargetUnit()
    local location ARDENTLOC = GetUnitLoc(ARDENTUNIT)


Resulting in:
JASS:
function Trig_Ardent_Mist1_Actions takes nothing returns nothing
    local unit ARDENTUNIT = GetSpellTargetUnit()
    local location ARDENTLOC =GetUnitLoc(ARDENTUNIT)
    call AddSpecialEffectLoc("Abilities\\Spells\\Other\\Doom\\DoomTarget.mdl", ARDENTLOC)
    call AddSpecialEffectLoc("Abilities\\Spells\\Human\\CloudOfFog\\CloudOfFog.mdl", ARDENTLOC)
    call RemoveLocation(ARDENTLOC)
    set ARDENTLOC = null
    set ARDENTUNIT = null
endfunction

Thought the unit variable is very unnecessary...
 

Exide

I am amazingly focused right now!
Reaction score
448
You forgot to remove the special effects. =(

JASS:

call DestroyEffect( AddSpecialEffectLoc("Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl", ARDENTLOC))
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Thank you oo much all of you. youve been very helpfull :D:D

I wrote that before i tried it, it still doesnt work. this is how it looks now
JASS:
function Trig_Ardent_Mist1_Actions takes nothing returns nothing
    local unit ARDENTUNIT = GetSpellTargetUnit ()
    local location ARDENTLOC = GetUnitLoc(ARDENTUNIT)
    call AddSpecialEffectLoc("Abilities\\Spells\\Other\\Doom\\DoomTarget.mdl", ARDENTLOC)
    call AddSpecialEffectLoc("Abilities\\Spells\\Human\\CloudOfFog\\CloudOfFog.mdl", ARDENTLOC)
    call RemoveLocation(ARDENTLOC)
    call DestroyEffect( AddSpecialEffectLoc("Abilities\\Spells\\Other\\Doom\\DoomTarget.mdl", ARDENTLOC)
    call DestroyEffect( AddSpecialEffectLoc("Abilities\\Spells\\Human\\CloudOfFog\\CloudOfFog.mdl", ARDENTLOC)
    set ARDENTLOC = null
    set ARDENTUNIT = null
endfunction
 

phyrex1an

Staff Member and irregular helper
Reaction score
447
We've gotten to the point where "doesn't work" isn't nearly enough of a problem description. What happens? What should happen? What is the full code, including where you create the trigger and conditions?

With the "remove destructables" addition by exide the code should look like this:
JASS:
function Trig_Ardent_Mist1_Actions takes nothing returns nothing
    local unit ARDENTUNIT = GetSpellTargetUnit()
    local location ARDENTLOC = GetUnitLoc(ARDENTUNIT)
    call DestroyEffect( AddSpecialEffectLoc("Abilities\\Spells\\Other\\Doom\\DoomTarget.mdl", ARDENTLOC)
    call DestroyEffect( AddSpecialEffectLoc("Abilities\\Spells\\Human\\CloudOfFog\\CloudOfFog.mdl", ARDENTLOC)
    call RemoveLocation(ARDENTLOC)
    set ARDENTLOC = null
    set ARDENTUNIT = null
endfunction

However, I think Doom and CloudOfFog are looping effects so destroying them right away might defeat the purpose of having them in the first place...
 

Komaqtion

You can change this now in User CP.
Reaction score
469
We've gotten to the point where "doesn't work" isn't nearly enough of a problem description. What happens? What should happen? What is the full code, including where you create the trigger and conditions?

With the "remove destructables" addition by exide the code should look like this:
JASS:
function Trig_Ardent_Mist1_Actions takes nothing returns nothing
    local unit ARDENTUNIT = GetSpellTargetUnit()
    local location ARDENTLOC = GetUnitLoc(ARDENTUNIT)
    call DestroyEffect( AddSpecialEffectLoc("Abilities\\Spells\\Other\\Doom\\DoomTarget.mdl", ARDENTLOC)
    call DestroyEffect( AddSpecialEffectLoc("Abilities\\Spells\\Human\\CloudOfFog\\CloudOfFog.mdl", ARDENTLOC)
    call RemoveLocation(ARDENTLOC)
    set ARDENTLOC = null
    set ARDENTUNIT = null
endfunction

However, I think Doom and CloudOfFog are looping effects so destroying them right away might defeat the purpose of having them in the first place...

This is the entire trigger:
JASS:
function Trig_Ardent_Mist_Copy_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A00L' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Ardent_Mist_Copy_Actions takes nothing returns nothing
    local unit ARDENTUNIT = GetSpellTargetUnit ()
    local location ARDENTLOC = GetUnitLoc(ARDENTUNIT)
    call AddSpecialEffectLoc("Abilities\\Spells\\Other\\Doom\\DoomTarget.mdl", ARDENTLOC)
    call AddSpecialEffectLoc("Abilities\\Spells\\Human\\CloudOfFog\\CloudOfFog.mdl", ARDENTLOC)
    call RemoveLocation(ARDENTLOC)
    call DestroyEffect( AddSpecialEffectLoc("Abilities\\Spells\\Other\\Doom\\DoomTarget.mdl", ARDENTLOC)
    call DestroyEffect( AddSpecialEffectLoc("Abilities\\Spells\\Human\\CloudOfFog\\CloudOfFog.mdl", ARDENTLOC)
    set ARDENTLOC = null
    set ARDENTUNIT = null
endfunction

//===========================================================================
function InitTrig_Ardent_Mist_Copy takes nothing returns nothing
    set gg_trg_Ardent_Mist_Copy = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Ardent_Mist_Copy, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Ardent_Mist_Copy, Condition( function Trig_Ardent_Mist_Copy_Conditions ) )
    call TriggerAddAction( gg_trg_Ardent_Mist_Copy, function Trig_Ardent_Mist_Copy_Actions )
endfunction

and i would like the effects to be there for the time it is on the spell, which is 7.50s 8s 8.50s 9s 9.50s 10s. i dont know the reason for it not working because i dont have it enabled and when i try to enable it there is an error
 

Exide

I am amazingly focused right now!
Reaction score
448
All your trigger does is to add special effects, why are you using JASS for this, you could do it easier with GUI. :p

Remove these two:
JASS:

    call AddSpecialEffectLoc("Abilities\\Spells\\Other\\Doom\\DoomTarget.mdl", ARDENTLOC)
    call AddSpecialEffectLoc("Abilities\\Spells\\Human\\CloudOfFog\\CloudOfFog.mdl", ARDENTLOC)

However, calling DestroyEffect(AddSpecialEffectLoc .... might be too fast to remove the effect, for you to see it. (It gets removed the second it's born. -This only work with a few effects, like Thunderclap.)

I would've done it with two triggers and in GUI, if I were you.

To fix it in JASS, you will probably need to add waits, before removing the special effects. -Then you can't call DestroyEffect(AddSpecialEffectLoc...


I THINK this will work: (Never tested it.)

JASS:

function Trig_Ardent_Mist_Copy_Conditions takes nothing returns boolean
    if ( ( GetSpellAbilityId() == 'A00L' ) ) then
        return true
    endif
    return false
endfunction

function Trig_Ardent_Mist_Copy_Actions takes nothing returns nothing
    local unit ARDENTUNIT = GetSpellTargetUnit ()
    local location ARDENTLOC = GetUnitLoc(ARDENTUNIT)
    local effect SFX1
    local effect SFX2
    set SFX1 = AddSpecialEffectLoc("Abilities\\Spells\\Other\\Doom\\DoomTarget.mdl", ARDENTLOC)
    set SFX2 = AddSpecialEffectLoc("Abilities\\Spells\\Human\\CloudOfFog\\CloudOfFog.mdl", ARDENTLOC)
    call TriggerSleepAction( 10.0 )    //The actual wait, whatever it&#039;s called, can&#039;t remember.. <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite7" alt=":p" title="Stick Out Tongue    :p" loading="lazy" data-shortname=":p" />
    call DestroyEffect(SFX1)
    call DestroyEffect(SFX2)
    call RemoveLocation(ARDENTLOC)
    set ARDENTLOC = null
    set ARDENTUNIT = null
endfunction

//===========================================================================
function InitTrig_Ardent_Mist_Copy takes nothing returns nothing
    set gg_trg_Ardent_Mist_Copy = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Ardent_Mist_Copy, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Ardent_Mist_Copy, Condition( function Trig_Ardent_Mist_Copy_Conditions ) )
    call TriggerAddAction( gg_trg_Ardent_Mist_Copy, function Trig_Ardent_Mist_Copy_Actions )
endfunction
 

Komaqtion

You can change this now in User CP.
Reaction score
469
well if i do it in GUI, how will i be able to remove the effects, they will be overwritten as last created special effect
 

Exide

I am amazingly focused right now!
Reaction score
448
This is how I do it:

Trigger 1:

Code:
Special Effect Destruction
    Events
    Conditions
    Actions
        Custom script:   local effect tempEffect
        Custom script:   set tempEffect = udg_SpecialFX
        Wait 7.00 game-time seconds
        Custom script:   set udg_SpecialFX = tempEffect
        Special Effect - Destroy SpecialFX


Trigger 2:

Code:
Crypt Spawn Runes
    Events
    Conditions
    Actions
        Set specloc = (Random point in Crypt Runes Spawn <gen>)
        Special Effect - Create a special effect at specloc using Abilities\Spells\Items\VampiricPotion\VampPotionCaster.mdl
        Set SpecialFX = (Last created special effect)
        Trigger - Run Special Effect Destruction <gen> (ignoring conditions)
        Custom script:   call RemoveLocation(udg_specloc)

-Just change Trigger 2 so that it suits your needs.

This will keep the special effects for 7 seconds, then remove them -so they will have plenty of time to do whatever they do..
Just change the wait in Trigger 1 to suits your needs. (Or leave it as it is, it works fine.)
 

N-a-z-g-u-l

New Member
Reaction score
30
umm well what are you doing there?

JASS:
function Trig_Ardent_Mist_Copy_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == &#039;A00L&#039;
endfunction

function Trig_Ardent_Mist_Copy_Actions takes nothing returns nothing
    local location ARDENTLOC = GetUnitLoc(GetSpellTargetUnit())
    local effect e1 = AddSpecialEffectLoc(&quot;Abilities\\Spells\\Other\\Doom\\DoomTarget.mdl&quot;, ARDENTLOC)
    local effect e2 = AddSpecialEffectLoc(&quot;Abilities\\Spells\\Human\\CloudOfFog\\CloudOfFog.mdl&quot;, ARDENTLOC)
    call RemoveLocation(ARDENTLOC)
    set ARDENTLOC = null
    call PolledWait(7.5+0.5*GetUnitAbilityLevel(GetSpellTargetUnit(),GetSpellAbilityId()))
    call DestroyEffect( e1 )
    call DestroyEffect( e2 )
    set e1 = null
    set e2 = null
endfunction

//===========================================================================
function InitTrig_Ardent_Mist_Copy takes nothing returns nothing
    set gg_trg_Ardent_Mist_Copy = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Ardent_Mist_Copy, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Ardent_Mist_Copy, Condition( function Trig_Ardent_Mist_Copy_Conditions ) )
    call TriggerAddAction( gg_trg_Ardent_Mist_Copy, function Trig_Ardent_Mist_Copy_Actions )
endfunction


what about this one? :p
 
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