Library to GUI

elpini0

New Member
Reaction score
1
Hi, friends!! Im having problems to make a library work in RoC. Can somebody help me makign this library into GUI or JASS functions? (not scopes)

THANKS A LOT!

JASS:
library REGROWTREES initializer Init
    globals
        private constant real RegrowAfter = 8.0 // seconds to wait until tree regrows
        private constant real Range = 80.0      // distance around tree that needs to be free of units before regrowing
        private unit u
        private group g = CreateGroup()
        private boolexpr b
        private boolean ok
    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 IsUnitNear takes nothing returns boolean
        if GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0.5 then
        set ok = false
        endif
        return false
    endfunction
    private function Regrow takes nothing returns nothing
        local destructable t = GetTriggerDestructable()
        call TriggerSleepAction(RegrowAfter)
        loop
            set ok = true
            call GroupClear(g)
            call GroupEnumUnitsInRange(g, GetWidgetX(t), GetWidgetY(t), Range, b)
            exitwhen ok
            call TriggerSleepAction(3.0)
        endloop
        call DestructableRestoreLife(t, GetDestructableMaxLife(t), true)
        set t = null
    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)
        set b = Condition(function IsUnitNear)
        call RemoveUnit(u)
        set u = null
    endfunction
endlibrary
 

Jedi

New Member
Reaction score
63
That library does nothing?Pick all your trees at map initialization and add another trigger "picked destructable dies" event.
 

elpini0

New Member
Reaction score
1
This is the source of all of your problems

Yeah and Blink doesn't work either on RoC xD i had to make a trigger based on the "show" ability =P

But i would like this to work... Maybe manually with a few triggers, but my JASS knolwedge is very short.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top