Basic Return Help

Naga'sShadow

Ultra Cool Member
Reaction score
49
I've got a trigger that wants to cast a spell on all nearby units. I've set the caster function up but the syntax checker says the actions function is expecting a return, except I don't see any actions that give a return.
JASS:
function Ghostwalk_Slam_Conditions takes nothing returns boolean
    local unit Caster = H2U(GetHandleHandle(Caster, "Caster"))// I added this line and it clears up that error but I'm not sure if its done right
    return ( IsUnitEnemy(GetEnumUnit(), GetOwningPlayer(Caster)) == true )
endfunction

function Ghostwalk_Slam_Actions takes nothing retruns nothing
    call CreateNUnitsAtLoc( 1, 'h001', GetOwningPlayer(Caster), GetUnitLoc(GetEnumUnit()), bj_UNIT_FACING )
    call UnitApplyTimedLifeBJ( 2.00, 'BTLF', GetLastCreatedUnit() )
    call UnitAddAbilityBJ( 'A00O', GetLastCreatedUnit() )
    call IssueTargetOrderBJ( GetLastCreatedUnit(), "banish", GetEnumUnit() )
endfunction


This is the line that calls this function.

JASS:
call ForGroupBJ( GetUnitsInRangeOfLocMatching(500.00, GetUnitLoc(Caster), Condition(function Ghostwalk_Slam_Conditions)), function Ghostwalk_Slam_Actions )


On a slightly related note "Caster" is a local variable declared earilier in the trigger. I'm using handle variables to move it around. Do I need to refer to it with handles in this part as well?
 

Trollvottel

never aging title
Reaction score
262
On a slightly related note "Caster" is a local variable declared earilier in the trigger. I'm using handle variables to move it around. Do I need to refer to it with handles in this part as well?
Reply With Quote

you have to, locals are call local because they ARE local
 

Romek

Super Moderator
Reaction score
963
JASS:
function Ghostwalk_Slam_Actions takes nothing retruns nothing

Its probably because 'returns' is spelt wrong.
 

Romek

Super Moderator
Reaction score
963
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