ID:148951
 
I have two problems, but they relate to eachother. first is that my login code will not set the team name even though I tell it to, heres the login code:

var/rammo = 5
var/bammo = 10

mob/login
var/T
var/mob/char
Login()
name = input("What is your name?","Name",src.key)
switch(input("What team would you like to be on?","Team")in list("Red","Blue"))
if("Red")
T = "Red"
switch(input("What type would you like to be?","Type")in list("Tank","Builder"))
if("Tank")
char = new/mob/red/tank()
if("Builder")
char = new/mob/red/builder()
if("Blue")
T = "Blue"
switch(input("What type would you like to be?","Type")in list("Tank","Builder"))
if("Tank")
char = new/mob/blue/tank()
if("Builder")
char = new/mob/blue/builder()
src.Team = T
src.client.mob = char //now, we change the player to this newly defined mob!
del(src) //delete the old mob
src.loc = locate(1,1,1)
..()

Second is part of the way i found out about first. Two verbs that check team ammo and resupply from team ammo, but wether you chose red or blue team they both read and supply from red team ammo. Here are the two verbs:


mob/verb/resupply()
if(rammo>=5)
rammo-=5
usr.missile +=5
return
if(bammo>=5)
bammo-=5
usr.missile+=5
return

mob/verb/checkammo()
if(usr.Team == "Red")
usr<<"[rammo]"
return
if(usr.Team == "Blue")
usr<<"[bammo]"
return


Anyone know what would be cuasing this?
Try changing the usr.Team to usr.T as you defined it in the first place maybe that would work.

and By the way why shouldnt i answer this right away :P
Jotdaniel wrote:
I have two problems, but they relate to eachother. first is that my login code will not set the team name even though I tell it to, heres the login code:
src.Team = T
src.client.mob = char
del(src) //delete the old mob
src.loc = locate(1,1,1)
..()

src.Team = T

That line is horrific for what your going to do. Once you switch mobs you no longer have that var with the same information.

Change that to char.Team = T , so when you switch mobs you will have the Team var.