mob/GM/proc/start_round()
world <<" {{ The round has started! Go Hunt for gems! }}"
sleep(20)
world <<" Mins: 5 mins left"
sleep(520)
world <<" Mins: 4 mins left"
sleep(520)
world <<" Mins: 4 mins left"
sleep(520)
world <<" Mins: 2 mins left"
sleep(520)
world <<" Mins: 1 mins left"
sleep(520)
How would I make it where it says who the winner is. without me writing it in? How would it no which Player has The highest score?
ID:178699
Apr 16 2002, 9:35 pm
|
|
ShadowSiientx wrote:
How would I make it where it says who the winner is. without me writing it in? How would it no which Player has The highest score? You'll probably want to make a proc to do all your end-of-round cleanup. proc/EndOfRound() Lummox JR |
In response to Lummox JR
|
|
create.dm:25:error:players:undefined var
create.dm:25:error::invalid expression create.dm:21:M :warning: variable defined but not used Bladed Knightz.dmb - 2 errors, 1 warning (double-click on an error to jump to it) |
In response to Skysaw
|
|
NM SKYSAW'S one worked
|
In response to ShadowSiientx
|
|
ShadowSiientx wrote:
NM SKYSAW'S one worked Lummox's was much more robust than mine, and allowed for conditions other than a simple win. It's a little more advanced, so might not fit as easily into what you've already done, but you might want to look further into it to see what makes it tick. |
In response to ShadowSiientx
|
|
ShadowSiientx wrote:
create.dm:25:error:players:undefined var As I said, you need to define players as a global list of players. You should have a list of this kind in your game, though it might have a different name. If you have no such list, do this: var/list/players=list() Lummox JR |
proc/show_winner()
var
mob/winner = null
high_score = 0
for(var/mob/M in world)
if(M.score > high_score)
high_score = M.score
winner = M
world << "[winner] wins the game with [high_score] points!"
It doesn't account for ties, but it's a starting place for you. Also note that this code assumes all mobs in the world are players who can score points.