ID:167709
 
Is it posible to make for people in a team to collect one gold amount and if someone spends it it will go off everyones money it could be stored in a chamber/bank or something
....It is possible but i do not know how to do it so i cant show you...
In response to Dragon_fire6653
Ok... hope someone responds who does know (A)
The best way to go about this is to have a team object that keeps track of who is in it, and give that team object the variable that keeps track of shared team resources. Teams have been discussed many times before, but I will scratch the surface of it once again.
team
var
list/members[0]
//This will keep track of people in the team
proc
Add(member)
//This will add people to the team
//You can pass a single object or a list to it
members.Add(member)
Remove(member)
//This will remove people from the team
//Also can take single object or a list
members.Remove(member)
New(member)
if(member) Add(member)

mob
var/team/team
proc/SwitchTeam(team/new_team)
if(team) team.Remove(src)
new_team.Add(src)
team = new_team

Then when you want a certain player to join a team, you can just all SwitchTeam for it, passing the team you want to join as an argument.

Alright, now that I have recapped the basics of teams, I'll get right to the important part, the gold you mentioned.

Just give the team object a gold variable, and add/subtract from that instead of the players'.
team
var/gold = 0

Show that to players instead of a personal gold variable.

If you want players to also be able to have their own, personal stores of gold, you could leave them with a gold variable of their own, then when you display gold you could display gold+team.gold instead.

Either way, you can also do this with other things besides gold. You could give the team object its own inventory list and have a shared stash of equipment too, or if it's a cabal of ritualistic mages that share their spell power you could have a central spell list on the team object. There's plenty you can do with this concept.
In response to Loduwijk
Thanks i hope i can do it now and already got somekinda team code in but its just wich side you wish to be on
In response to BBDragoon
And one more question how do i make it that more teams are avaible or is that already in it?
In response to BBDragoon
You just create more instances of the team object. If you want to have a bunch that people can choose from, you'll also want to give the team object a name variable.
team
var/name

Then, if all teams are available to people to choose from, just keep a global list of them.
var/list/teams[0]

And if the game starts with a couple teams already formed, just make them in world/New
world/New()
var/team/team = new
team.name = "Blue Team"
teams += team
team = new
team.name = "Red Team"
teams += team

Then, if you want to allow the creation of more teams, just add them in the same way. And to let people choose a team to join, just give them an input.
team = input("","Join what team?")in teams

That should list the team names. I recall seeing somewhere that if you define a name variable for non-atomic datums it should treat them the same way name-wise in input lists as it does with normal objects derived from /atom.

If that's not the case you could still select a team, but it would just require a small amount more code. When you add teams to the teams list, instead of doing "teams += team" you would do "teams[team.name] = team", then where the player selects a team you would do something more like the following.
team = input("","Join what team?")in teams
team = teams[team]

But if I remember correctly, and the datums show properly in the input list in the first place, then you shouldn't require this.
In response to Loduwijk
Ok thanks alot you really helped me
In response to Loduwijk
mob
Login()
world << "[src] logged in!"
usr.name = input("What is your name?")as text
if(src.name == "")
src << "You cannot use a blank name!"
src.Login()
else
team = input("","Join what team?")in teams
src.icon = 'Imp.dmi'
src.verbs += new /mob/Dig/verb/Dig
src.verbs += new /mob/Claim/verb/Claim
src.verbs += new /mob/Build/verb/Build
src.level = 1
src.attacking = 0
src.team = team
usr << sound('k.mid',1)


Problem

how do i get every team to start somewhere else i did all the coding in you did now there is no error or something
In response to BBDragoon
First let me say that I made a mistake. Well, almost...

I made that SwitchTeam function for a reason, then I forgot to use it. Use SwitchTeam(team) after they choose their team to have it set it up (that is, the team object recognises that player as part of the team).

BBDragoon wrote:
how do i get every team to start somewhere else i did all the coding in you did now there is no error or something

There are several ways. The best would probably be to give teams a startpoint and set the location equal to that.
team
var
x = 0; y = 0; z = 0
mob/Login()
...
loc = locate(team.x, team.y, team.z)

You could set the team's start location either at compiletime or runtime. If the teams will be static, you can probably do it easily enough at compile-time.
team
Red
x = 5; y = 4; z = 1
Blue
x = 34; y = 12; z = 1

world/New()
teams += new /team/Red
teams += new /team/Blue