ID:177716
![]() Aug 6 2002, 12:03 pm
|
|
How can I make a var that will apply to all mobs on one team?
|
Im sorry, I think you missunderstood me. Im looking for a way to make a var, the ammount of ammunition the team has stored, that can be accessed by the whole team. I hope that clarifies thing a bit.
|
var/GAMMO = 0
var/RAMMO = 0 mob/var/team = "" mob/Stat() ..() statpanel("ammo") if(team == "green") stat(GAMMO) else stat(RAMMO) |
The stat for it wont work. I cant figure out why. Doesnt really matter that much, but im just wondering how to do it.
|
Super16 wrote:
var/GAMMO = 0 This is a really really bad approach to Jotdaniel's problem and shouldn't be recommended by anyone. The correct solution is to use a datum. Lummox JR |
Jotdaniel wrote:
How can I make a var that will apply to all mobs on one team? The way you'd do this would be to make a datum. A datum can keep track of all kinds of information about the team: Its members, score, the location of its base, locations of its flags (in a CTF type of game), missions it might have, etc. team This is a basic piece of code to get you started. You can create a list of teams if you like, or create teams on the fly. Lummox JR |
mob/Login()
..()
var/O = input("") in list ("green","red")
src.team = "[O]"
mob/verb/TeamSay(T as text)
for(var/mob/M as mob in world)
if(M.team == src.team)
M << "[src]: [T]"
continue
else continue
I even gave you an example on how to use it :)