ID:161598
 
How would i make a proc for a team to rank up after a certain amt. of wins in an arena?? (ranks are F,E,D,C,B,A)

ive got this code so far... it needs alot of tweaking for this to work i think

(just in case --> only the team leader can accept a challange)
///////////////////////////This is all the code that has to deal with the teams.../////////
mob/teams/leader
verb
Challenge(mob/M in world)
set category = "Team"
set name = "Challenge Team"
if (M.team=="")
usr << "You can't challange a Npc, or their not in a Team..."
return

else
if(M.leader==0)
usr<<"You can't challenge then because they are not the leader.."
else
usr.challenge = 1
M.challenged = 1
world << "<b>Arena:</b>[M] has been challenged by [usr]! You have 1 minute to respond!"
sleep(600)
M<<"The time has expired"
usr<<"The time limit has been expired"
M.challenged = 0
usr.challenge = 0
world<<"The battle was terminated"


Accept(mob/M in world)
set category = "Team"
set name = "Accept Challange"
if(M.challenge == 1)
if(usr.challenged == 1)
if(team_rank== "F")
world << "<b>Arena:</b>[usr] has accepted [M]'s challenge, it is a/an F class battle!"
M.loc = locate(52,11,18)
usr.loc = locate(96,11,18)
M. = 1
usr.PK = 1
M.challenged = 0
usr.challenge = 0
if(team_rank== "")
usr<<"O well :)"
if(usr.challenged == 0)
usr << "They have not challenged you!"
else
usr << "They have not challenged you!"


Decline(mob/M in world)
set category = "Arena"
set name = "ARENA-Decline"
if(M.challenge == 1)
if(usr.challenged == 1)
world << "<b>Arena:</b>[usr] has declined [M]'s challenge!"
usr.challenged = 0
M.challenge = 0
else
usr << "They have not challenged you!"
else
usr << "They have not challenged you!"
mob/teams
name="Team Register"
icon='Helpers.dmi'
icon_state="2"
HP=999999999999999999999999999999999999999999999999999999999999999999999999999
verb
Talk()
set src in oview(1)
set category="teams"
switch(input("Do you wish to form a team?",text) in list ("Yes","No"))
if("Yes")
if(usr.teams==0)
alert("By clicking OK, you agree to the following terms: 1) I will keep my team name the way it comes, the only thing i hold the power to change is the color 2) I will not abbuse team powers 3) I will not exploit any team bugs 4) I understand that the team name must be 3-12 letters long and will not take any other team's name; or take a team name popular to the anime/manga Air Gear 5) I also understand that by clicking OK, the rules are subject to change at any time, and i will follow any lawfull directive of these rules 6) i understand my team name must begin with a capital letter")
alert("What do you want the name of your team to be?")
if(length(name) < 2)
alert("Your name must be longer than 2 letters!")
return
if(length(name) > 20)
alert("Your name can not be longer then 20 letters!")
return
else
var/team = input("","team") as text|null
var/team_rank = "F"
usr.teams=1
usr.team="[(team)]"
usr.verbs += typesof(/mob/teams/leader/verb)
usr.Yen -= 10000
usr.leader=1
if(usr.leader==1)
usr<<"Your already in a team......"
if(usr.teams==1)
usr<<"your already in a team......if you really want to join the team quit and ask the leader to re-send the invitation."
else
usr<<"If you feel you are not ready it is best..."
mob
var
team=""
teams=0
recruits=0
leader=0
teamrank = ""
mob/teams/leader
verb
Invite(mob/M in view(10))
set category="Team"
switch(input("Do you really want to let them onto your team?", text) in list ("Yes","No"))
if("Yes")
if(M.teams==1)
usr<<"their on a team already"
else
switch(input("Do you want to join [team]?",text) in list ("Yes","No"))
if("Yes")
M.teams=1
M.team="[src.team]"
usr.recruits+=1
if("No")
usr<<"[M] said no..."
else
usr<<"Understood"
Boot(mob/M in world)
set category="Team"
switch(input("Are you sure you want to kick them out?", text) in list ("Yes","No"))
if("Yes")
if(M.teams==1)
M.teams=0
M.team=""
usr.recruits-=1

else
usr<<"There not from your team"
else
usr<<"Understood."

