ID:1277332
 
(See the best response by LordAndrew.)
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???

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
health src
relocate src

else if src's health isn't less-than or equal-to zero
give killer experience
delete src


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
DeathCheck(mob/attacker)
//Put code here


But make sure your players code is like this

mob/player/
icon='mob.dmi'
icon_state="Player"


After that you add the enemies death check

    Enemies
DeathCheck(mob/attacker)
//code here



right.. ok
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?
and send npc enemies back to starting locations before theyspawn again?
In response to Thedeadwarrior123
You could handle mob death in two ways:

// Check both things in one procedure.
mob/proc/OnDeath(mob/killer)
// Wait, they're still alive!
if (src.health > 0) return

if (src.client)
// Handle players dying.

else
// Handle non-playable characters dying.


Or, as Dr.Penguin suggested, you could go the inheritance route:

mob/proc/OnDeath(mob/killer)
// Do nothing by default. This is just a function prototype.

mob/player
var lives = 5

OnDeath(mob/killer)
// Respawn player when they die.
--lives // Subtract one from lives.

if (lives <= 0)
GameOver()

mob/enemy
OnDeath(mob/killer)
// Give killer experience.
// Handle whatever it is you want to do with monsters.


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.)
cool thanks. Ill keep in touch if i need more help.
1 last thing how would i approach life and game over proc?
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.
im kinda having trouble with mob deaths as well.
In response to LordAndrew
check last 2 post.
no one can help??? :_(
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
Page: 1 2 3