ID:140535
 
Code:
Timer.dm
mob/proc
StartRound(mob/M)
min = 3
sec = 0
world<<info+"The round has started!"

if(M.team == "Red")
M.icon = 'Red.dmi';M.loc = locate(37,30,1);M.hp = 100;M.mhp = hp;M.density = 1
M.verbs += typesof(/mob/ingame/verb)
if(M.team == "Blue")
M.icon = 'Blue.dmi';M.loc=locate(22,3,1);M.hp = 100;M.mhp = hp;M.density = 1
M.verbs += typesof(/mob/ingame/verb)

// The above code should set the icons, density, and location relitive to the team they are on.
// Why is this not working?

callTimer()
proc
EndRound()
world<<info+"The Round will reset in 3 seconds."

sleep(30)
usr.StartRound()



// EndRound() is called in this code, just some lines have been censored for personal reasons. :P


Problem description:
I'm at a complete loss here. Nothing I've tried will work. The lines in comments are where I'm having trouble-- this will not do what it should do. It won't set the icon, it won't set the density, and it won't relocate src (usr). Is there a more efficient way of doing this?
Because you are not passing an argument to StartRound(). Presumably, you don't want that argument at all, and instead want to loop through all mobs in the world, like so:

for(var/mob/M in world)
if(M.team == "Red")
//etc.

callTimer()


It also shouldn't be a mob proc because there is no one mob which can be considered the source. It should probably be global instead.
Also, you can put things that are the same for both teams outside of the team checks in stead of typing the exact same thing again, like so:

// ...
if(M.team == "Red")
M.icon = 'Red.dmi'
M.loc = locate(37,30,1)

if(M.team == "Blue")
M.icon = 'Blue.dmi'
M.loc = locate(22,3,1)

M.hp = 100
M.mhp = hp
M.density = 1
M.verbs += typesof(/mob/ingame/verb)

// Looks a lot cleaner, don't you think?