Library gives Critical Error

Lightstalker

New Member
Reaction score
55
For some reason, this library gives me a critical error when loading the map:

JASS:
library LibraryGlobals initializer Init

globals
    //DECLARE ARRAY VARIABLES
    unit array HEROSHOP
    unit array HEROSELECT
    unit array HERO
    unit array STATSUNIT
    unit array SKILLSTRAINER
    
    integer array STATSPOINTS
    integer array SKILLPOINTS
    integer array SPAWNRND
    
    string array PLAYERCOLORSTRING
    
    weathereffect array WEATHEREFFECT
    
    //SET NON-ARRAY VARIABLES
    integer HEROCONFIRM = 'A04C'
    integer STATSUP = 'A00N'
    integer STATSDIS = 'A00W'
    integer ARMORY = 'n004'
    integer MARKETPLACE = 'n006'
    integer ARMSCOUNT = 14
    integer TRINKETCOUNT = 12
    integer RNDINT = 0
    
    group TEMPGROUP = null
    
    force INCOMEFORCE = null
    force CPUFORCE = null
    
    rect MAPENTIRE = GetWorldBounds()
    rect MAPPLAYABLE = bj_mapInitialPlayableArea
endglobals

private function Actions takes nothing returns nothing
    //SET SPAWN_RND
    set SPAWNRND[0] = 'h000' //FOOTMAN
    set SPAWNRND[1] = 'n000' //ARCHER
    set SPAWNRND[2] = 'n003' //WIZARD
    set SPAWNRND[3] = 'o000' //CATAPULT
    set SPAWNRND[4] = 'h003' //KNIGHT
    set SPAWNRND[5] = 'h009' //RIFLEMAN
    set SPAWNRND[6] = 'h00A' //WAR MAGE
    set SPAWNRND[7] = 'h008' //MORTAR TEAM
    
    //SET HERO_SHOP
    set HEROSHOP[0] = gg_unit_n01H_0005
    set HEROSHOP[1] = gg_unit_n01I_0004
    set HEROSHOP[2] = gg_unit_n01J_0008
    set HEROSHOP[3] = gg_unit_n01G_0007
    set HEROSHOP[4] = gg_unit_n01E_0006
    set HEROSHOP[5] = gg_unit_n01F_0009
    set HEROSHOP[6] = gg_unit_n005_0001
    set HEROSHOP[7] = gg_unit_n00U_0002
    set HEROSHOP[8] = gg_unit_n00O_0010
    
    // SET WEATHER_EFFECT
    set WEATHEREFFECT[0] = AddWeatherEffect(MAPENTIRE, 'RLhr')
    set WEATHEREFFECT[1] = AddWeatherEffect(MAPENTIRE, 'RLlr')
    set WEATHEREFFECT[2] = AddWeatherEffect(MAPENTIRE, 'FDwh')
    set WEATHEREFFECT[3] = AddWeatherEffect(MAPENTIRE, 'SNhs')
    set WEATHEREFFECT[4] = AddWeatherEffect(MAPENTIRE, 'Snls')
    
    //SET CPU_FORCE
    call ForceAddPlayer(CPUFORCE, Player(5))
    call ForceAddPlayer(CPUFORCE, Player(11))
    
    //SET PLAYER_COLORSTRING
    set PLAYERCOLORSTRING[0] = "|cffff0000"
    set PLAYERCOLORSTRING[1] = "|cff0000ff"
    set PLAYERCOLORSTRING[2] = "|cff18e7bd"
    set PLAYERCOLORSTRING[3] = "|cff520084"
    set PLAYERCOLORSTRING[4] = "|cffffff00"
    set PLAYERCOLORSTRING[5] = "|cfffe8a0e"
    set PLAYERCOLORSTRING[6] = "|cff18be00"
    set PLAYERCOLORSTRING[7] = "|cffe759ad"
    set PLAYERCOLORSTRING[8] = "|cff949694"
    set PLAYERCOLORSTRING[9] = "|cff7bbef7"
    set PLAYERCOLORSTRING[10] = "|cff0F6145"
    set PLAYERCOLORSTRING[11] = "|cff4D2903"
    
    //TO FIX SOON!
    // Setting Ability Variables...
    // Setting Last Kill Variables...
    set udg_LastKill_Bonus[1] = 'A03U'
    set udg_LastKill_Bonus[2] = 'A03V'
    set udg_LastKill_Bonus[3] = 'A03Y'
    set udg_LastKill_Bonus[4] = 'A03W'
    set udg_LastKill_Bonus[5] = 'A03Z'
    set udg_LastKill_Bonus[6] = 'A01B'
    set udg_LastKill_Bonus[7] = 'A01U'
    set udg_LastKill_Bonus[8] = 'A01Y'
    set udg_LastKill_Bonus[9] = 'A03X'
    set udg_LastKill_Bonus[10] = 'A040'
    
    call DestroyTrigger(GetTriggeringTrigger())
endfunction

private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerAddAction(t, function Actions)
    set t = null
endfunction
endlibrary
 

GetTriggerUnit-

DogEntrepreneur
Reaction score
129
Don't know how to explain, really. Libraries do not require events. Thats why you can call the function they contain in any trigger.

What I think cause it, is the
JASS:

private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerAddAction(t, function Actions)
    set t = null
endfunction


Remove that, keep the rest. In fact, since you do not call the function anywhere, I'd suggest you to use a normal trigger and set "run at map initialization" - Also having a private function is useless since libraries are for custom functions. If you want to call it, do not put private or public.

Only constants need CAPS LETTERS. Remove these caps, it sounds agessive! :p
 

saw792

Is known to say things. That is all.
Reaction score
280
Ignore what Blitz said.
JASS:


