Need (to) simple jass help

Status
Not open for further replies.
Level 16
Joined
May 1, 2008
Messages
1,605
Seas =)

Again I try to learn some Jass and while experimenting I found something that doesn't work:

JASS:
    local unit u
        set u = GetTriggerUnit()
( I look in the tutorial for saving this unit in a variable )

JASS:
call AddSpecialEffectLoc("Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl", GetUnitLoc(udg_u))
( should create the effect after TriggerSleepAction )

But the effect isn't created. If I look at this, I think "Why not ... this total clear) Can someone help me whats wrong?^^
 
Last edited:
Seas =)

Again I try to learn some Jass and while experimenting I found something that doesn't work:

JASS:
    local unit u
        set u = GetTriggerUnit()
( I look in the tutorial for saving this unit in a variable )

JASS:
call AddSpecialEffectLoc("Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl", GetUnitLoc(udg_u))
( should create the effect after TriggerSleepAction )

But the effect isn't created. If I look at this, I think "Why not ... this total clear) Can someone help me whats wrong?^^

use your local variable. do not try to refer to a global variable. note that global shadowing is not working anymore.

JASS:
    local unit u
    set u = GetTriggerUnit()

    call AddSpecialEffectLoc("Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl", GetUnitLoc(u))

or try

JASS:
    local unit u = GetTriggerUnit()

    call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl", GetUnitX(u), GetUnitY(u)))

    set u = null

for an efficient, fast, leakfree code.

effect thingy
JASS:
local effect e = AddSpecialEffect("",x,y)
call TriggerSleepAction(time)
call DestroyEffect(e)
set e = null

or search in spell/jass section for timed special effect.

third edit: dude I told you to refer to your local variable "u", not "udg_u"
 
Level 16
Joined
May 1, 2008
Messages
1,605
Seas =)

Hmm I now I don't understand anything =S

At the first try I only used this "u". But if I tried to save, an error shows up that he can't get the unit "u" or something like that. So I tried it with udg. Now I put only "u" in and it works.

Anyway thanks for your help^^ now it works. But I don't understand one thing, (just for understanding)

You second trigger. You call "DestroyEffect(AddSpecialEffect)". Is that true, because I!! wondering about 1) Destroy and after that 2) Add...
 
Darkt3mpl3r said:
local effect e = AddSpecialEffect("",x,y)
call TriggerSleepAction(time)
call DestroyEffect(e)
set e = null

TSA != efficient.

Anyways, you should really not be using locations. The were depreciated long ago.
Use coordinates (reals), they also save you from having to remove any leaks.

btw, you can inline this;

JASS:
    local unit u
    set u = GetTriggerUnit()
    // to
    local unit u = GetTriggerUnit()

You also need to set u to null whenever you're done using it. Setting it to null at the end of the function will suffice.

Remember that you can only use locals inside the function you declared them.

I highly suggest getting into vJass.
 
TSA != efficient.

Anyways, you should really not be using locations. The were depreciated long ago.
Use coordinates (reals), they also save you from having to remove any leaks.

btw, you can inline this;

JASS:
    local unit u
    set u = GetTriggerUnit()
    // to
    local unit u = GetTriggerUnit()

You also need to set u to null whenever you're done using it. Setting it to null at the end of the function will suffice.

Remember that you can only use locals inside the function you declared them.

I highly suggest getting into vJass.

He said that he wants to use TSA, so I included TSA and btw you just repeated what I wrote .. not very kind.
 
Status
Not open for further replies.
Top