ID:139806
 
Code:
        while(players) //If players are still in game
if(!players) // If all players are eliminated
Game_Over() //Game Over

Game_Over(var/mob/M in world) //Game Over
M << "YOUR TEAM HAS FALLEN!"
M << "Rebooting"
sleep(50) // Wait 5 seconds
world.Reboot() //Reboot the server


Problem description:
I can't figure out why mobs in world aren't receiving the text saying game over.

By doing Game_Over(var/mob/M in world), you are actually sending a list of mobs to the source attached to the procedure. I will assume this is a global procedure, therefore, no player will receive a list nor will anyone see the text. What you should be looking to do is to take advantage of world << A . The << operator causes the A value to be output to the world.

proc/Game_Over()
world << "YOUR TEAM HAS FALLEN!"
world << "Rebooting"
sleep(50) // Wait 5 seconds
world.Reboot() // Reboot the server
In response to RJTaylor
Ah, I had practically forgotten, thank you.
In response to RJTaylor
For Some Reason it's still not working

    Game_Over() //Game Over
world << "<b>YOUR TEAM HAS FALLEN!</b>"
world << "<b>Rebooting... </b>"
sleep(50) // Wait 5 seconds
world.Reboot() // Reboot the server
In response to Lugia319
Lugia319 wrote:
For Some Reason it's still not working

Can you please provide the code snippet that calls Game_Over(), also you need to provide more information. Is Game_Over() a proc or verb, global, mob, obj, or atom? Does the world still reboot but no text is displayed?
In response to RJTaylor
proc
Game_Over() //Game Over
world << "<b>YOUR TEAM HAS FALLEN!</b>"
world << "<b>Rebooting... </b>"
sleep(50) // Wait 5 seconds
world.Reboot() // Reboot the server

Procedure, It's the world's procedure. And the text is displayed and all, it just takes 5 seconds and the world is insta rebooted instead of displaying the messages and then waiting 5 seconds.
In response to Lugia319
Lugia319 wrote:
Procedure, It's the world's procedure. And the text is displayed and all, it just takes 5 seconds and the world is insta rebooted instead of displaying the messages and then waiting 5 seconds.

That is strange, sleep should delay the reboot. Anyways, as a fix you can make use of spawn().

proc/Game_Over()
world << "YOUR TEAM HAS FALLEN!"
world << "Rebooting"
spawn(50) world.Reboot() // Reboot the server
In response to RJTaylor
It's still doing the sleep before chat, and sleep before reboot, could it have something to do with the way I call game over?

        while(players) //Players still in game
if(!players) // If no players remain
Game_Over() //Game Over
In response to Lugia319
Lugia319 wrote:
It's still doing the sleep before chat, and sleep before reboot, could it have something to do with the way I call game over?

>       while(players) //Players still in game
> if(!players) // If no players remain
> Game_Over() //Game Over
>


Have you overridden the Reboot() proc?

Can you display the proc that contains the snippet you displayed?
In response to RJTaylor
    Spawning()
var/spawn_timer = 15 - wave // Spawn Timer
if(spawn_timer <= 3) // If value is equal to or less than 3
spawn_timer = 3 // Set it to 3
else // If not
spawn_timer = spawn_timer // It's equal to itself
var/list/Spawns = list() // Define spawns as a list
for(var/turf/sky/S in locate(/area/SPAWN1)) //Search area of SPAWN1 for any sky turfs
Spawns += S // Add these sky turfs to the spawns list
new /obj/Target(pick(Spawns)) // Spawn a target
spawns -- // And subtract from spawns left
while(spawns) // Whiles spawns remain
sleep(spawn_timer) // Wait a second
new /obj/Target(pick(Spawns)) // Spawn a new target
spawns -- // Subtract a spawn
if(!spawns_left) // If no spawns are left
for(var/mob/M in world) // Applying to mobs in world
if(M.ingame) // If they're playing
M.Complete() // Complete
else
else
while(players) //Players still in game
if(!players) // If no players remain
Game_Over() //Game Over


What are the ways I could override the Reboot? I don't know if I am or not.
In response to Lugia319
Lugia319 wrote:
What are the ways I could override the Reboot? I don't know if I am or not.

world
Reboot()
sleep(50) //sleeps for 5 seconds

..() // this will reboot the world

proc/Game_Over()
world << "YOUR TEAM HAS FALLEN!"
world << "Rebooting"

world.Reboot() // Reboot the server
In response to RJTaylor
That didn't work either. Now it's taking even longer to reboot.

I think there's a problem with how I call the Game_Over because even without the delay it still won't work.
Your empty while(players) loop there is going to crash the procedure. Instead, do something like:

while(players)
sleep(10)


Though, really, you should tie this to a player leaving the game, not just constantly asking "ARE WE THERE YET ARE WE THERE YET ARE WE THERE YET ARE WE THERE YET ARE WE THERE YET ARE WE THERE YET".
In response to Garthor
The players var applies to people playing the game itself, not logged in.
In response to Lugia319
Good for you. That doesn't mean jack. There is a concept of "players left in a game". Therefore, there must be an accompanying concept of "players leaving the game", whether through their own action or some external force, like them being removed from the game. Therefore, whenever THAT happens, you should perform a check to see if any players a left. You should NOT check a limitless number of times per second (or even once per second, as I suggested) when the event is RIGHT THERE for you to tie things into.
In response to Garthor
Touche