mob
Login()
world << "[usr]blbalbbl"</b>
Problem description:
when i put this code in to my game , when i compile and run it , i cant see the map , only black space ..
ID:141320
Apr 13 2009, 4:38 am
|
|
Code:
mob Problem description: when i put this code in to my game , when i compile and run it , i cant see the map , only black space .. |
In response to Demon_F0rce
|
|
Demon_F0rce wrote:
Also, here's one thing you've done bad. You see, mob also means NPC's that you'll eventually put (I think) into the game, The override will only be executed for NPCs if a player logs into one of said NPCs, so normally you wouldn't notice. Login() isn't always called after the object is created like New() is, it's only called when a player logs into a mob, and this also means it can happen multiple times for one object and some time after its creation, etc. Using client/New() is good, but if you're going to do things that take time (like character creation) you should let the proc do its own stuff first (attaching the player to a mob/logging him in, etc) to prevent problems. |
In response to Kaioken
|
|
But if he also utilises a login system in which people change there names and then enter the game, if he doesn't use something such as client/New() he could have things such as:
"Player1(Player1) has logged in! Player1 has logged out... Test(Player1) has logged in!" appear when people are logging in. I know this one from personal experience. |
In response to Demon_F0rce
|
|
Of course that could happen (though only if the player logs into a different mob, not if he just changes his name), but it can also be avoided when done properly... but using client's New() and Del() for such things is easier anyway. It's only normal for Logout() and Login() to be called again when a player switches mobs.
|
In response to Kaioken
|
|
thanks .. halped me alot .. so if im gonna use charecter creation and npcs , wich one should i use ?
|
In response to Hollowtoly
|
|
client/New(), like everyone said. Code that does stuff spanning time (such as sleeping or waiting for an input from a player) should be spawn() off there though and then ..() should be called (and returned) so it finishes doing the default player mob and connection stuff before moving on to other things. Like:
client/New() |
And I'm just gonna guess that the was a mistake you made concerning the Code Problems template.
Also, here's one thing you've done bad. You see, mob also means NPC's that you'll eventually put (I think) into the game, so instead it would be a better idea to address client/New() which only looks at PC's that join the game.