ID:174921
 
In my game, I have it so that when u log on, you restart in the same place that you logged off. Also I have monsters that randomly move too. Well, if a person relogs on a monster, he gets a black screen and cannot move. (Because he cant see anything) Is there any way I can fix this besides making it so that you restart in town when u relog?
When setting the player's location, set the loc variable instead of using Move().

Instead of:

src.Move(locate(save_x, save_y, save_z))

Do:

src.loc=locate(save_x, save_y, save_z)

And this belongs in Newbie Central; it's not a BYOND bug, it's a bug in your game.
In response to Crispy
Crispy wrote:
When setting the player's location, set the loc variable instead of using Move().

Instead of:

src.Move(locate(save_x, save_y, save_z))

Do:

src.loc=locate(save_x, save_y, save_z)

And this belongs in Newbie Central; it's not a BYOND bug, it's a bug in your game.

Ur an idiot, it has nothing to do with moving the character, read my problem! When you LOG ON, it dont even move you! It does NOTHING to the character's location when he logs on, it happens when a character logs on on top of a monster, theres no moving at all! I know thats loc = locate crap, theres no reason to use it since your character isnt located or moved anywhere, he logs off, it saves his location, he logs on, he dont move anywhere, it just puts him back where he was.
In response to Metroid
well, are you foing something like this:



mob/Read()
F >> src

(or something similar to that)
or are you doing:


mob/Read()
var/last_x
var/last_y
var/last_z
F["X"] >> last_x
//etc
src.loc = locate(last_x,last_y,last_z)

And crispy is not an idiot. What do you mean it just puts him at his saved location? You must have write() saving the loc, so then read() must load it, so you must be moving the character somewhere. Can you show us the code?

Airjoe
In response to Airjoe
I used to use

usr.loc = locate(usr.savex, usr.savey, usr.savez)

but i dont need that anymore, with it dont fix the problem either. If you want to see the whole thing, here:
mob
Login()
..()
CheckBan(usr)
world << "\icon[usr] <font color = teal><b>[usr.name]([src.key]) logs in."
usr << "<font color = teal><b>Hello [usr]! Welcome to Slime Journey. If you have time and want to share any logical disscusions, join the site for this game at http://groups.msn.com/SlimeJourney/news.msnw! Have fun!"
// usr.loc = locate(usr.savex, usr.savey, usr.savez)
usr.sight = 2
if(usr.islocked == 1)
usr.islocked = 0
if(usr.lib == 1)
usr << "<font size = 3><font color = red><b>Please refrain from logging out in battle."
world << "<font color = red><b>[usr] had logged out of battle the last time he was on."
usr.lib = 0
usr.battle = 0

Logout()
src.savex = src.x
src.savey = src.y
src.savez = src.z
if(src.lib == 1)
src.islocked = 0
if(src.color == null)
return ..()
world << "<font color = teal><b>[src.name]([src.key]) logs out."
..()

In response to Metroid
Metroid wrote:
> mob
> Login()
> ..()
> CheckBan(usr)
> world << "\icon[usr] <font color = teal><b>[usr.name]([src.key]) logs in."
> usr << "<font color = teal><b>Hello [usr]! Welcome to Slime Journey. If you have time and want to share any logical disscusions, join the site for this game at http://groups.msn.com/SlimeJourney/news.msnw! Have fun!"
> // usr.loc = locate(usr.savex, usr.savey, usr.savez)
> usr.sight = 2
> if(usr.islocked == 1)
> usr.islocked = 0
> if(usr.lib == 1)
> usr << "<font size = 3><font color = red><b>Please refrain from logging out in battle."
> world << "<font color = red><b>[usr] had logged out of battle the last time he was on."
> usr.lib = 0
> usr.battle = 0
>
> Logout()
> src.savex = src.x
> src.savey = src.y
> src.savez = src.z
> if(src.lib == 1)
> src.islocked = 0
> if(src.color == null)
> return ..()
> world << "<font color = teal><b>[src.name]([src.key]) logs out."
> ..()
>

Looking at your code, if you nulled usr.loc = locate(usr.savex,usr.savey,usr.savez), it shouldn't even bring you back to where you were. Now, you said using usr.loc = loacte() still makes the screen go black if theres a monster?

