ID:1817868
 
(See the best response by Cranimus.)
Code:
mob/proc/DeathCheck(M)
usr.Health = 0
usr.MaxHealth = 100
usr.icon_state="dead"
usr.verbs+=(/mob/Death/verb/Spectate)
usr.movestop=1
usr.Alive=0
world<<"<font color=red><b><BIG>[M] has been killed!"
deaths+=1
if(deaths==8)
world<<"<font color=purple><b>All players have died. Players being sent back to the lobby."
sleep(15)
world.Reboot()
deaths=0
else
if(usr.Alien==1)
world<<"<font color=purple><b>The Alien has been defeated. Players being sent back to the lobby."
sleep(15)
world.Reboot()
return


Problem description: Basically, I'm trying to get it sorted that instead of a reboot all players are sent back to the Lobby Map, and instead of looking to make sure 8 players have died before sending everyone back it looks for all living players who stepped through the teleporter into the actual game that have died.

This is really one of the last bits of code I need help with before I can finally release Event Horizon.

Also, this is the teleporter code stuff too.

obj/props/Portal_Base
icon='props.dmi'
icon_state="portalbase"
density=0
name= "Station Portal"
Crossed()
if(roundstarted==1)
icon_state="baseon"
usr.loc=locate(/area/Station)
usr.Alive=1
usr.RoundEntered=1
usr<<sound(null)
sleep(10)
usr<<sound('AVP.ogg',1)
else
if(roundstarted==0)
return


So, obviously the RoundEntered var is what will be defining how many people are in that round, etc. Also, is there a way to cut of people joining a round after let's say 30 seconds?

Best response
When I was going to make a round-based game, I added players to one of two lists, when they first logged in they would get put into the "Lobby" list and when they entered the game they would be put into the "Game" list.

When someone dies, you just -= them from the Game list and += them to the Lobby list, then you run a check on the length of the Game list.

If the length is zero, you then know everyone is in the lobby.

Also if you wanted to block people from entering the game, you could declare a world variable, GameOpen = TRUE or FALSE.

Then you just add an IF statement to your Portals crossed() proc to check if its TRUE.

I'm sorry that I can't give code examples, I don't actually know how to make the HTML divs for dmcode snippets.





First you should never use usr inside of a proc.

To keep track of who joined the game you are need to create a list and add them when needed.

Now I'm not sure if there are multiple games that people can join or is it just the first eight?

If you want multiple games, you should create a datum to keep track of the different games, and create another datum to handle the games logic.

Another thing I would do is create a mob for a lobby. This mob would be one that navigate the menus or in your case be the one that could join games.

Sorry I can't give you actual examples at the moment.

It's all good chaps!

I can figure it out. Thanks though :)
In response to Cranimus
So i'm seeing this after it seems things have been resolved, but just wondering if what you meant by the 'html divs' for code snippets were the <dm></dm> tags?
Yeah that would be what I meant, thanks for telling me how to do it in future.
In response to Cranimus
No problem. Friendly Not-so-Neighbourhood-Forum-Frequenter (uhh...) here to Server!sorta.