return function

Pahl

New Member
Reaction score
7
Code:
function spell_GetCaster takes nothing returns unit
  local integer q = GetAttachedInt(GetSpellAbilityUnit(), "unit")
  local unit caster

  if ( q == 1 ) then
      set caster = udg_Casters1[0]
    else
      if ( q == 2) then
        set caster = udg_Casters2[0]
      endif
    endif

    return caster

endfunction

Is it possible to make this function available from any trigger?
Its a piece of code that i use in many triggers, and because of that i would like to save space by just calling a function when i need to do that.
 

Pahl

New Member
Reaction score
7
I does look a bit.. odd i guess.

I tried that breifly, but it complained about GetSpellAbilityUnit()
 

Luth

Lex Luthor!
Reaction score
41
Code:
function spell_GetCaster takes nothing returns unit
  local integer q = GetAttachedInt(GetSpellAbilityUnit(), "unit")

  if ( q == 1 ) then
     return udg_Casters1[0]
  endif
  if ( q == 2) then
    return udg_Casters2[0]
  endif

  return null
endfunction

There, thats a little cleaner anyway. You should be able to paste that into your map's trigger header (where Ace said it was) and access it from any other trigger. Whats the problem you're having?
 
C

Capt Griffen

Guest
Code:
function spell_GetCaster takes nothing returns unit
  local integer q = GetAttachedInt(GetSpellAbilityUnit(), "unit")

  if q == 1 then
     return udg_Casters1[0]
  elseif q == 2 then
    return udg_Casters2[0]
  endif

  return null
endfunction
 
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