ID:178377
 
I was wondering what would be the most effiecient way to have modes of play? I thought of making a global var

var/mode

and then having the host set the mode

mob/host/verb/mode()
//set mode

then I get stumped on what to do. Any help appreciated.

-ST
what kinda modes of play?
In response to WildBlood
i don't need exact code, but here is an example:

a team shootout or CTF.
Sariat wrote:
I was wondering what would be the most effiecient way to have modes of play? I thought of making a global var

var/mode

and then having the host set the mode

mob/host/verb/mode()
//set mode

then I get stumped on what to do. Any help appreciated.

I'd suggest hard-coding a list in there:
var/const/MODE_FREEFORALL=1
var/const/MODE_TEAMS=2
var/const/MODE_CTF=3

var/playmode=MODE_FREEFORALL
var/current_playmode // for current game
var/inprogress

mob/host/verb/mode()
set name="mode"
set desc="Set mode of play"
set src=usr
var/list/modes=list("Free-for-all"=MODE_FREEFORALL,
"Team play"=MODE_TEAMS,
"Capture the flag"=MODE_CTF)
var/curmode // this is the text version of global.playmode
for(var/themode in modes)
if(modes[themode]==playmode)
curmode=themode
break
var/newmode=input("What game mode would you like to play?","Set Game Mode",
curmode) as null|anything in modes
if(!newmode) return
playmode=modes[newmode] // newmode is text; we want a number
world << "[usr] has set the [inprogress?"next game's":"game"] mode to <B>[newmode]</B>."

Lummox JR
In response to Lummox JR
Thanks, just what I needed.