Someguy who still doesn't know why most people just won't use Deadron's Character Handling. It's so easy!,
Airjoe
In response to Airjoe
It may be easy, but it's not always the best solution. If all you want is a system where each player gets one save, it's usually best to do it yourself. Doing it yourself also allows you to choose a better way of asking the player if they want to save, or load, or not. The default byond boxes like alert and input aren't the nicest looking things in the world.
In response to Airjoe
The code doesn't work because there isn't anywhere where there's any actual saving done at all. (or it's in another piece of code that hasn't been shown us)
Try reading chapter 12 of the DM Guide about saving: http://www.byond.com/docs/guide/chap12.html
In response to Airjoe
Actually I am using it. So THERE!
In response to Metroid
you should also replace the "usr"'s in your login proc, it should be src. usr is only semi safe in login()
In response to Wanabe
This is still not helping my problem, if I'm using Character Handling(and u people thought I didnt) then how will I fix this problem since it has nothing to do with saveing?
In response to Metroid
Well, if you have character handling set up right, the it should load too, and it shouldn't go back. I've played your game, and it dosn't have the "New character, Delted character, Choose Character". So something is wrong with loading. Im not great with saving. Maybe LummoxJR can help you out.

Airjoe
[edit]
And I NEVER said you didn't use it, I just said most people should, and it didn't seem like you did.
[/edit]
In response to Metroid
Metroid wrote:
Ur an idiot, it has nothing to do with moving the character, read my problem! When you LOG ON, it dont even move you! It does NOTHING to the character's location when he logs on, it happens when a character logs on on top of a monster, theres no moving at all!

Exactly. Trying to Move() on top of another dense mob will fail, which from the information you gave was the most logical reason for the problem. Setting the loc var avoids those problems.

I know thats loc = locate crap, theres no reason to use it since your character isnt located or moved anywhere, he logs off, it saves his location, he logs on, he dont move anywhere, it just puts him back where he was.

Therefore the character IS moving. By default, when loaded it starts at null (because BYOND doesn't save the loc, x, y, or z vars by default; you have to tell it to explicitly). So you have to move it to its correct location. You might not think it's moving, but it is.

There's no need to be so hostile. From the information you gave, that was the most logical solution. It would help if you gave more information to start with next time. Knowing that you're using CharacterHandling would have helped.

Looking at the code for CharacterHandling, you can see that it does actually use Move():

var/destination = locate(last_x, last_y, last_z)
Move(destination)

Tsk, tsk. Naughty Deadron! =) It would seem that it's actually a bug in CharacterHandling. I'll contact him and tell him to fix it, but in the meantime, a temporary fix is to just edit the library yourself.
In response to Airjoe
It does have the Create Character stuff. Are you sure ur talking about the right game here?

I tried that and it still doesnt fix my problem. I still get a black screen when i log on ontop of a mob.
In response to Crispy
Its not useing the loc=locate stuff, if u noticed its made as a comment cause im not using it, i figured that Character Handling was doing that. Either way, loc=locate is the one u want, no Move, [u][b]IM NOT USING usr.Move![/u][/b] So stop yelling at me about things that arent done that shouldnt be done!
In response to Metroid
we're not yelling. we're not even speaking. we're answering and typing. And unless you already edited deadrons character handling, you are using move(). And what does usr.Move() have to do with anything? we never said usr. we even said to change usr to src. So please be a little nicer. We're using our precious time to help you.


Airjoe
In response to Airjoe
Either way, to fix this when he has Move(destination) i just change it to loc=locate(destination)?
In response to Metroid
He is not an idiot! people who say people are idiots are probably idiots themselves.
In response to Metroid
No, don't use var/destination etc.
use
loc = locate(src.last_x,src.last_y,src.last_z)

Airjoe
In response to Metroid
Metroid wrote:
Either way, to fix this when he has Move(destination) i just change it to loc=locate(destination)?

Close. Change it to:

loc=destination

You've already done the locate() (well, Deadron has) on the var/destination=locate(blah) line, so you don't want/need to do it again.
Page: 1 2