ID:155115
 
Hello everyone.
I need some adives/help, I am trying to make a game from scratch and I've been thinking how to do this..
I just want a explanation or some tips how to do it, so I want a group of players to capture a part of the map, like area by area. For example a "x" of players get in that certain part of area, and it will active on the enemy faction something like "Your area is being capture, hurry and go defend it", so the players already in the area to capture it have "y" time but when enemy faction enters in that area, time will reset until the enemy faction gets defeated. It's like as long no1 is in that area except capturing team the time will always active or actived.
When captured area, it will belong to capture team. Hope you guys understood my idea, expecting some tips.
if you are trying about territory wars then
datum/TeamDatum//Datum
var//var
name="no name"//name
Owner="No One"//Owner
list/Members=list()//list of Members

obj/Supplemental/CapBar//Flag Bar
icon='CapBar.dmi'//icon
icon_state="0"//Icon_state

mob/var/datum/TeamDatum/Team=null
obj/TerritoryFlag//create a new obj
icon='Flags.dmi'//icon
icon_state="Black"//icon_state
var/Owner//Define Owner
var/Color//Define Team Color
var/datum/Clan/ClanDatum
var/obj/RGBable/Flag/FlagColor=new()//create new RGBable Flag
proc/ColorFlag()//proc
var/icon/I2=new(initial(src.FlagColor.icon))//its real Flag icon
if(src.Color) I2.Blend(src.Clan)//if there is color then Blend I2 with Color
src.FlagColor.icon=I2//Change the icon to Blended icon
New(var/NewLoc)
var/obj/Supplemental/CapBar/CapBar=new(src.loc)// create new CapBar at same place at flag
var/CapPercent=0//new defined var for CapBar
spawn() while(1)//Spawn then while world is on it will keep looping
for(var/mob/M in oview(1,src)) //any mob standing right next to it
if(!M.Team) continue // if it havent got team leve it and find new one
if(M.Team.name!=src.Owner)//if standing next to it isnt Flag Owner
CapPercent+=1// Increase Cap Percent
if(CapPercent>=100)//ifCapPercent get to 100
world<<"[TWTag] [M] Captured [src.x],[src.y] for {[M.Team.name]}"// tell every one
src.ClanDatum=M.Team//set its Team
src.Owner=M.Team.name//Set it Owner to Team Name
src.Color=M.Team.Color//Set it Color to Team Color
src.ColorClanFlag()//Reapply Color
CapPercent=0//Set CapPercent to 0
else CapPercent=0 // if Player Standing Next to it is Flag Owner team member Dont do any thing
CapBar.icon_state="[round(CapPercent/100*31)]"//Set CapBar icon_state
sleep(1)//sleep for 1 milisec
return ..()//return it
obj/RGBable/Flag//new RGBable Flag
icon='RGBFlag.dmi'//icon

and you will have to do most of the bits and peices on your own
In response to Hassanjalil
Is not what I was expecting but till pretty good, thanks for your effort in commenting the code, it helped alot to understand what you did.

Thank you for your time.
In response to IronLawler
Essentially you can use the /area prototype for...defining the separate areas on the map. Then you can just develop functions as necessary to keep track of the players inside, etc...

Enter(), Entered(), Exit(), Exited(), and several other functions will help you with keeping track of the players inside of an area. The contents var will also be handy.