Trigger causing server splits

Cal1991

New Member
Reaction score
7
Some people server split when this trigger runs. Anyone know why?
JASS:

function Trig_Creep_Spawn_Jass_Func002Func001002002 takes nothing returns boolean
    return ( IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction

function Trig_Creep_Spawn_Jass_Func002Func002C takes nothing returns boolean
    if ( not ( IsUnitGroupEmptyBJ(udg_Group) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Creep_Spawn_Jass_Actions takes nothing returns nothing
    local integer a = 1
    local integer b = 18
    local integer c = 1
    local integer d = 18
    call AddItemToStockBJ( ChooseRandomItemExBJ(GetRandomInt(4, 8), ITEM_TYPE_ANY), gg_unit_nmrk_0017, 1, 1 )
    loop
        exitwhen a > b
        set udg_Group = GetUnitsInRectMatching(udg_CreepLocs[a], Condition(function Trig_Creep_Spawn_Jass_Func002Func001002002))
        if ( Trig_Creep_Spawn_Jass_Func002Func002C() ) then
            set udg_Point[1] = GetRectCenter(udg_CreepLocs[a])
            set c = udg_CreepAmountMin[a]
            set d = udg_CreepAmountMax[a]
            loop
                exitwhen c > d
                call CreateNUnitsAtLoc( 1, ChooseRandomCreepBJ(GetRandomInt(udg_CreepLevelMin[a], udg_CreepLevelMax[a])), Player(PLAYER_NEUTRAL_AGGRESSIVE), udg_Point[1], bj_UNIT_FACING )
                call UnitAddAbilityBJ( 'Asla', GetLastCreatedUnit() )
                call PolledWait( 1 )
                set c = c + 1
            endloop
            set udg_CreepAmountMax[a] = ( udg_CreepAmountMax[a] + 1 )
            set udg_CreepAmountMin[a] = ( udg_CreepAmountMin[a] + 1 )
            set udg_CreepLevelMax[a] = ( udg_CreepLevelMax[a] + 1 )
            call RemoveLocation(udg_Point[1])
        else
            call DoNothing(  )
        endif
        call DestroyGroup(udg_Group)
        set a = a + 1
    endloop
endfunction

//===========================================================================
function InitTrig_Creep_Spawn_Jass takes nothing returns nothing
    set gg_trg_Creep_Spawn_Jass = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Creep_Spawn_Jass, 30.00 )
    call TriggerAddAction( gg_trg_Creep_Spawn_Jass, function Trig_Creep_Spawn_Jass_Actions )
endfunction
 

Builder Bob

Live free or don't
Reaction score
249
It looks as if the time you set the global location variable udg_Point[1] and remove it's location is on each their side of a PolledWait().

I don't know if that can cause the server split, but I do know that if multiple instances of this trigger are run on the same time, then the location can be removed in one trigger after it was set in another, but before it was used. Leading to a situation where you try to use a location that does not exist.

Try using a local location variable instead

Edit: same thing with your group variable
 

Cal1991

New Member
Reaction score
7
It looks as if the time you set the global location variable udg_Point[1] and remove it's location is on each their side of a PolledWait().

I don't know if that can cause the server split, but I do know that if multiple instances of this trigger are run on the same time, then the location can be removed in one trigger after it was set in another, but before it was used. Leading to a situation where you try to use a location that does not exist.

Try using a local location variable instead

Edit: same thing with your group variable

Hmm, that is a good point, but it split before I added the wait, I added the wait in attempt to make it easier on slow comps in case it was splitting for that reason. I'll try locals and see how it goes, though. Thanks.
 

Builder Bob

Live free or don't
Reaction score
249
If the wait isn't causing the splits, then my only other idea is that it can be something in one of the BJ functions that is causing it. They often do stuff that is unneeded.

JASS:
function Trig_Creep_Spawn_Filter takes nothing returns boolean
	return GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0
endfunction

function Trig_Creep_Spawn_Jass_Actions takes nothing returns nothing
	local unit u
	local group g
	local real x
	local real y
	local integer a = 1
	local integer b = 18
	local integer c = 1
	local integer d = 18
	call AddItemToStock(gg_unit_nmrk_0017, ChooseRandomItemEx(ITEM_TYPE_ANY, GetRandomInt(4, 8)), 1, 1)
	loop
		exitwhen a > b
		set g = CreateGroup()
		call GroupEnumUnitsInRect(g, udg_CreepLocs[a], Condition(function Trig_Creep_Spawn_Filter))
		if FirstOfGroup(g) == null then //I don't know if it's the best way to check for an empty group, but at least it works and is short
			set x = GetRectCenterX(udg_CreepLocs[a])
			set y = GetRectCenterY(udg_CreepLocs[a])
			set c = udg_CreepAmountMin[a]
			set d = udg_CreepAmountMax[a]
			loop
				exitwhen c > d
				set u = CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE), ChooseRandomCreep(GetRandomInt(udg_CreepLevelMin[a], udg_CreepLevelMax[a])), x, y, bj_UNIT_FACING)
				call UnitAddAbility(u, 'Asla')
				call PolledWait(1) //it's up to you if you want to keep the polled wait or not
				set c = c + 1
			endloop
			set udg_CreepAmountMax[a] = udg_CreepAmountMax[a] + 1
			set udg_CreepAmountMin[a] = udg_CreepAmountMin[a] + 1
			set udg_CreepLevelMax[a] = udg_CreepLevelMax[a] + 1
		endif
		call DestroyGroup(g)
		set a = a + 1
	endloop
	set u = null
	set g = null
