what's wrong withthis system. The monsters wont die! I deleted the deathchecks because they said they were undefined.
Here is the monster system and below it is the character system
mob/monster
var/mob/characters/P
New()
.=..()
spawn(1)
Wander()
proc/Wander()
while(src)
if (P in oview(5))
step_towards(src,P)
else
step_rand(src)
for(P in view(src))
break
sleep(5)
spawn(40)
Wander()
Bump(mob/M)
if (istype(M,/mob/characters))
Attack(M)
proc/Attack(mob/M)
var/damage = rand(1,strength)
if(usr.strength - M.defense > 0)
M.health -= usr.strength - M.defense
view(src) << "[src] Attacks [M] For ([damage])!"
else M << "[src] Bounces off you!", usr << "You Bounce off [M]"
slime // second monster!
icon = 'monsters.dmi'
icon_state = "slime"
strength = 7
health = 25
maxhealth = 25
defense = 2
mob/characters
verb
Attack(mob/M in oview(1)) // makes it so the monster is in the persons view by 1!
var/hitting = rand(1,3)
if(hitting == 1)
var/damage = rand(1,strength)
if(usr.strength - M.defense > 0)
usr << "You Punch [M] For [damage]!"
M << "[usr] Punches You For [damage]"
M.health -= usr.strength - M.defense
usr.Levelup()
else
M << "[src] Bounces off you!"
usr << "Your to weak, you bounce off the [M]"
if(hitting == 2)
var/damage = rand(1,strength)
if(usr.strength - M.defense > 0)
usr << "You Slice [M] For [damage]!"
M << "[usr] Slices You For [damage]"
M.health -= usr.strength - M.defense
usr.Levelup()
sleep(4)
else
M << "[src] Bounces off you!"
usr << "Your to weak, you bounce off the [M]"
if(hitting == 3)
var/damage = rand(1,strength)
if(usr.strength - M.defense > 0)
usr << "You Kick [M] For [damage]!"
M << "[usr] Kicks You For [damage]"
M.health -= usr.strength - M.defense
usr.Levelup()
else
M << "[src] Bounces off you!"
usr << "Your to weak, you bounce off the [M]"
mob/monsters
mob/proc/DeathCheck() // Death!
if(src.health <= 0)
src.health = src.maxhealth
usr.exp+=src.exp
usr.gold+=src.gold
view() << "[usr] won!"
del(src)
src.health = src.maxhealth
usr.exp+=src.exp
usr.gold+=src.gold
view() << "[usr] won!"
src.loc=locate(1,1,1)
mob/proc/Levelup() // Level Up Proc.
if(usr.exp>= usr.lvexp)
usr << "You Gained A Level!"
usr.exp = 0
usr.health+=5
usr.maxhealth+=5
usr.level +=1
usr.strength+=(rand(1,3))
usr.defense+=(rand(1,3))
If you are wondering this was from Raekwon's demo.
ID:149014
Jul 27 2002, 9:04 am
|
|
Jul 27 2002, 9:07 am
|
|
well the problem with them not dying is you have no death check, because you DELETED IT. you said so yourself... usually stuff won't die unless you have the deathcheck... ROFLMAO... Sorry, but the sarcasm was coming, you deserve it, you answered the question in your own question! I am SO sorry I am being mean, but this one I just can't hold back!!!!
|
In response to Ter13
|
|
When the deathcheck was there it said it was undefined
|
In response to Codesterz
|
|
most likely because you put it in the wrong place. DM Raerely messes up, it's faulty code.
this is a simple death check: mob proc death_check() if(src.hp<=0) if(!src.client) Del(src) return 1 else src.loc = locate(20,20,4) src << "You have died!" return 1 else return 0 and then you call it, BUT BE CAREFUL! ........ (if your attack proc) ........ if(M.armor<=src.attack) M.hp -= src.attack-M.armor M.deathcheck() ........ simple, it SHOULD work, if not, it is a teeny error. |
In response to Codesterz
|
|
There was probably some problem within the code.
Punkrock546 |
In response to Ter13
|
|
Still can't get it to work. Could u possibly put the code fixes into my code PLZ
|
I believe the problem is that you have your Attack() proc and whatnot as mob/monster, but your deathcheck is under mob/monsters. The spelling needs to be exact, or else it will not detect the proc.
|
In response to Codesterz
|
|
If you can't do it yourself, then you are just pathetic. I GAVE you the code, I DID NOT make it so that it would fit in with your current code, I made an example, I bet oyu copied and pasted... Look, I've seen you ask about every part of your game, from how do I set up a variable, to how do I attack stuff. JUST SLOW DOWN. You won't learn until you can fix your own errors.
|
In response to Ter13
|
|
Ter13 wrote:
If you can't do it yourself, then you are just pathetic. If you have nothing nice to say, then don't even bother trying to "help". I GAVE you the code, I DID NOT make it so that it would fit in with your current code, I made an example, I bet oyu copied and pasted... He already has a deathcheck in his code, so he didn't really even need yours. You won't learn until you can fix your own errors. That statement is entirely out of line. The whole purpose of the "Code Problems" forum is to help people fix their errors! |
In response to Malver
|
|
if it's syn. errors when copying and pasting, then I get pissed off.
|
In response to Ter13
|
|
Ter13 wrote:
if it's syn. errors when copying and pasting, then I get pissed off. Then provide code that fits in, or don't even bother. You aren't helping anyone by getting upset at everyone. |
In response to Ter13
|
|
Ter I spent hours trying to fix it before asking this. Believe me I would rather get it done than ask but hours is just to much.
|
Firstly, you've defined deathcheck() under mob/monster/mob, when it needs to be under mob/monster.
Secondly, you have both mob/monster and mob/monsters defined, which I doubt you wanted to do as they will be treated as two separate types of mob - the spelling needs to be exact, as Malver said. Finally, correct me if I'm wrong but I don't see deathcheck() being called anywhere. If it ain't called it won't run. :) |
In response to Crispy
|
|
Crispy wrote:
Finally, correct me if I'm wrong but I don't see deathcheck() being called anywhere. It sure is. Look at the second last proc in the code. :) |
In response to Malver
|
|
Malver wrote:
It sure is. Look at the second last proc in the code. :) Nope... I had a look, and I can see the proc being defined, but not called. There are two possibilities here: 1) I am selectively blind 2) Everyone else is smarter than I am 3) I can't read cyan coloured text (Nooo! My eyes! It hurts my EYES! :P ) Wait, that's three. See, that proves my second point! :P |