Set those two in your actions function, some natives should not be called when setting a global on declaration. Also, bj_mapInitialPlayableArea isn't set until after the initialization functions have run, so this will return null/cause problems from uninitialized variables.
JASS:
private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerAddAction(t, function Actions)
    set t = null
endfunction

This has no event, and running it on map initialization does not execute local triggers. Just remove all that and rename the Actions function to Init so it will run on initialization.
 

Zaraf

New Member
Reaction score
22
Here, this should work:

JASS:
library LibraryGlobals initializer Init

        globals
            //DECLARE ARRAY VARIABLES
            unit    array HEROSHOP
            unit    array HEROSELECT
            unit    array HERO
            unit    array STATSUNIT
            unit    array SKILLSTRAINER
            
            integer array STATSPOINTS
            integer array SKILLPOINTS
            integer array SPAWNRND
            integer array LAST_KILL_BONUS
            
            string  array PLAYERCOLORSTRING
            
            weathereffect array WEATHEREFFECT
            
            //SET NON-ARRAY VARIABLES
            integer HEROCONFIRM  = 'A04C'
            integer STATSUP      = 'A00N'
            integer STATSDIS     = 'A00W'
            integer ARMORY       = 'n004'
            integer MARKETPLACE  = 'n006'
            integer ARMSCOUNT    = 14
            integer TRINKETCOUNT = 12
            integer RNDINT       = 0
            
            group TEMPGROUP      = null
            
            force INCOMEFORCE    = null
            force CPUFORCE       = null
            
            rect MAPENTIRE       = null
            rect MAPPLAYABLE     = null
        endglobals

    private function Init takes nothing returns nothing
        
        set MAPENTIRE   = GetWorldBounds()
        set MAPPLAYABLE = bj_mapInitialPlayableArea
        //SET SPAWN_RND
        set SPAWNRND[0] = 'h000' //FOOTMAN
        set SPAWNRND[1] = 'n000' //ARCHER
        set SPAWNRND[2] = 'n003' //WIZARD
        set SPAWNRND[3] = 'o000' //CATAPULT
        set SPAWNRND[4] = 'h003' //KNIGHT
        set SPAWNRND[5] = 'h009' //RIFLEMAN
        set SPAWNRND[6] = 'h00A' //WAR MAGE
        set SPAWNRND[7] = 'h008' //MORTAR TEAM
        
        //SET HERO_SHOP
        set HEROSHOP[0] = gg_unit_n01H_0005
        set HEROSHOP[1] = gg_unit_n01I_0004
        set HEROSHOP[2] = gg_unit_n01J_0008
        set HEROSHOP[3] = gg_unit_n01G_0007
        set HEROSHOP[4] = gg_unit_n01E_0006
        set HEROSHOP[5] = gg_unit_n01F_0009
        set HEROSHOP[6] = gg_unit_n005_0001
        set HEROSHOP[7] = gg_unit_n00U_0002
        set HEROSHOP[8] = gg_unit_n00O_0010
        
        // SET WEATHER_EFFECT
        set WEATHEREFFECT[0] = AddWeatherEffect(MAPENTIRE, 'RLhr')
        set WEATHEREFFECT[1] = AddWeatherEffect(MAPENTIRE, 'RLlr')
        set WEATHEREFFECT[2] = AddWeatherEffect(MAPENTIRE, 'FDwh')
        set WEATHEREFFECT[3] = AddWeatherEffect(MAPENTIRE, 'SNhs')
        set WEATHEREFFECT[4] = AddWeatherEffect(MAPENTIRE, 'Snls')
        
        //SET CPU_FORCE
        call ForceAddPlayer(CPUFORCE, Player(5))
        call ForceAddPlayer(CPUFORCE, Player(11))
        
        //SET PLAYER_COLORSTRING
        set PLAYERCOLORSTRING[0]  = "|cffff0000"
        set PLAYERCOLORSTRING[1]  = "|cff0000ff"
        set PLAYERCOLORSTRING[2]  = "|cff18e7bd"
        set PLAYERCOLORSTRING[3]  = "|cff520084"
        set PLAYERCOLORSTRING[4]  = "|cffffff00"
        set PLAYERCOLORSTRING[5]  = "|cfffe8a0e"
        set PLAYERCOLORSTRING[6]  = "|cff18be00"
        set PLAYERCOLORSTRING[7]  = "|cffe759ad"
        set PLAYERCOLORSTRING[8]  = "|cff949694"
        set PLAYERCOLORSTRING[9]  = "|cff7bbef7"
        set PLAYERCOLORSTRING[10] = "|cff0F6145"
        set PLAYERCOLORSTRING[11] = "|cff4D2903"
        
        //TO FIX SOON!
        // Setting Ability Variables...
        // Setting Last Kill Variables...
        set LAST_KILL_BONUS[1]  = 'A03U'
        set LAST_KILL_BONUS[2]  = 'A03V'
        set LAST_KILL_BONUS[3]  = 'A03Y'
        set LAST_KILL_BONUS[4]  = 'A03W'
        set LAST_KILL_BONUS[5]  = 'A03Z'
        set LAST_KILL_BONUS[6]  = 'A01B'
        set LAST_KILL_BONUS[7]  = 'A01U'
        set LAST_KILL_BONUS[8]  = 'A01Y'
        set LAST_KILL_BONUS[9]  = 'A03X'
        set LAST_KILL_BONUS[10] = 'A040'
        
    endfunction

endlibrary


Instead of having an action function, just have all of the variable setting done in the Init function. Also, instead of using a GUI variable for your Last Kill Bonus, you should make an integer array in your global block and use it. Of course, if you're still using the udg_Last_Kill_Bonus GUI variable in GUI triggers still, then use it, but you should aim to phase out the usage and eventually stick to only vJass globals.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      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