function takes unit u ??

jomik

New Member
Reaction score
17
Okay, JassHelper wont compile this:

JASS:
scope Omnislash initializer Init
    
    globals
        private constant integer    omnislash       = 'A000'
        private constant real       damage          = 200.0
        private constant integer    slashes         = 5
        private constant real       range           = 600.0
    endglobals
    
    private function True takes nothing returns boolean
        return true
    endfunction
    
    private function enemy takes nothing returns boolean
        return IsUnitEnemy(GetEnumUnit(), GetOwningPlayer(GetTriggerUnit())) and GetWidgetLife(GetEnumUnit()) >= 0.407
    
    private function SlashUnit takes unit u returns nothing
        local unit o = GetTriggerUnit()
        local real x = GetUnitX(u)
        local real y = GetUnitY(u)
        
        call SetUnitPosition(o, x, y)
        call SetUnitAnimation(o, "attack")
        call UnitDamageTarget(o, u, damage, true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_DEATH, WEAPON_TYPE_CLAW_LIGHT_SLICE)
        call TriggerSleepAction(0.1)
    endfunction
    
    private function Actions takes nothing returns nothing
        local group g = CreateGroup()
        local unit o = GetTriggerUnit()
        local integer i = 0
        if (GetSpellAbilityId() == omnislash) then
            call PauseUnit(o, true)
            call SlashUnit(GetSpellTargetUnit())
            loop
                exitwhen i >= slashes
                call GroupEnumUnitsInRange(g, GetUnitX(o), GetUnitX(o), range, function enemy)
                
            call PauseUnit(o, false)
        endif
    endfunction

    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer i = 0
        loop
            exitwhen i > 15
                call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, Filter(function True))
            set i = i + 1
        endloop
        call TriggerAddAction(t, function Actions)
    endfunction
    
endscope


I am ofcourse using NewGen - so vJASS...

My error lies here:
JASS:
private function SlashUnit takes unit u returns nothing


- the error i get is Unexpected "takes"

EDIT: Added the full code.
 

Azlier

Old World Ghost
Reaction score
461
Show the whole script, plox.
 

Tyrulan

Ultra Cool Member
Reaction score
37
It's more likely complaining about the private you added. If you link the whole trigger it will be easier to help you.
 

Tyrulan

Ultra Cool Member
Reaction score
37
It would if he doesn't have vJASS or others installed correctly. Also if he hasn't used it in the proper context.
 

jomik

New Member
Reaction score
17
Well, all my other triggers are in vJASS, and compiles perfectly, I'll show you the whole code. I'm trying to make my own Omnislash...
Look at my first post.
 

Azlier

Old World Ghost
Reaction score
461
enemy lacks an 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