'Nothing' Function

_whelp

New Member
Reaction score
54
When I test this function it does nothing.
How do I fix it?
JASS:

function init_CreateUnitsForPlayers takes nothing returns nothing
    local rect array spawn
    local destructable array cage 
    local integer a = 0
    local integer b = 0
    local integer c = 0
    local real array angle
    local real array cagex
    local real array cagey
    local real x
    local real y
    
    loop
        exitwhen a == bj_MAX_PLAYER_SLOTS
        if(a == 0) then
            set spawn[a] = gg_rct_PlayerSpawnRegion1
        elseif(a == 1) then
            set spawn[a] = gg_rct_PlayerSpawnRegion2
        endif
        if(a == 2) then
            set spawn[a] = gg_rct_PlayerSpawnRegion3
        elseif(a == 3) then 
            set spawn[a] = gg_rct_PlayerSpawnRegion4
        endif
        if(a == 4) then 
            set spawn[a] = gg_rct_PlayerSpawnRegion5
        elseif(a == 1) then
            set spawn[a] = gg_rct_PlayerSpawnRegion6
        endif
        set a = a + 1
    endloop
    
    loop
        exitwhen b == bj_MAX_PLAYER_SLOTS
        set x = GetRectCenterX(spawn<b>)
        set y = GetRectCenterY(spawn<b>)
        loop
            exitwhen c == bj_MAX_PLAYER_SLOTS
            if(c == 0) then
                set cagex[c] = GetDestructableX(gg_dest_LOcg_0008)
                set cagey[c] = GetDestructableY(gg_dest_LOcg_0008)
            elseif(c == 1) then
                set cagex[c] = GetDestructableX(gg_dest_LOcg_0008)
                set cagey[c] = GetDestructableY(gg_dest_LOcg_0008)
            endif
            if(c == 2) then
                set cagex[c] = GetDestructableX(gg_dest_LOcg_0009)
                set cagey[c] = GetDestructableY(gg_dest_LOcg_0009)
            elseif(c == 3) then
                set cagex[c] = GetDestructableX(gg_dest_LOcg_0009)
                set cagey[c] = GetDestructableY(gg_dest_LOcg_0009)
            endif
            if(c == 4) then
                set cagex[c] = GetDestructableX(gg_dest_LOcg_0010)
                set cagey[c] = GetDestructableY(gg_dest_LOcg_0010)
            elseif(c == 5) then
                set cagex[c] = GetDestructableX(gg_dest_LOcg_0010)
                set cagey[c] = GetDestructableY(gg_dest_LOcg_0010)
            endif
        endloop
        set angle<b> = bj_RADTODEG * Atan2(cagey<b> - y, cagex<b> - x)      
        call CreateUnit(Player(b), &#039;h000&#039;, x, y, angle<b>)
        set b = b + 1
    endloop
    loop
        exitwhen a == 0
        if(a != bj_MAX_PLAYER_SLOTS) then
            set b = 0
            set c = 0
            set cage[a] = null
            set angle[a] = 0
            set cagex[a] = 0
            set cagey[a] = 0
            set x = 0
            set y = 0
            set spawn[a] = null
        endif
        set a = a - 1
    endloop
endfunction
</b></b></b></b></b></b>
 

Vestras

Retired
Reaction score
249
Is that the whole trigger? Maybe try naming the function InitTrig_blahblah where blahblah is your trigger name.
 

_whelp

New Member
Reaction score
54
here you go...
Trigger:
  • Init
    • Events
      • Time - Elapsed game time is 0.20 seconds
    • Conditions
    • Actions
      • Custom script: call init_CreateUnitsForPlayers()
 

Azlier

Old World Ghost
Reaction score
461
JASS:
loop
            exitwhen c == bj_MAX_PLAYER_SLOTS
            if(c == 0) then
                set cagex[c] = GetDestructableX(gg_dest_LOcg_0008)
                set cagey[c] = GetDestructableY(gg_dest_LOcg_0008)
            elseif(c == 1) then
                set cagex[c] = GetDestructableX(gg_dest_LOcg_0008)
                set cagey[c] = GetDestructableY(gg_dest_LOcg_0008)
            endif
            if(c == 2) then
                set cagex[c] = GetDestructableX(gg_dest_LOcg_0009)
                set cagey[c] = GetDestructableY(gg_dest_LOcg_0009)
            elseif(c == 3) then
                set cagex[c] = GetDestructableX(gg_dest_LOcg_0009)
                set cagey[c] = GetDestructableY(gg_dest_LOcg_0009)
            endif
            if(c == 4) then
                set cagex[c] = GetDestructableX(gg_dest_LOcg_0010)
                set cagey[c] = GetDestructableY(gg_dest_LOcg_0010)
            elseif(c == 5) then
                set cagex[c] = GetDestructableX(gg_dest_LOcg_0010)
                set cagey[c] = GetDestructableY(gg_dest_LOcg_0010)
            endif
            //And you are increasing c by one... where?
        endloop
 

chobibo

Level 1 Crypt Lord
Reaction score
48
JASS:
loop
            exitwhen c == bj_MAX_PLAYER_SLOTS
            if(c == 0) then
                set cagex[c] = GetDestructableX(gg_dest_LOcg_0008)
                set cagey[c] = GetDestructableY(gg_dest_LOcg_0008)
            elseif(c == 1) then
                set cagex[c] = GetDestructableX(gg_dest_LOcg_0008)
                set cagey[c] = GetDestructableY(gg_dest_LOcg_0008)
            endif
            if(c == 2) then
                set cagex[c] = GetDestructableX(gg_dest_LOcg_0009)
                set cagey[c] = GetDestructableY(gg_dest_LOcg_0009)
            elseif(c == 3) then
                set cagex[c] = GetDestructableX(gg_dest_LOcg_0009)
                set cagey[c] = GetDestructableY(gg_dest_LOcg_0009)
            endif
            if(c == 4) then
                set cagex[c] = GetDestructableX(gg_dest_LOcg_0010)
                set cagey[c] = GetDestructableY(gg_dest_LOcg_0010)
            elseif(c == 5) then
                set cagex[c] = GetDestructableX(gg_dest_LOcg_0010)
                set cagey[c] = GetDestructableY(gg_dest_LOcg_0010)
            endif
            //And you are increasing c by one... where?
            set c=c+1
        endloop
 

_whelp

New Member
Reaction score
54
JASS:
loop
            exitwhen c == bj_MAX_PLAYER_SLOTS
            if(c == 0) then
                set cagex[c] = GetDestructableX(gg_dest_LOcg_0008)
                set cagey[c] = GetDestructableY(gg_dest_LOcg_0008)
            elseif(c == 1) then
                set cagex[c] = GetDestructableX(gg_dest_LOcg_0008)
                set cagey[c] = GetDestructableY(gg_dest_LOcg_0008)
            endif
            if(c == 2) then
                set cagex[c] = GetDestructableX(gg_dest_LOcg_0009)
                set cagey[c] = GetDestructableY(gg_dest_LOcg_0009)
            elseif(c == 3) then
                set cagex[c] = GetDestructableX(gg_dest_LOcg_0009)
                set cagey[c] = GetDestructableY(gg_dest_LOcg_0009)
            endif
            if(c == 4) then
                set cagex[c] = GetDestructableX(gg_dest_LOcg_0010)
                set cagey[c] = GetDestructableY(gg_dest_LOcg_0010)
            elseif(c == 5) then
                set cagex[c] = GetDestructableX(gg_dest_LOcg_0010)
                set cagey[c] = GetDestructableY(gg_dest_LOcg_0010)
            endif
            //And you are increasing c by one... where?
            set c=c+1
        endloop

thats what i did and it still had no effect

And if I syntax check it in JassNewgen or whatever, it says gg_dest_LOcg_0010 and the others aren't variables or something...
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
Your methods are.... interesting. Try going through and optimizing your code a little bit.

Just a quick look:

JASS:
    loop
        exitwhen a == bj_MAX_PLAYER_SLOTS
        if(a == 0) then
            set spawn[a] = gg_rct_PlayerSpawnRegion1
        elseif(a == 1) then
            set spawn[a] = gg_rct_PlayerSpawnRegion2
        endif
        if(a == 2) then
            set spawn[a] = gg_rct_PlayerSpawnRegion3
        elseif(a == 3) then 
            set spawn[a] = gg_rct_PlayerSpawnRegion4
        endif
        if(a == 4) then 
            set spawn[a] = gg_rct_PlayerSpawnRegion5
        elseif(a == 1) then // Shouldn&#039;t this be 5?
            set spawn[a] = gg_rct_PlayerSpawnRegion6
        endif
        set a = a + 1
    endloop


Can be made simpler by doing this:

JASS:
set spawn[0] = gg_rct_PlayerSpawnRegion1
set spawn[1] = gg_rct_PlayerSpawnRegion2
set spawn[2] = gg_rct_PlayerSpawnRegion3
set spawn[3] = gg_rct_PlayerSpawnRegion4
set spawn[4] = gg_rct_PlayerSpawnRegion5
set spawn[1] = gg_rct_PlayerSpawnRegion6


What you put just makes it harder to read, slower, and confusing.
 

_whelp

New Member
Reaction score
54
Okay, but when I test the map, WE gives me the 'Expected a name' error for these lines.
JASS:

set cagex[1] = GetDestructableX(gg_dest_LOcg_0008)
set cagey[2] = GetDestructableY(gg_dest_LOcg_0008)
set cagex[3] = GetDestructableX(gg_dest_LOcg_0009)
set cagey[4] = GetDestructableY(gg_dest_LOcg_0009)            
set cagex[5] = GetDestructableX(gg_dest_LOcg_0010)
set cagey[6] = GetDestructableY(gg_dest_LOcg_0010)


(I changed some of the code... in this part...)
JASS:

loop
    exitwhen c == bj_MAX_PLAYER_SLOTS
    if(c == 0) then
        set cagex[c] = GetDestructableX(gg_dest_LOcg_0008)
        set cagey[c] = GetDestructableY(gg_dest_LOcg_0008)
    elseif(c == 1) then
        set cagex[c] = GetDestructableX(gg_dest_LOcg_0008)
        set cagey[c] = GetDestructableY(gg_dest_LOcg_0008)
    endif
    if(c == 2) then
        set cagex[c] = GetDestructableX(gg_dest_LOcg_0009)
        set cagey[c] = GetDestructableY(gg_dest_LOcg_0009)
    elseif(c == 3) then
        set cagex[c] = GetDestructableX(gg_dest_LOcg_0009)
        set cagey[c] = GetDestructableY(gg_dest_LOcg_0009)
    endif
    if(c == 4) then
        set cagex[c] = GetDestructableX(gg_dest_LOcg_0010)
        set cagey[c] = GetDestructableY(gg_dest_LOcg_0010)
    elseif(c == 5) then
        set cagex[c] = GetDestructableX(gg_dest_LOcg_0010)
        set cagey[c] = GetDestructableY(gg_dest_LOcg_0010)
    endif
    set c = c + 1
endloop
 

Frozenhelfir

set Gwypaas = Guhveepaws
Reaction score
56
Try this. You need jass newgen...

JASS:
scope CreateUnitsForPlayers initializer init

private function Act takes nothing returns nothing
    local rect array spawn
    local destructable array cage 
    local integer a = 0
    local integer b = 0
    local integer c = 0
    local real array angle
    local real array cagex
    local real array cagey
    local real x
    local real y
    
    set spawn[0] = gg_rct_PlayerSpawnRegion1
    set spawn[1] = gg_rct_PlayerSpawnRegion2
    set spawn[2] = gg_rct_PlayerSpawnRegion3
    set spawn[3] = gg_rct_PlayerSpawnRegion4
    set spawn[4] = gg_rct_PlayerSpawnRegion5
    set spawn[5] = gg_rct_PlayerSpawnRegion6

    set cagex[0] = GetDestructableX(gg_dest_LOcg_0008)
    set cagey[0] = GetDestructableY(gg_dest_LOcg_0008)
    set cagex[1] = GetDestructableX(gg_dest_LOcg_0008)
    set cagey[1] = GetDestructableY(gg_dest_LOcg_0008)
    set cagex[2] = GetDestructableX(gg_dest_LOcg_0009)
    set cagey[2] = GetDestructableY(gg_dest_LOcg_0009)
    set cagex[3] = GetDestructableX(gg_dest_LOcg_0009)
    set cagey[3] = GetDestructableY(gg_dest_LOcg_0009)
    set cagex[4] = GetDestructableX(gg_dest_LOcg_0010)
    set cagey[4] = GetDestructableY(gg_dest_LOcg_0010)
    set cagex[5] = GetDestructableX(gg_dest_LOcg_0010)
    set cagey[5] = GetDestructableY(gg_dest_LOcg_0010)
    
    call BJDebugMsg(&quot;Spawn loop reached&quot;)
    loop
        set x = GetRectCenterX(spawn<b>)
        set y = GetRectCenterY(spawn<b>)
        set angle<b> = bj_RADTODEG * Atan2(cagey<b> - y, cagex<b> - x)      
        call CreateUnit(Player(b), &#039;h000&#039;, x, y, angle<b>)
        call BJDebugMsg(&quot;Unit spawned&quot;)
        exitwhen b &gt;= bj_MAX_PLAYER_SLOTS
        set b = b + 1
    endloop
    
    loop
        exitwhen a == 0
        if(a != bj_MAX_PLAYER_SLOTS) then
            set b = 0
            set c = 0
            set cage[a] = null
            set angle[a] = 0
            set cagex[a] = 0
            set cagey[a] = 0
            set x = 0
            set y = 0
            set spawn[a] = null
        endif
        set a = a - 1
    endloop
endfunction

private function init takes nothing returns nothing
local trigger t = CreateTrigger()
    call TriggerRegisterTimerEvent(t,0.20,false)
    call TriggerAddAction(t,function Act)
set t = null
endfunction
endscope</b></b></b></b></b></b>
 

_whelp

New Member
Reaction score
54
Damn it... everything I tried doesn't seem to work. :( WE keeps giving me crappy and annoying errors. Errr......
 

Ryuu

I am back with Chocolate (:
Reaction score
64
You might consider rewriting the code.
It's a little messy and .. (to me, at least) unreadable.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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 The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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