ID:151206
 
How do you make a destination where your player will start?
On 2/19/01 1:12 pm Shane wrote:
How do you make a destination where your player will start?


login()
src.loc = locate(x,y,z)


under the mob that should be located.
In response to Kaidorin
login()
src.loc = locate(x,y,z)

Yep. There's another way that avoids having to hard-code the coordinate. You just have to set the <code>tag</code> of the starting square to something like "start". Then you can do this:

mob/Login()
loc = locate("start")

In response to Dan
mob/Hero
icon='player.dmi'
density=1
login(new)
src.loc = locate(2,2,3)

When I type that in I get error.....

Code.dm:28:error:src.loc:bad var
In response to Shane
On 2/19/01 6:57 pm Shane wrote:
mob/Hero
icon='player.dmi'
density=1
login(new)
src.loc = locate(2,2,3)

When I type that in I get error.....

Code.dm:28:error:src.loc:bad var

I think the problem is that you have to make sure Login is indented properly under mob/Hero. Try this:

mob/Hero
//icon and density stuff here, then...
Login()
src.loc = locate(2, 2, 3)

Also, be sure your Login starts with a capital L. This is the built-in proc that you're customizing. (For more info see the Reference. There's also a great tutorial about connecting to a world in the Tutorials section of the DM InfoCenter.)

Good luck!
In response to Guy T.
It still says bad var location. :(
In response to Shane
It still says bad var location. :(

Strange... try posting the changed code.
In response to Guy T.
mob/Hero
icon='player.dmi'
density=1
Login()
src.loc = locate(2,2,3)

In response to Shane
On 2/19/01 7:52 pm Shane wrote:
mob/Hero
icon='player.dmi'
density=1
Login()
src.loc = locate(2,2,3)

It looks like you still don't have Login() indented properly. Remember, Login isn't a global proc; it belongs to mob/Hero. So it should be indented to the same depth as the var declarations above it. Like this:

mob/Hero
icon='player.dmi'
density=1

Login()
src.loc = locate(2,2,3)
In response to Guy T.
NO ERRORS!! W00T!!

but now my game is black :*(
anyone know why?
In response to Shane
but now my game is black :*(
anyone know why?

Yes. Probably there is no such location as the coordinate that you specified. In that case, it dumps the player to the null location, which will give you an empty map.
In response to Dan
You might want to try making it (2,2,1)
That 3 might be doing it, whenever I play, I put a 1 there at it works, I dunno, just worth a try ;)
but now my game is black :*(
anyone know why?
In response to Shane
On 2/19/01 8:19 pm Shane wrote:
NO ERRORS!! W00T!!

but now my game is black :*(
anyone know why?

Read the coordinates:

2,2,3

That is, X:2, Y:2, Z:3

So if you don't have a third Z level, it will give you a black screen. The map is still there, but you passed the edge of it, which puts you in null location (as Dan said).
In response to Guy T.
I think i almost have it but i still get...

Code.dm:28: Inconsistent indentation.


Code:

mob/Hero
icon='player.dmi'
density=1
Login()
src.loc = locate(X:2,Y:2,Z:3)


In response to Gilser
I think i almost have it but i still get...

Code.dm:28: Inconsistent indentation.


Code:

mob/Hero
icon='player.dmi'
density=1
Login()
src.loc = locate(X:2,Y:2,Z:3)

In response to Shane
On 2/20/01 5:16 pm Shane wrote:
I think i almost have it but i still get...

Code.dm:28: Inconsistent indentation.


Code:

mob/Hero
icon='player.dmi'
density=1
Login()
src.loc = locate(X:2,Y:2,Z:3)
Which line is 28? That would help, check over all the code and make sure an extra space didn't lurk into there. If that's not the case, try putting the src.loc = line right under the Login() line, I don't have the computer that I use to run BYOND on right now so I can't check my own code on that...
Gilser
In response to Gilser
YAY!!! I got it to work!
Thank you all for your help!
Shane