ID:266540
 
Please help,I'm making a CTF game(Capture the Flag).When they somebody places the flag on a turf,the whole teams flag placed var will be 1.How would I do that???????

~~~~SSJ4_Gohan_Majin
Okes,
mob/var/RedTeamP = 0
mob/var/BlueTeamP = 0
mob/var/Red = 0
mob/var/Blue = 0
mob/RedTeam
icon = 'Red.dmi'
mob/BlueTeam
icon = 'Blue.dmi'
mob/Login()
switch(input("What team?")in list("Red","Blue"))
if("Red")
client = new/mob/RedTeam
usr.loc = locate(/*Red Team Base*/)
usr.Red = 1
if("Blue")
client = new/mob/BlueTeam
usr.loc = locate(/*Blue Team Base*/)
usr.Blue = 1
turf/Grass
icon = 'Grass.dmi'
obj/RedFlag
icon = 'RF.dmi'
desc = "Flag of red team, Go for it Blue Team!"
verb
Capture()
if(usr.Red == 1)
alert("You don't capture your own flag you idiot!")
if(usr.Blue == 1)
world<<"[usr] captured Red Teams Flag!!"
var/mob/M
for(var/mob/M as mob in world)
if(M.Blue == 1)
M.BlueTeamP += 1
usr.loc = locate(/*Blue Base*/)
obj/BlueFlag
icon = 'BF.dmi'
desc = "Flag of blue team, Go for it Red Team!"
verb
Capture()
if(usr.Blue == 1)
alert("You don't capture your own flag you idiot!")
if(usr.Red == 1)
world<<"[usr] captured Blue Teams Flag!!"
var/mob/M
for(var/mob/M as mob in world)
if(M.Red == 1)
M.RedTeamP += 1
usr.loc = locate(/*Red Base*/)

Or Something like that..


In response to FireEmblem
client = new/mob/BlueTeam
usr.loc = locate(/*Blue Team Base*/)

Both of those lines are malformed. It won't do what you think it will, if it will even compile.
In response to Skysaw
I would personally go with lists. Have a global list for each team so you don't have to search through all the players in the world each time.

var/list/Red = new()
var/list/Blue = new()

mob
Login()
..()
switch(alert("Join which team?","Join","Blue","Red"))
if("Blue") Blue += src
if("Red") Red += src

Then when the flag is placed just loop through all the players on the appropriate team and change their flag planted var to 1.