endfunction

//===========================================================================
function InitTrig_Creep_Spawn_Jass takes nothing returns nothing
	set gg_trg_Creep_Spawn_Jass = CreateTrigger()
	call TriggerRegisterTimerEvent(gg_trg_Creep_Spawn_Jass, 30.00, true)
	call TriggerAddAction(gg_trg_Creep_Spawn_Jass, function Trig_Creep_Spawn_Jass_Actions)
endfunction


I took the liberty to replace the BJ functions with natives. There might be some mistakes as I weren't able to check the syntax due to lack of variables.
 

Cal1991

New Member
Reaction score
7
If the wait isn't causing the splits, then my only other idea is that it can be something in one of the BJ functions that is causing it. They often do stuff that is unneeded.

I took the liberty to replace the BJ functions with natives. There might be some mistakes as I weren't able to check the syntax due to lack of variables.

Well, thanks for going through the work to change the BJs.

The syntax was fine, but it's still splitting just as badly as before. (I copy+pasted your code so I know I didn't mess it up)

Also, I know it is not my host because I regularly host DotA/ladder/other maps of mine with no splits.

+rep cause I appreciate your attempts to help but it's still not working. Maybe adding an item to marketplace can cause a split? Because thats also in the trigger.
 

Builder Bob

Live free or don't
Reaction score
249
Well, then I have no idea what may be causing it.

Appreciate the rep. I'm sorry, I couldn't help you get to the bottom of the problem.

Maybe someone else want to take a crack at it. It would be interesting to know what the cause it.
 

Technomancer

New Member
Reaction score
14
This could be a hell of a tester :/ best bet is to /w the guys that regularly split and break the code up into parts and have them test, to see what is causing it.

I looked it through, didn't see anything, but can I see the full map?
 

Arkan

Nobody rides for free
Reaction score
92
Does it work as intended if you try it in single player? Try putting up a few debug messages in the code to narrow down the line that causes a split, can't see it now...
 

Builder Bob

Live free or don't
Reaction score
249
hmm... one final thought.

you set these variables right before the unit creating loop.
Code:
set c = udg_CreepAmountMin[a]
set d = udg_CreepAmountMax[a]

right after the loop you add one to both of these variables that later turn into c and d again.
Code:
set udg_CreepAmountMax[a] = udg_CreepAmountMax[a] + 1
set udg_CreepAmountMin[a] = udg_CreepAmountMin[a] + 1

the unit creating loop goes from c to d, so adding 1 to both changes nothing. I was wondering, does these variables get changed in other triggers?

udg_CreepLevelMax[a] also seem to get increased a lot. Could making a too high lvl creep cause any anomalies?

I don't see why any of those things would cause splits however, just thought it didn't make much sense unless some other trigger has something to do with the same variables.

Arkan has a good point by the way, check all the variables with debug messages to see if they are what you want them to be.
 

Cal1991

New Member
Reaction score
7
Does it work as intended if you try it in single player?
Yeah, sometimes it even works fine in multi-player, but usually someone splits.


I looked it through, didn't see anything, but can I see the full map?

Sure, attached is the map.

you set these variables right before the unit creating loop.
Code:
set c = udg_CreepAmountMin[a]
set d = udg_CreepAmountMax[a]

right after the loop you add one to both of these variables that later turn into c and d again.
Code:
set udg_CreepAmountMax[a] = udg_CreepAmountMax[a] + 1
set udg_CreepAmountMin[a] = udg_CreepAmountMin[a] + 1

the unit creating loop goes from c to d, so adding 1 to both changes nothing.
Thanks for pointing that out, originally I was going to make more creeps spawn as the game went along but decided not to. I guess I should just delete that bit now.

I was wondering, does these variables get changed in other triggers?
No.
udg_CreepLevelMax[a] also seem to get increased a lot. Could making a too high lvl creep cause any anomalies?
Unlikely, but it might be possible I guess. But that can't be the cuase of the current problem becuase it splits the first time creeps spawn, and the max creep level is 2 for the first spawn, 3 for the second, ect.
Try putting up a few debug messages in the code to narrow down the line that causes a split, can't see it now...
Arkan has a good point by the way, check all the variables with debug messages to see if they are what you want them to be.
I suppose so. Since the trigger works perfectly with the exception of splitting a few people the first time it runs, I doubt they are anything other than what they ought to be. And I'm not 100% sure it always splits at same place.

But yeah thats just about the only option I have now, so I'll do that.
 
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

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top