One stupid JASS question

the Immortal

I know, I know...
Reaction score
51
It doesn't even deserve to be sent to the JASS section, but I have this:
Code:
    local real MaxDist = DistanceBetweenPoints(GetUnitLoc( target ), GetSpellTargetLoc())
    call TriggerSleepAction( ( MaxDist / 2000.00 ) )
    set MaxDist = 0
(I've removed some actions)
I think it should work, but when I try to save it, the WE 'says' "Invalid argument type (void)"
afaik "TriggerSleepAction" takes real ... or what ???
 

Chocobo

White-Flower
Reaction score
409
Code:
    local real MaxDist = DistanceBetweenPoints(GetUnitLoc( target ), GetSpellTargetLoc())
    call TriggerSleepAction( ( MaxDist / 2000.00 ) )
    set MaxDist = 0

Need to be in a function.

GetUnitLoc leaks.

Code:
    local real MaxDist = DistanceBetweenPoints(GetUnitLoc(target ), GetSpellTargetLoc())
    call TriggerSleepAction((MaxDist / 2000.00 ))
    set MaxDist = 0
 

the Immortal

I know, I know...
Reaction score
51
What do you mean "Need to be in a function." ? To make a function that returns MaxDist/2000 ? Sry, but I am confused :confused:

> GetUnitLoc leaks.

>> (I've removed some actions)
 

the Immortal

I know, I know...
Reaction score
51
It's a "sliding" trigger I made myself (hate using other people's triggers):
Code:
function Trig_Spill_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A02E' ) ) then
        return false
    endif
    return true
endfunction

function KillD takes nothing returns nothing
    call KillDestructable( GetEnumDestructable() )
endfunction

function trgMove takes unit target returns nothing
    call SetUnitPositionLoc( target, PolarProjectionBJ(GetUnitLoc(target), 20.00, GetUnitFacing(target)))
endfunction

function Trig_Spill_Actions takes nothing returns nothing
    local unit target = GetTriggerUnit ()
    local trigger trg = CreateTrigger()
    local location loc = GetUnitLoc( target)
    local real MaxDist = DistanceBetweenPoints( loc, GetSpellTargetLoc())
    call SetUnitPathing( target, false )
    call PauseUnitBJ( true, target )
    call TriggerRegisterTimerEventPeriodic( trg, 0.010 )
    call TriggerAddAction( trg, trgMove(target))
    call TriggerSleepAction( ( MaxDist / 2000.00 ) )
    call DestroyTrigger (trg)
    call EnumDestructablesInCircleBJ( 200.00, GetUnitLoc(target), function KillD )
    call SetUnitPathing( target, true )
    call PauseUnitBJ( false, target )
    set target = null
    set MaxDist = 0
    call RemoveLocation( loc)
endfunction

function InitTrig_Spill takes nothing returns nothing
    set gg_trg_Spill = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Spill, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Spill, Condition( function Trig_Spill_Conditions ) )
    call TriggerAddAction( gg_trg_Spill, function Trig_Spill_Actions )
endfunction
I'm sry if my error is in other part of the trigger :(

Edit: Here is a screenshot:
 

SFilip

Gone but not forgotten
Reaction score
634
call TriggerAddAction( trg, trgMove(target))
doesn't work this way. you can't specify a parameter for an action.
call TriggerAddAction( trg, function trgMove)
you need to find some other way to use that target. either with a global variable or gamecache.
 

the Immortal

I know, I know...
Reaction score
51
Ooh, yes, so stupid mistake. I fixed it and it now works. 10x very much.
btw. But why then the WE says the error is in the lower line ?
 

SFilip

Gone but not forgotten
Reaction score
634
> But why then the WE says the error is in the lower line ?
because WE syntax check is the worst crap i've ever seen.
use JassCraft when you get a compile error and things should become clearer.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top