ok, say you have a red team and a blue team in your game. you want each color to start at a different point when someone joins. "example: someone joins the red team and starts at the red base, and someone joins on the blue team and starts at the red base." here's the coding i have for this part so far-
mob
Login()
usr.icon_state = input("What team do you want to join?") in list ("Red","Blue")
usr.Move(locate(1,1,1))
any ideas? thanks.
ID:176880
![]() Nov 30 2002, 6:46 pm
|
|
ok, i tried using your code....and now i can get the game to start, but it just shows the map when i join and no characters. help?
|
Well, if you used my area suggestion, did you define the areas? if not do this:
area Red Blue Put that in the dm where you define all your turfs, objs, and stuff. Now go to your map and make sure you place these areas where you want the teams to start. If you used coordinates, make sure they are the right coordinates. :) Ummmmm, I use code very similar to that to start out most of my games so I know it works, there must be a small thing that we're overlooking. Tell me if the above ideas work. If not, let me know exactly what your problem is and if you used areas or coordinates. Hope any of this helps! :) |
i used exact location starting points (1,1,1) and (1,1,1) just to test it out, and i can't see my character. any ideas?
|
Check the dmi files to make sure the states are exactly the same as the code specifys. The states are case sensitive and don't let you know if there is an error. Make sure the dmi file's state says "Red" not "red" or if you want "red" change the code to "red". Check also for "Blue" This is a common error and may be the problem for the gfx to not show up. Hope this helps. :)
|
ok, i got the character to appear now, but there are still a couple of problems. first, i don't get any errors but i do get a warning. it says "empty switch statement". now when i pick a character, it doesn't matter whether i choose red or blue, because now i only get blue. it acts like i don't even have a red character. it does move my character to the right starting point, however it only works for the blue one. any ideas now? thanks alot for the help so far by the way...
|
mob
Login() var/y = input("What team do you want to join?") in list ("Red","Blue") switch(y) if("Red") icon = 'person.dmi' icon_state = "Red" Move(locate(4,9,1)) if("Blue") icon = 'person.dmi' icon_state = "Blue" Move(locate(4,2,1)) |
Its an indentation problem that doesn't cause errors, but it doesn't work properly.
<code> mob Login() var/y = input("What team do you want to join?") in list ("Red","Blue") switch(y) if("Red") icon = 'person.dmi' icon_state = "Red" Move(locate(4,9,1)) if("Blue") icon = 'person.dmi' icon_state = "Blue" Move(locate(4,2,1)) </code> You have to indent all the lines after "switch(y)", or else it doesnt think that the if statements are part of the switch statment. [edit] Here's the code a little prettier: <code> mob Login() icon = 'person.dmi' icon_state = input("What team do you want to join?") in list ("Red","Blue") switch(icon_state) if("Red") Move(locate(4,9,1)) if("Blue") Move(locate(4,2,1)) </code> |
Try this:
mob
Login()
var/y = input("What team do you want to join?") in list("Red", "Blue")
switch(y)
if("Red")
icon = 'Player.dmi'
icon_state = "Red"
Move(locate(/area/red))
if("Blue")
icon = 'Player.dmi'
icon_state = "Blue"
Move(locate(/area/blue))
You can subsitute the areas with exact coordinates if ya wish, i kinda spruced up yur code a bit, but it'll do what you want. Hope this helps. :)