Hey there developers. Im in need of more help, yes again. Soo, while playing my awesome game I was slain... When this monster bested me, my game shut down. Like no more, your done... After trials of seeing what couldve went wrong and trying this over and over again, no progress. Anyone have any idea why and the best way to fix it???
May 27 2013, 11:09 am
|
|
Most likely, you're deleting things when they get killed, which would cause this. Could you post how you're handling entities dying?
|
DeathCheck(var/mob/Killer)
if(src.Hp<=0) world<<"[Killer] Vanquished [src]!" src.Hp=src.MaxHp src.loc=locate(5,5,1) else Killer<<"You Slayed [src] obtaining [src.Exp] Exp" Killer.Exp+=src.Exp Killer.LevelCheck() del src |
del src is your problem. When your client dies, you delete it. When you delete a client, it disconnects them from the server.
|
In response to Thedeadwarrior123
|
|
The logic of your code is as follows:
if src's health is less-than or equal-to zero You have no check in place that prevents players from being deleted. You need to assert that if what's being killed has a client, then to not delete it. |
Thats right. so what if I want this client sent somewhere when it dies and after a number then make the client restart?
|
its better to organize your Death checks like Mob/Players
player But make sure your players code is like this mob/player/ After that you add the enemies death check Enemies |
sooo how should i make a code to relocate clients when they die, but after a certain amount of deaths they see a game over screen and they restart from last save point?
|
In response to Thedeadwarrior123
|
|
You could handle mob death in two ways:
// Check both things in one procedure. Or, as Dr.Penguin suggested, you could go the inheritance route: mob/proc/OnDeath(mob/killer) As for handling lives, you'd want to define a variable that keeps track of the player's current number of lives. Every time they die, subtract from their lives and do a check to see if they still have any. (I included an example of this in the above snippet.) |
In response to Thedeadwarrior123
|
|
Depends on how what you'd want a game over to mean, really. Does it make it so you have to start a new character, or maybe just have to start over from a previous point of the game?
|
start from last save point would be nice, and when game over proc has been fulfilled to show game over screen with a restart button.
|
In response to LordAndrew
|
|
check last 2 post.
|
In response to Thedeadwarrior123
|
|
Thedeadwarrior123 wrote:
no one can help??? :_( Please be patient; someone will reply eventually. :) Thedeadwarrior123 wrote: start from last save point would be nice, and when game over proc has been fulfilled to show game over screen with a restart button. For this you could utilize screen objects (by rendering objects to client.screen) to put up the game over screen, as well as show the respawn button. Thedeadwarrior123 wrote: im kinda having trouble with mob deaths as well. What are you having trouble with? |
In response to LordAndrew
|
|
programming that when an enemy dies go to the area i set them to, and giving players lives and when they die sending them to their last save point
|