I have this custom Horde Mode script that spawns in monsters but during testing, in the later waves (Around 1 to 2 hours in) it crashes with the message "Division by Zero". I went on the TSPG discord server (as that's where I hosted the server), asked around, and just got that all the crashes happened during the monster spawning wave and that I should check the thing inside the waves, but after doing so, I have no clue of what can be causing such an error, so I came here for help
So if anybody wants to help me, it would be greatly appreciated
The main Script responsible for wave control and text display
and Here is the function where the monsters spawn, and give cash to the killer
So if anybody wants to help me, it would be greatly appreciated
The main Script responsible for wave control and text display
Code:
ACS_NamedExecute("HD_SpawningFunction",0);Until(EnemyCounter == 0) //wait untill zero{delay(1);SetFont("BIGFONT");SetHudSize(520, 400,0);HudMessage(s:"Wave ", i:waves , s:": " , i:EnemyCounter, s:" Demons Left!" ; HUDMSG_PLAIN, 0, CR_GOLD, 260.4, 80.4, 0.1);If(DerailerBools[2] == TRUE) //Derailers appear in late-game waves, but the game crashed even before them so they are not the issue, plus they work fine{if(HALFLIFEDERAILERRANDOMPOINT == EnemyCounter){For(int n = 0; n < 16; n++) //goes through all the players, I though this could be an issue, but the game crashes even when this is FLASE{SetActorProperty(1000+n,APROP_Health,GetActorProperty(1000+n,APROP_Health)/2);FadeTo(0.1,0.0,0.0,0.5,0.0);FadeTo(0.1,0.0,0.0,0.0,2.0);HALFLIFEDERAILERRANDOMPOINT = -1;}SectorSound("derailer/powerdown",1.0);}}If(DerailerBools[0] == TRUE) //Same deal as before{if(HALFLIFEDERAILERRANDOMPOINT == EnemyCounter){For(int m = 0; m < 16; m++){TakeActorInventory(1000+m,"Clip",CheckActorInventory(1000+m,"Clip") / 2);TakeActorInventory(1000+m,"Shell",CheckActorInventory(1000+m,"Shell") / 2);TakeActorInventory(1000+m,"RocketAmmo",CheckActorInventory(1000+m,"RocketAmmo") / 2);TakeActorInventory(1000+m,"Cell",CheckActorInventory(1000+m,"Cell") / 2);TakeActorInventory(1000+m,"RocketFuel",CheckActorInventory(1000+m,"RocketFuel") / 2);TakeActorInventory(1000+m,"Skulls",CheckActorInventory(1000+m,"Skulls") / 2);}FadeTo(0.1,0.0,0.0,0.5,0.0);FadeTo(0.1,0.0,0.0,0.0,2.0);HALFLIFEDERAILERRANDOMPOINT = -1;}SectorSound("derailer/powerdown",1.0);}if(AmountOfDeadlayers == PlayerCount()){GameOver = TRUE;}}Thing_Remove(600); //Remove MonstersACS_NamedTerminate("HD_SpawningFunction",0); //Make sure the function is goneBreak;
Code:
Script "HD_SpawningFunction" (VOID){If(Waves < 30){Delay((70 + Random(0,15)) - Waves);}else{Delay((70 + Random(1,3)) - Waves);}if(EnemyCounter != ThingCount(T_NONE,600) && ThingCount(T_NONE,600) < PrevEnemyCount) //Function spawn the exact amounts of monsters needed for the wave, calculated before hand{int spot = random(100,111);If(SpawnSpotFacing(Monster_List[random(MonsterMinTier,MonsterTier)],spot,600)) //Check if a monster is spawnable in tat place (this is what I suspect could be causing it){SpawnSpotFacing("TeleportFog",spot,0);SetThingSpecial(600,80,90,0,GetActorProperty(0,APROP_SpawnHealth),0,0); //Suplies their kill script with their healthIf(DerailerBools[1] == TRUE){SetActorProperty(600,APROP_Reactiontime,0); //Again, game crashes before this is even activated plus it works fine}If(DerailerBools[6] == TRUE){Thing_Hate(600,StatuePlayerTID,2); //Again, game crashes before this is even activated plus it works fine}if(EnemyCurrentCounter < ThingCount(T_NONE,600)){EnemyCurrentCounter++;}else if(EnemyCurrentCounter > ThingCount(T_NONE,600)){EnemyCurrentCounter = ThingCount(T_NONE,600);}}}If(EnemyCurrentCounter == PrevEnemyCount){Suspend;}Restart;}Script 90 (int MonsterHealth){EnemyCounter--;For(int i = 0;i < 16;i++){GiveActorInventory(1000+i,"HordeMode_Points",(MonsterHealth + 10 + Waves * GameSkill() * 5 + Random(0,32)) - PlayerCount() * 2); //Maybe, but then again, no division plus nothing came up when tested}}[\code]if anybody can help, it would be much appreciated, thanks in advance
Statistics: Posted by Korni27 — Tue Feb 18, 2025 3:35 pm