Possible or not?

wraithseeker

Tired.
Reaction score
122
JASS:
private function test takes unit target returns nothing
call KillUnit(target) // just a testing hmmmm...
endfunction

private function Init takes nothing returns nothing
    local bonus d
    set DataTable = Table.create()
    set d = bonus.Itemtype('I000')
    set d.Damage = 100
    set d.Agi = 200
    set d.Armor = 50
    set d.OnTake = function test // ontake will call the function test when the bonuses are applied
endfunction


Basically I am trying to do some things to avoid interfaces as they need to extend a struct and then you have to create another struct that extends that struct which is a pain so I was thinking whether something like this will be possible or not?
 
Reaction score
341
I'm not 100% sure what you want but..

JASS:
private struct bonus
    conditionfunc OnTake
endstruct

private function test takes unit target returns boolean
    call KillUnit(target) // just a testing hmmmm...
    return false // Not sure if you need to return a boolean or not.
endfunction

private function Init takes nothing returns nothing
    local bonus d
    set d.OnTake = function test // ontake will call the function test when the bonuses are applied
endfunction
 

saw792

Is known to say things. That is all.
Reaction score
280
TriggerHappy that won't work.
JASS:
private struct bonus
  conditionfunc onTake
endstruct

private function test takes unit target returns boolean
  call KillUnit(target)
  return false //IS necessary
endfunction

private function Init takes nothing returns nothing
  local bonus d = bonus.create()
  set d.onTake = Condition(function test)
endfunction
 
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