[Lua] Trigger variable event is not working

Level 20
Joined
Jun 26, 2020
Messages
1,586
Ask God, only He knows explanation of triggers without anyone showing them to him directly.
Is necessary? Because what I said is the trigger variable event that all of us know is not working so its a general problem and not somethig specific, is like say "my program doesn't open" and you ask me to see it, just to see effectively isn't open.

But anyway, here is the code:
Lua:
--[[
********************************************************************************************************
**************************************Bounty Controller by HerlySQR*************************************
********************************************************************************************************

      https://www.hiveworkshop.com/threads/jass-bounty-controller-gui-friendly.332114/

      This library was made to have almost every control of the bounties of the units
      Important is have deactivated the bounties (this system do that, but don't active them)
      and you have to set the values of the bounties manually.

      If you wanna set the default value of the bounty of the units you must use these functions:
          SetBountyBase("FourCC("ID of the unit")","Bounty: Base")
          SetBountyDice("FourCC("ID of the unit")","Bounty: Number of dice")
          SetBountySides("FourCC("ID of the unit")","Bounty: Sides per dice")
      or to do it all in once use this function:
          BOUNTY("FourCC("ID of the unit")","Bounty: Base","Bounty: Number of dice","Bounty: Sides per dice")
      to get a posible bounty from a unit use the function:
          GetBountyFromUnitType("FourCC("ID of the unit")")
      to get the individual values of the bounty use these functions:
          GetBountyBase("FourCC("ID of the unit")")
          GetBountyDice("FourCC("ID of the unit")")
          GetBountySides("FourCC("ID of the unit")")
     
      Is also posible do it in GUI, doing this steps
        SetBountyBase:
              Set BountyUnitID = "Unit-Type of you unit"
              Set BountyBase = "Bounty: Base"
              Trigger - Run BountySetBase (Ignoring conditions)
          SetBountyDice:
              Set BountyUnitID = "Unit-Type of you unit"
              Set BountyDice = "Bounty: Number of dice"
              Trigger - Run BountySetDice (Ignoring conditions)
          SetBountySides:
              Set BountyUnitID = "Unit-Type of you unit"
              Set BountySides = "Bounty: Sides per dice"
              Trigger - Run BountySetBase (Ignoring conditions)
          BOUNTY:
              Set BountyUnitID = "Unit-Type of you unit"
              Set BountyBase = "Bounty: Base"
              Set BountyDice = "Bounty: Number of dice"
              Set BountySides = "Bounty: Sides per dice"
              Trigger - Run BountySet (Ignoring conditions)

      The variables used are cleaned automatically, and to get the values do:
          GetBountyBase:
              Set BountyUnitID = "Unit-Type of you unit"
              Trigger - Run BountyGetBase (Ignoring conditions)
              The variable "BountyBase" has the value wanted.
          GetBountyDice:
              Set BountyUnitID = "Unit-Type of you unit"
              Trigger - Run BountyGetDice (Ignoring conditions)
              The variable "BountyDice" has the value wanted.
          GetBountySides:
              Set BountyUnitID = "Unit-Type of you unit"
              Trigger - Run BountyGetBase (Ignoring conditions)
              The variable "BountySides" has the value wanted.
          GetBountyFromUnitType:
              Set BountyUnitID = "Unit-Type of you unit"
              Trigger - Run BountyGet (Ignoring conditions)
              The variable "Bounty" has the value wanted.

      To edit the values of a bounty when a unit dies you must have
      a trigger with the event "BountyDeadEvent becomes Equal to 1.00", this event happens when
      a unit dies and the function "BountyText" will be called (That is called it doesn't mean the text will be displayed
      and the bounty will be given to the player, only those two will happen if all the rest of values are valid)
      the variables that you can edit are:
          "Bounty": The quantity of gold or lumber that you will receive (it can be negative).
          "BountyTextTag": The texttag that will be displayed.
          "BountyPermanent": This allows erase it (care, if this value is true and you don't use the texttag later it can be an object leak)
          "BountyColor": The color of the text (if is not set, the color of the text will have the default values depending of the state).
          "BountySize": The size of the text.
          "BountyLifeSpan": The lifetime of the text (if "BountyPermanent" is true this value is useless).
          "BountyFadePoint": How many seconds the text will fade after the lifespan.
          "BountySpeed": The speed of the text.
          "BountyDirection": The direction to the texttag will move.
          "BountyHeight": How many distance the text will be from the floor.
          "BountyShow": To show the text or not.
          "BountyShowNothing": If the Bounty is 0 by default the text is not showed, if you set this to true, the text will be showed even if the bounty is 0.
          "BountyAllowFriendFire": By default the bounty only will happen if the dying unit is enemy of the killing unit, if you set this to true, the bounty will happen even if they weren't enemies.
          "BountyEffect": The effect that will be displayed (In the same place of the text)
          "BountyShowEffect": The effect will be displayed if this value is true.
          "BountyPlayer": The player how will receive the bounty.
          "BountyPlayerState": What type of bounty the player will receive (only "gold" and "lumber" are valid).
          "BountyUnitPos": The position of the text and the effect (If is a unit)
          "BountyLocPos": The position of the text and the effect (If is a location, this have more priority than BountyUnitPos, and is removed with the clear function to prevent object leak, of course only if "BountyNotClear" is not true, and for this reason don't set it to a variable that you gonna use later)
          "BountyPosX", "BountyPosY", "BountyPosZ": The coords of the texttag when is displayed (they are only to read them, and only accesible with the event "BountyEvent becomes Equal to 1.00").
          "BountyWhoSee": The players who can see the text.
      To reffering the killing unit use the variable "BountyKillingUnit" and to the dying unit, "BountyDyingUnit"
      and when the bounty is given an (maybe) the text displayed you can use the event "BountyEvent becomes Equal to 1.00"
      You can't edit the text or the bounty because with this, because it happens after the process ends, but you can get the values
      (Note: If you wanna change the variable "BountyPlayer", to show him the text you have to (maybe) remove the previous player
      and add the new player to the player group "BountyWhoSee".)

      If you wanna have your own bounty with another event or function just set some of the variables previously seen
      there are neccesary values like "Bounty", "BountyPlayer", "BountyWhoSee" (You have to add manually the BountyPlayer in this case),
      "BountyUnitPos or BountyLocPos", because they not have default values different than nothing
      and then add in GUI "Trigger - Run BountyText (Ignoring conditions)" or in Lua BountyText()
      But in Lua you can use the function BountyCall(bounty,unitpos,bountyPlayer,addplayer,permanent).

      If you wanna have access to the texttag use the variable "BountyTextTag", but you have to know how, you can only do it with the event "BountyEvent"
      if you use this when you use manually the function BountyText better do Temp=BountyText() or Temp=BountyCall(<stuff>).

      And if you wanna keep the changes of the previous instance (included "BountyTextTag"), set the variable "BountyNotClear" to true, and you have to do it every instance
      you do if you wanna still saving the changes because this value is returned to false, but carefully, because the next instance can have
      unwanted changes.

      Additionally it has the variable LocalPlayer to not use GetLocalPlayer() everytime, if you don't like it,
      just uncoment the "local" before of it in the variables section.

      If you wanna deactive the system do "Trigger - Turn off Bounty_Controller"

  =====================================================================================================
]]


do
    local Bounties={}
    Bounties[0],Bounties[1],Bounties[2]={},{},{}
    --[[local]] LocalPlayer=nil
    --This "constants" can be edited (obviously only valid values)
    local DEF_COLOR_GOLD="ffcc00"
    local DEF_COLOR_LUMBER="32cd32"
    local DEF_SIZE=10
    local DEF_LIFE_SPAN=3.50
    local DEF_SPEED=64
    local DEF_DIRECTION=90
    local DEF_FADE_POINT=2.50
    local DEF_STATE="gold"
    local DEF_HEIGHT=0
    local DEF_SHOW=true
    local DEF_SHOW_NOTHING=false
    local DEF_ALLOW_FRIEND_FIRE=false
    local DEF_EFFECT="UI\\Feedback\\GoldCredit\\GoldCredit.mdl"
    local DEF_SHOW_EFFECT=true
    local DEF_PERMANENT=false
   
    --The functions to set the bounty stats
   
    function SetBountyBase(id,base) Bounties[0][id]=base end
   
    function SetBountyDice(id,dice) Bounties[1][id]=dice end
   
    function SetBountySides(id,sides) Bounties[2][id]=sides end
   
    function BOUNTY(id,base,dice,side)
        SetBountyBase(id,base)
        SetBountyDice(id,dice)
        SetBountySides(id,side)
    end
   
    --The functions to get the bounty stats (that you set before)
   
    function GetBountyBase(id)
        if Bounties[0][id] then
            return Bounties[0][id]
        end
        return 0
    end
   
    function GetBountyDice(id)
        if Bounties[1][id] then
            return Bounties[1][id]
        end
        return 0
    end
   
    function GetBountySides(id)
        if Bounties[2][id] then
            return Bounties[2][id]
        end
        return 0
    end
   
    function GetBountyFromUnitType(id)
        return GetBountyBase(id)+GetRandomInt(0,GetBountyDice(id)*GetBountySides(id))
    end
   
    --This function is runned at the map initialization, if you wanna use it to set your bounties, you can do it
   
    local function SetData()
       
        --[[Peasant]]   BOUNTY(FourCC("hpea"),35,6,3)
       
        for i=0,PLAYER_NEUTRAL_AGGRESSIVE do
            SetPlayerFlagBJ(PLAYER_STATE_GIVES_BOUNTY,false,Player(i))
        end
    end
   
    --To clear the data
    local function Clear()
        if not udg_BountyNotClear then
            udg_BountyTextTag=nil
            udg_BountyColor=nil
            udg_BountySize=DEF_SIZE
            udg_BountyLifeSpan=DEF_LIFE_SPAN
            udg_BountyFadePoint=DEF_FADE_POINT
            udg_BountySpeed=DEF_SPEED
            udg_BountyDirection=DEF_DIRECTION
            udg_BountyPlayerState=DEF_STATE
            udg_BountyHeight=DEF_HEIGHT
            udg_BountyShow=DEF_SHOW
            udg_BountyShowNothing=DEF_SHOW_NOTHING
            udg_BountyAllowFriendFire=DEF_ALLOW_FRIEND_FIRE
            udg_BountyEffect=DEF_EFFECT
            udg_BountyShowEffect=DEF_SHOW_EFFECT
            udg_BountyPermanent=DEF_PERMANENT
            udg_BountyPlayer=nil
            udg_BountyUnitPos=nil
            udg_BountyPosX=0.00
            udg_BountyPosY=0.00
            udg_Bounty=0
            ForceClear(udg_BountyWhoSee)
            if udg_BountyLocPos then
                RemoveLocation(udg_BountyLocPos)
                udg_BountyLocPos=nil
            end
        end
        udg_BountyKillingUnit=nil
        udg_BountyDyingUnit=nil
        udg_BountyNotClear=false
    end
   
    --This is to check the sign of the bounty
    local function Sign(i)
        if i<0 then
            return nil
        end
        return "+"
    end
   
    --The function that runs the bounty and the texttag
    function BountyText()
        local state,tt
       
        if udg_BountyPlayerState=="gold" then
            state=PLAYER_STATE_RESOURCE_GOLD
        elseif udg_BountyPlayerState=="lumber" then
            state=PLAYER_STATE_RESOURCE_LUMBER
        else
            Clear()
            return nil --If the state is not valid, the process stop
        end
       
        if udg_Bounty==0 and not udg_BountyShowNothing then
            udg_BountyShow=false
            udg_BountyShowEffect=false
        end
       
        AdjustPlayerStateSimpleBJ(udg_BountyPlayer,state,udg_Bounty)
        state=nil
       
        if not udg_BountyColor then
            if udg_BountyPlayerState=="gold" then
                udg_BountyColor=DEF_COLOR_GOLD
            elseif udg_BountyPlayerState=="lumber" then
                udg_BountyColor=DEF_COLOR_LUMBER
            end
        end
       
        if udg_BountyLocPos then
            udg_BountyPosX=GetLocationX(udg_BountyLocPos)
            udg_BountyPosY=GetLocationY(udg_BountyLocPos)
        elseif udg_BountyUnitPos then
            udg_BountyPosX=GetUnitX(udg_BountyUnitPos)
            udg_BountyPosY=GetUnitY(udg_BountyUnitPos)
        else
            udg_BountyShow=false
            udg_BountyShowEffect=false --If there is no position to the text, the text and the effect won't show
        end
       
        udg_BountyTextTag=CreateTextTag()
        SetTextTagPermanent(udg_BountyTextTag,udg_BountyPermanent)
        SetTextTagText(udg_BountyTextTag,"|cff"+udg_BountyColor+Sign(udg_Bounty)+I2S(udg_Bounty)+"|r",TextTagSize2Height(udg_BountySize))
        SetTextTagVisibility(udg_BountyTextTag,IsPlayerInForce(LocalPlayer,udg_BountyWhoSee) and udg_BountyShow)
        SetTextTagPos(udg_BountyTextTag,udg_BountyPosX,udg_BountyPosY,udg_BountyHeight)
        SetTextTagFadepoint(udg_BountyTextTag,udg_BountyFadePoint)
        SetTextTagLifespan(udg_BountyTextTag,udg_BountyLifeSpan)
        SetTextTagVelocityBJ(udg_BountyTextTag,udg_BountySpeed,udg_BountyDirection)
       
        if udg_BountyShowEffect then
            DestroyEffect(AddSpecialEffect(udg_BountyEffect,udg_BountyPosX,udg_BountyPosY))
        end
       
        udg_BountyEvent=0.00
        udg_BountyEvent=1.00
        udg_BountyEvent=0.00
       
        tt=udg_BountyTextTag
       
        Clear()
       
        return tt
    end
   
    --Function to short the Lua process
    function BountyCall(bounty,pos,myplayer,addplayer,permanent)
        udg_Bounty=bounty
        udg_BountyUnitPos=pos
        udg_BountyPlayer=myplayer
        if addplayer then ForceAddPlayer(udg_BountyWhoSee,udg_BountyPlayer) end
        udg_BountyPermanent=permanent
        return BountyText()
    end

    local oldInit = InitBlizzard
    function InitBlizzard()
        oldInit()
       
        --The trigger that runs when a unit dies
        udg_Bounty_Controller=CreateTrigger()
        TriggerRegisterAnyUnitEventBJ(udg_Bounty_Controller,EVENT_PLAYER_UNIT_DEATH)
        TriggerAddCondition(udg_Bounty_Controller,Condition(function()
            udg_BountyKillingUnit=GetKillingUnit()
            if not udg_BountyKillingUnit then --If there is not killing unit then the process stop
                return false
            end
           
            udg_BountyDyingUnit=GetDyingUnit()
            udg_Bounty=GetBountyFromUnitType(GetUnitTypeId(udg_BountyDyingUnit))
            if not udg_Bounty then udg_Bounty=0 end
           
            udg_BountyPlayer=GetOwningPlayer(udg_BountyKillingUnit)
            ForceAddPlayer(udg_BountyWhoSee,udg_BountyPlayer)
            udg_BountyUnitPos=udg_BountyDyingUnit
           
            udg_BountyDeadEvent=0.00
            udg_BountyDeadEvent=1.00
            udg_BountyDeadEvent=0.00
           
            if IsUnitEnemy(udg_BountyDyingUnit,udg_BountyPlayer) or udg_BountyAllowFriendFire then BountyText() end
           
            return false
        end))
        --(For GUI users) The trigger that shows the text
        udg_BountyText=CreateTrigger()
        TriggerAddAction(udg_BountyText,BountyText)
        --(For GUI users) The triggers that set the default bounty of a unit
        udg_BountySet=CreateTrigger()
        TriggerAddAction(udg_BountySet,function()
            BOUNTY(udg_BountyUnitID,udg_BountyBase,udg_BountyDice,udg_BountySides)
            udg_BountyUnitID,udg_BountyBase,udg_BountyDice,udg_BountySides=0,0,0,0
        end)
        udg_BountySetBase=CreateTrigger()
        TriggerAddAction(udg_BountySetBase,function()
            SetBountyBase(udg_BountyUnitID,udg_BountyBase)
            udg_BountyUnitID,udg_BountyBase=0,0
        end)
        udg_BountySetDice=CreateTrigger()
        TriggerAddAction(udg_BountySetDice,function()
            SetBountyDice(udg_BountyUnitID,udg_BountyDice)
            udg_BountyUnitID,udg_BountyDice=0,0
        end)
        udg_BountySetSides=CreateTrigger()
        TriggerAddAction(udg_BountySetSides,function()
            SetBountySides(udg_BountyUnitID,udg_BountySides)
            udg_BountyUnitID=0
            udg_BountySides=0
        end)
        --(For GUI users) The triggers that get the bounty values of a unit (that you set before)
        udg_BountyGet=CreateTrigger()
        TriggerAddAction(udg_BountyGet,function()
            udg_Bounty=GetBountyFromUnitType(udg_BountyUnitID)
            udg_BountyUnitID=0
        end)
        udg_BountyGetBase=CreateTrigger()
        TriggerAddAction(udg_BountyGetBase,function()
            udg_BountyBase=GetBountyBase(udg_BountyUnitID)
            udg_BountyUnitID=0
        end)
        udg_BountyGetDice=CreateTrigger()
        TriggerAddAction(udg_BountyGetDice,function()
            udg_BountyDice=GetBountyDice(udg_BountyUnitID)
            udg_BountyUnitID=0
        end)
        udg_BountyGetSides=CreateTrigger()
        TriggerAddAction(udg_BountyGetSides,function()
            udg_BountySides=GetBountySides(udg_BountyUnitID)
            udg_BountyUnitID=0
        end)
        --Last details
        TimerStart(CreateTimer(),0.00,false,function()
            LocalPlayer=GetLocalPlayer()
            SetData()
            udg_BountyEvent=0.00
            udg_BountyEvent=2.00
            udg_BountyEvent=0.00
        end)
    end
   
    local oldGlobals=InitGlobals
    function InitGlobals()
        oldGlobals()
        Clear()
    end
end
 
In Lua the real Variable Event are in a table called globals. When you wana throw an event by seting the value. Then you have to to mention that globals.
like that;
Code:
globals.udg_Talent__Event = 0.0
globals.udg_Talent__Event = -1.0
globals.udg_Talent__Event = 0.0

While the registering is still without the globals.
TriggerRegisterVariableEvent(gg_trg_Talent_MK_Event, "udg_Talent__Event", EQUAL, 1.00)
 

Wrda

Spell Reviewer
Level 23
Joined
Nov 18, 2012
Messages
1,731
Is necessary? Because what I said is the trigger variable event that all of us know is not working so its a general problem and not somethig specific, is like say "my program doesn't open" and you ask me to see it, just to see effectively isn't open.
It is a common procedure to check everything, even if it looks stupid or unnecessary. The reasons for your program not to open can be a variety of reasons, hence it is needed to try every option.
 
Level 20
Joined
Jun 26, 2020
Messages
1,586
In Lua the real Variable Event are in a table called globals. When you wana throw an event by seting the value. Then you have to to mention that globals.
like that;
Code:
globals.udg_Talent__Event = 0.0
globals.udg_Talent__Event = -1.0
globals.udg_Talent__Event = 0.0

While the registering is still without the globals.
TriggerRegisterVariableEvent(gg_trg_Talent_MK_Event, "udg_Talent__Event", EQUAL, 1.00)
I will try that, thanks.
It is a common procedure to check everything, even if it looks stupid or unnecessary. The reasons for your program not to open can be a variety of reasons, hence it is needed to try every option.
Ay.
 
Level 20
Joined
Jun 26, 2020
Messages
1,586
Now for some reason when I wanna update the system the function stops just right in the part of:
Lua:
globals.udg_BountyDeadEvent=0.00
globals.udg_BountyDeadEvent=1.00
globals.udg_BountyDeadEvent=0.00
Is this a bug of a recent patch or what?
 
Warcraft 3 Lua silently terminates the running code when an error is encountered during code execution: Invalid arguments in natives, nullpointers ... . Luckly there is also a feature to let Lua do something when an error happens, which is called xpcall. xpcall can be used to display the encountered error, sometimes in helpful manner: Lua Question
 
Level 20
Joined
Jun 26, 2020
Messages
1,586
The code you posted is located in a function. Find it. Now add xpcall(function() right below the function head as first action.
As last action you add end, print) before the end that finishes your function.
Like this?
Lua:
TriggerAddCondition(udg_Bounty_Controller,Condition(
    function xpcall(function()
            udg_BountyKillingUnit=GetKillingUnit()
            if not udg_BountyKillingUnit then --If there is not killing unit then the process stop
                return false
            end
         
            udg_BountyDyingUnit=GetDyingUnit()
            udg_Bounty=GetBountyFromUnitType(GetUnitTypeId(udg_BountyDyingUnit))
            if not udg_Bounty then udg_Bounty=0 end
         
            udg_BountyPlayer=GetOwningPlayer(udg_BountyKillingUnit)
            ForceAddPlayer(udg_BountyWhoSee,udg_BountyPlayer)
            udg_BountyUnitPos=udg_BountyDyingUnit
         
            udg_BountyDeadEvent=0.00
            udg_BountyDeadEvent=1.00
            udg_BountyDeadEvent=0.00
         
            if IsUnitEnemy(udg_BountyDyingUnit,udg_BountyPlayer) or udg_BountyAllowFriendFire then BountyText() end
         
            return false
end, print)))
 
The actions of a function start after () .

Lua:
TriggerAddCondition(udg_Bounty_Controller,Condition(
    function()
        xpcall(function()
            udg_BountyKillingUnit=GetKillingUnit()
            if not udg_BountyKillingUnit then --If there is not killing unit then the process stop
                return false
            end
          
            udg_BountyDyingUnit=GetDyingUnit()
            udg_Bounty=GetBountyFromUnitType(GetUnitTypeId(udg_BountyDyingUnit))
            if not udg_Bounty then udg_Bounty=0 end
          
            udg_BountyPlayer=GetOwningPlayer(udg_BountyKillingUnit)
            ForceAddPlayer(udg_BountyWhoSee,udg_BountyPlayer)
            udg_BountyUnitPos=udg_BountyDyingUnit
          
            udg_BountyDeadEvent=0.00
            udg_BountyDeadEvent=1.00
            udg_BountyDeadEvent=0.00
          
            if IsUnitEnemy(udg_BountyDyingUnit,udg_BountyPlayer) or udg_BountyAllowFriendFire then BountyText() end
          
            return false
        end, print)
end))

How do you write your Lua code? Your syntax checker should warn you about the code you posted.
I use Vscode together with Lua VSCode Integration
 
Level 20
Joined
Jun 26, 2020
Messages
1,586
The actions of a function start after () .

Lua:
TriggerAddCondition(udg_Bounty_Controller,Condition(
    function()
        xpcall(function()
            udg_BountyKillingUnit=GetKillingUnit()
            if not udg_BountyKillingUnit then --If there is not killing unit then the process stop
                return false
            end
         
            udg_BountyDyingUnit=GetDyingUnit()
            udg_Bounty=GetBountyFromUnitType(GetUnitTypeId(udg_BountyDyingUnit))
            if not udg_Bounty then udg_Bounty=0 end
         
            udg_BountyPlayer=GetOwningPlayer(udg_BountyKillingUnit)
            ForceAddPlayer(udg_BountyWhoSee,udg_BountyPlayer)
            udg_BountyUnitPos=udg_BountyDyingUnit
         
            udg_BountyDeadEvent=0.00
            udg_BountyDeadEvent=1.00
            udg_BountyDeadEvent=0.00
         
            if IsUnitEnemy(udg_BountyDyingUnit,udg_BountyPlayer) or udg_BountyAllowFriendFire then BountyText() end
         
            return false
        end, print)
end))

How do you write your Lua code? Your syntax checker should warn you about the code you posted.
I use Vscode together with Lua VSCode Integration
I also use VSCode, I just copy the code of the reply to save time, well, thank you.
 
Level 20
Joined
Jun 26, 2020
Messages
1,586
I tested and it displays this:
1622134614393.png

What I edited before was use a RegisterNativeEvent to create a function that register my events without creating a trigger, the thing if there is no a GUI trigger with that event the function InitGlobals doesn't do:
Lua:
globals.udg_BountyEvent = 0.0
globals.udg_BountyDeadEvent = 0.0
I think with adding this will solve the problem, but no:
Lua:
local oldGlobals=InitGlobals
function InitGlobals()
    oldGlobals()
    globals.udg_BountyDeadEvent=0.0
    globals.udg_BountyEvent=0.0
    Clear()
end
Even if I have GUI triggers with the event, the Lua triggers doesn't run (but without error message).
Can you tell me what's wrong? Here is my map:
 

Attachments

  • Bounty Controller Lua v1.1.w3x
    33.1 KB · Views: 7
It seems to me like one of your hooked Blizzard Inits breaks and with that also the function main (which contains/calls them).

Reason:
My custom GUI Trigger that displays something at 0s does not run.
After I added xpcall into your hook into InitGlobals it prints your text which describes some behavoiur of units.


You need to create (a) GUI Trigger(s) with both event variables then your map does not seem to encounter any error.
 
Level 20
Joined
Jun 26, 2020
Messages
1,586
Well, it worked (thanks Blizzard for make everything harder), but now have another problem, the generated units don't have a generated variable to reffer them but only if you have them in a GUI trigger (thank you again Blizzard), is there a way to do it manually?
 

Wrda

Spell Reviewer
Level 23
Joined
Nov 18, 2012
Messages
1,731
Well, it worked (thanks Blizzard for make everything harder), but now have another problem, the generated units don't have a generated variable to reffer them but only if you have them in a GUI trigger (thank you again Blizzard), is there a way to do it manually?
What I do is create a GUI trigger, no event, and then add some silly actions that affect units. e.g.: Unit - Kill someunit 0000 <gen>
Note that when referencing in custom text or script it will be gg_unit_rawcode_0000.
 
Level 20
Joined
Jun 26, 2020
Messages
1,586
What I do is create a GUI trigger, no event, and then add some silly actions that affect units. e.g.: Unit - Kill someunit 0000 <gen>
Note that when referencing in custom text or script it will be gg_unit_rawcode_0000.
I did that, basically is the "noob" way to solve the problem, but it could be tedious if my map have a lot things in it when is started.
 
Top