ID:170602
 
I have different races in my game (who doesn't?) such as man, dwarf, elf, etc. How do I get people of a certain race start at a certain place when they log in?
at the end of character creation put..
if(src.race == "human")
src.loc = locate(1,1,1)
else if(src.race == "dwarf")
src.loc = locate(1,1,2)

In response to Dession
Use switches, they're much shorter.
switch(src.race)
if("dwarf")
src.loc = locate(9,1,1)
if("human")
src.loc = locate(13,37,1)

In response to Dession
I tried that, but when I ran it, it didn't take me anywhere.
In response to Seraphrevan
Did you add it right after they pick their race?
In response to Hell Ramen
I used that code, but how do I make it so that the user sees their location without having to use my verb "look"? (My game is text based)
In response to Seraphrevan
src << "Your loc is [src.x],[src.y],[src.z]."

Or you could just call your look verb. ;p
In response to Hell Ramen
Heh yours is 5 lines mine is only 4..
In response to Hell Ramen
My game uses the names, not coordinates. I tried substituting the coordinates with the name, but it keeps saying a.name is an undefined var. I'm pretty sure it is.
In response to Dession
Dession wrote:
Heh yours is 5 lines mine is only 4..


lol
In response to Dession
Dession wrote:
Heh yours is 5 lines mine is only 4..
Trust me, switch is better in the long run. It saves a lot of "else"s.
In response to Seraphrevan
Seraphrevan wrote:
My game uses the names, not coordinates. I tried substituting the coordinates with the name, but it keeps saying a.name is an undefined var. I'm pretty sure it is.

Oh.

mob/var/area/spawn


Then set their spawn to that, then use "spawn.name".
In response to Hell Ramen
I never said it was worse/better I am just pointing out you said yours is shorted but it is not.
In response to Dession
Dession wrote:
I never said it was worse/better I am just pointing out you said yours is shorted but it is not.

I guess I wasn't descriptive enough. You'll be using less "letters".
In response to Hell Ramen
Wow yours is 46 letters mine is 55 BIG difference. Seirously 9 letters isn't going to kill you.
In response to Dession
Dession wrote:
Wow yours is 46 letters mine is 55 BIG difference. Seirously 9 letters isn't going to kill you.

Just saying, it's faster then doing
else if(q==pie)
, 3.14, 304234, 23478237423, 349824392, etc.

You can EASILY shorten it up and go faster by using switch()
In response to Hell Ramen
I like if()'s better but I guess its all about opinion.
In response to Dession
Dession wrote:
I like if()'s better but I guess its all about opinion.

It does use if()s. >_>
In response to Hell Ramen
I'm sorry, I'm a little confused about that...