Importing jass

FireBladesX

Eating my wings!
Reaction score
123
I've never imported a jass trigger in to my map before. But I was looking at Acehart's tree-regrow trigger, and it looked really neat, so I thought, why not?

I copied it and pasted it in to a blank trigger, but when I tried to save, it gave me a laundry list of errors. What went wrong?


JASS:
library REGROWTREES initializer Init
globals
    private constant real RegrowAfter = 23.0 // seconds to wait until tree regrows
    private unit u
endglobals
private function IsTree takes nothing returns boolean
    local boolean b
    call SetUnitX(u, GetWidgetX(GetFilterDestructable()))
    call SetUnitY(u, GetWidgetY(GetFilterDestructable()))
    set b = IssueTargetOrder(u, "harvest", GetFilterDestructable())
    call IssueImmediateOrder(u, "stop")
    return b
endfunction
private function Regrow takes nothing returns nothing
    call TriggerSleepAction(RegrowAfter)
    call DestructableRestoreLife(GetDyingDestructable(), GetDestructableMaxLife(GetDyingDestructable()), true)
endfunction
private function Register takes nothing returns nothing
    call TriggerRegisterDeathEvent(bj_destInRegionDiesTrig, GetEnumDestructable())
endfunction
private function Init takes nothing returns nothing
    set u = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'nmpe', 0, 0, 0) // Mur'gul Slave...
    call SetUnitInvulnerable(u, true)
    call ShowUnit(u, false)
    call UnitAddAbility(u, 'Aloc') // Locust
    call UnitAddAbility(u, 'Ahrl') // Harvest Lumber
    set bj_destInRegionDiesTrig = CreateTrigger()
    call EnumDestructablesInRect(bj_mapInitialPlayableArea, Condition(function IsTree), function Register)
    call TriggerAddAction(bj_destInRegionDiesTrig, function Regrow)
    call RemoveUnit(u)
    set u = null
endfunction
endlibrary

It says "Expected end of line, expected a reserved type or handle type, expected a name..."
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
Not every destructible is a tree.

And, well, unless you want to provide a list of what is a tree (or what isn't),
harvesting it is pretty much the only way to find out if yes or no it is one.

The script, as is, accepts any destructible that can be harvested for lumber as tree.
Custom and never before seen trees included.
Without the need to edit anything.
 
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