• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Need help with a spell.

Status
Not open for further replies.
Level 2
Joined
Jul 18, 2004
Messages
11
Ok, my spell is basically a Shockwave that teleports the casting unit to the targeted point. It worked fine with GUI but after reading a couple of tutorials I thought I'd see if I could make it in JASS too. Here's what I have:
Code:
function Trig_Flame_Burst_Copy_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A00I' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Flame_Burst_Copy_Actions takes nothing returns nothing
local location l = GetSpellTargetLoc()
local real x = GetLocationX(l)
local real y = GetLocationY(l)
local unit u = GetTriggerUnit()
PauseUnit takes unit u, boolean true returns nothing
SetUnitFlyHeight takes unit u, real 0, real 0 returns nothing
SetUnitPositionLoc takes u, location , GetLocationX(l), GetLocationY(l), returns nothing
SetUnitFlyHeight takes unit u, GetUnitDefaultFlyHeightu, real 0 returns nothing
PauseUnit takes unit u boolean false returns nothing
endfunction

//===========================================================================
function InitTrig_Flame_Burst_Copy takes nothing returns nothing
    set gg_trg_Flame_Burst_Copy = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Flame_Burst_Copy, EVENT_PLAYER_UNIT_SPELL_FINISH )
    call TriggerAddCondition( gg_trg_Flame_Burst_Copy, Condition( function Trig_Flame_Burst_Copy_Conditions ) )
    call TriggerAddAction( gg_trg_Flame_Burst_Copy, function Trig_Flame_Burst_Copy_Actions )
endfunction
Every time I try and test the map I get a message saying that it 'Expected a code statement' in all the lines that involve changing the unit in some way. I know that you can call a function instead, but I read somewhere that this way reduces lag. Can anyone point me in the right direction?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
You have NO IDEA WHAT SO EVER ABOUT JASS.
JASS:
function Trig_Flame_Burst_Copy_Conditions takes nothing returns boolean 
    if ( not ( GetSpellAbilityId() == 'A00I' ) ) then 
        return false 
    endif 
    return true 
endfunction 

function Trig_Flame_Burst_Copy_Actions takes nothing returns nothing 
local location l = GetSpellTargetLoc() 
local real x = GetLocationX(l) 
local real y = GetLocationY(l) 
local unit u = GetTriggerUnit() 
PauseUnit takes unit u, boolean true returns nothing 
SetUnitFlyHeight takes unit u, real 0, real 0 returns nothing 
SetUnitPositionLoc takes u, location , GetLocationX(l), GetLocationY(l), returns nothing 
SetUnitFlyHeight takes unit u, GetUnitDefaultFlyHeightu, real 0 returns nothing 
PauseUnit takes unit u boolean false returns nothing 
endfunction 

//=========================================================================== 
function InitTrig_Flame_Burst_Copy takes nothing returns nothing 
    set gg_trg_Flame_Burst_Copy = CreateTrigger(  ) 
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Flame_Burst_Copy, EVENT_PLAYER_UNIT_SPELL_FINISH ) 
    call TriggerAddCondition( gg_trg_Flame_Burst_Copy, Condition( function Trig_Flame_Burst_Copy_Conditions ) ) 
    call TriggerAddAction( gg_trg_Flame_Burst_Copy, function Trig_Flame_Burst_Copy_Actions ) 
endfunction

Your missing countless calls and forgeting to give most calls a function.
JASS:
PauseUnit takes unit u, boolean true returns nothing
Your not defining the function your calling it so no è&ç%/() wonder it will not work.
Try this instead.

JASS:
function Trig_Flame_Burst_Copy_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A00I'
endfunction

function Trig_Flame_Burst_Copy_Actions takes nothing returns nothing 
    local location l = GetSpellTargetLoc()
    local unit u = GetTriggerUnit()
    call PauseUnit(u,true)
    call SetUnitFlyHeight(u,0,0)
    call SetUnitPositionLoc(u,l)
    call SetUnitFlyHeight(u,GetUnitDefaultFlyHeight(u),0)
    call PauseUnit(u,false)
    call RemoveLocation(l)
    set l = null
    set u = null
endfunction 

function InitTrig_Flame_Burst_Copy takes nothing returns nothing 
    set gg_trg_Flame_Burst_Copy = CreateTrigger() 
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Flame_Burst_Copy,EVENT_PLAYER_UNIT_SPELL_FINISH) 
    call TriggerAddCondition(gg_trg_Flame_Burst_Copy,Condition(function Trig_Flame_Burst_Copy_Conditions)) 
    call TriggerAddAction(gg_trg_Flame_Burst_Copy,function Trig_Flame_Burst_Copy_Actions) 
endfunction

THAT IS WHAT IT SHOULD BE!!!!!!!
I was kind enough to even rewrite the trigger removing unessary locals and it will run more efficently as well as nolonger leak.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
PurplePoot. . .
Do not revive topics 10 days old or older.
It states so in the server rules.

Im sorry I was so angry writing that. . .
I was writing a verycomplex spell for my map that was a jassed up star fall with added effects and i was having trouble deciding on how to write it.

If you need any help with a spell PM me your jass code and ill rewrite it so that it works and explain where you went worng.
 
Status
Not open for further replies.
Top