TeamSay(msg as text)
set category="Team"
set desc = "Say something to everyone in your team"
var/list/L
L = list("font size","font color")
for(var/H in L)
if(findtext(msg,H))
alert("No HTML in text!")
return
if(length(msg) >= 400)
alert("Message is too long")
return
for(var/mob/M in world)
if(usr.team == M.team&&M.teams==1)
M << "<font size=1><font face=verdana><B><font color=white>(team Say)-[usr]<font color=red>: [msg]"

TeamAnnounce(msg as text)
set category="Team"
set desc = "Say something to everyone in your team"
var/list/L
L = list("font size","font color")
for(var/H in L)
if(findtext(msg,H))
alert("No HTML in text!")
return
if(length(msg) >= 100)
alert("Message is too long for announce, use say")
return
for(var/mob/M in world)
if(usr.team == M.team&&M.teams==1)
M << "<font size=+3><font face=verdana><B><font color=#3090C7>([team] Say)-[usr]<font color=red>:[msg]"
alert("Make sure not to flood, or you will be muted")
mob/teams
verb
Team_Say(msg as text)
set desc = "Say something to everyone in your team"
var/list/L
L = list("font size","font color")
for(var/H in L)
if(findtext(msg,H))
alert("No HTML in text!")
return
if(length(msg) >= 400)
alert("Message is too long")
return
for(var/mob/M in world)
if(usr.team == M.team&&M.teams==1)
M << "<font size=1><font face=verdana><B><font color=white>(team Say)-[usr]<font color=red>: [msg]"
Leave_team()
set category = "team"
switch(input("Are you sure you want to do this?",text)in list("Yes","No"))
if("Yes")
switch(input("Are you POSOTIVE you want to do this?",text)in list("Yes","No"))
if("Yes")
usr.teams=0
usr.team=""
if("No")
usr<<"Good Idea"
if("No")
usr<<"Good idea not to betray your team"
Team_Announce(msg as text)
set desc = "Say something to everyone in your team"
var/list/L
L = list("font size","font color")
for(var/H in L)
if(findtext(msg,H))
alert("No HTML in text!")
return
if(length(msg) >= 100)
alert("Message is too long for announce, use say")
return
for(var/mob/M in world)
if(usr.team == M.team&&M.teams==1)
M << "<font size=3><font face=verdana><B><font color=white>(team Say)-[usr]: [msg]"
alert("Make sure not to flood, or you will be muted")
You should use at least a /list object to represent a team, or a /datum object, don't make it a bunch of variables on every mob. Instead, give one variable to the player mobs that refers to their team object.

You can make an associative list to represent a team. It will contain the members as items and any information you may want as an associated value. You can identify the leader of the team by looking at the first item of the list (which will probably be whoever created the team at the beginning).
On lists
http://www.byond.com/members/ DreamMakers?command=view_post&post=32170

With datums you can store much more information about each team such as a team's statistics and total wins, etc, which is what you seem to want. Your /datum will also use lists itself of course.
On datums
http://www.byond.com/members/ DreamMakers?command=view_post&post=35530

In response to Kaioken
ok but how would i make the proc for the team to rank up...???
In response to RanEsu
Give the team a "wins" variable. When 'the team wins', add 1 to it, then check if they have enough wins to Rank Up.
However, you asked a quite obvious question and you most probably haven't done the basic implementation I've said in my previous post yet, so get it done first. If you're having trouble with it, you should probably read beginner guides and tutorials so you know how to do the slightly more advanced things such as these.
In response to Kaioken
ok, but also, how would i make a proc to check if anyone is left in an area??? so after that proc is implemented and comes back as only 1 team winning, i can implement the team.wins+=1 then do the team rank up proc?
In response to RanEsu
I think you should describe the situation more generally. What do you need to check it for? Are you having like, a tournament/fight and need to figure out the winners? Or something else?

As for how to get whoever's left in an /area, you'd do that by looping threw it's contents. The time you'd want to check this might be when someone has Exited() the area.
In response to Kaioken
its basically a team vs. team thing... the last team standing wins..
In response to RanEsu
Then there are probably no /areas involved anyway. What you need to do in this case, in your code where a team wins add to their wins variable. This can be checked in the Die() (or you don't have one DeathCheck(), though you should separate Die() and DeathCheck()) proc, if a person's team was in a battle and the person that has died is the last alive in his team or something to that extent, then his team lost.