ID:173015
Feb 27 2004, 2:19 pm (Edited on Feb 10 2009, 4:44 am)
|
|
Post Removed
|
Feb 27 2004, 2:38 pm
|
|
I can help you, but first I'll have to know how you handle teams. Do you use lists? Or something else?
|
You could do something like this, depends on how you have your game written.
mob/Stat() |
In response to Valderalg
|
|
Bzzt! Wrong! =P
The way you've got it setup you would have to make teammembersred and teammembersblue as global variables. As mob lists they are local to the mob, so each mob would have a differnt list that contains only themself. However everthing else is right, so disreguard the bzzt wrong and give yourself a pat on the back. |
In response to DarkView
|
|
Post Removed
|
In response to MikeWho3
|
|
MikeWho3 wrote:
I am new to games with teams on it. This is my first game that needed to display a list of teams. I put the code for my game on my webpage at http://mikewho.topcities.com/Untitled1.html Ok looks good. Has a lot of flaws but you seem to understand the stuff that you've done (most people write entire systems and have no clue how it works). One thing you're going to get sick of hearing, don't use usr in procs. usr and the player aren't the same thing. It's safe to use usr in verbs, but not procs. usr appears to work, but when you actually get a decent amount of players into the world things go nuts. Use src instead of usr when ever possible. On to the actual problem. I could show you how to do what you want, but it wouldn't be very efficient. Instead I'll give you a new way and teach you a few things. First thing, global variables. You were on the right track with world vars, but you aren't allowed to make new world vars. Instead what you want is a "global" var. Declaring a global variable is a lot like declaring a normal variable. Except you don't give it to anything (like mob or world), and you add "global" inbetween the var and the vars name. Example: var/global/TeamOne Now to use that var we just do global.TeamOne. Ok, now you need to learn a little about lists. Check out "lists" in the reference (press F1 in Dream Maker). Basically we declare a list much like we do a variable that holds a mob or a obj. var/list/L will give us a new variable of the "list" type, named L. Now to add a new entry to that list, we just do L += new_thing. Likewise we use L -= new_thing to remove it from the list. To reset a list, we just do L = list(). NOTE: If I wanted to make a global list, I would do the "global" first, then the "list". So it would appear var/global/list/L Lists are a lot more complex, and I advise you learn as much about them as possible, but for now that is all you need to know. Now for the fun part, using this information in the game. First, we are going to need two global lists. One for Red Team and one for Blue Team. Then it is a simple matter of adding players to the correct list based on their choice. Now we are ready to do the statpanel stuff. It is just a simple matter of using an if() statement in Stat() to see which team to display. Then a statpanel("Team Name",global.TeamName). So it would look like this: mob/Stat() if(src.team == 1) statpanel("Blue Team",global.BlueTeam) else //If it isn't 1 is must be the other. statpanel("Red Team",global.RedTeam) I hope that helped. If you have any questions just post them here. |
In response to DarkView
|
|
Lummox JR wrote a great article on associative lists (a more complicated but incredibly useful type of list) a while ago. (Two whole years, in fact!) You won't need associative lists for this, but when you have some time I suggest you read it, it's very useful.
http://www.byondscape.com/ascape.dmb/LummoxJR.2002-0103/ Also check out the article on BYONDscape about datums. And all of the other articles, they're all good. =) (A lot of them are free, especially the less advanced ones.) |