Ok I've had these for a while and I'm getting annoyed by them. Whenever a player kills a mob with a macro on it causes tons of runtime errors. How do I get rid of them? I'm thinking about adding a delay or something but how do i do that?
Alienman
P.S. I don't want people to not be able to use marcos I just want it to have a delay.
ID:178141
![]() Jun 15 2002, 5:14 am
|
|
runtime error: Cannot read null.Health
proc name: Attack (/mob/verb/Attack) source file: obj.dm,58 usr: \[Creator/Master GM]Alienman (/mob/HarvestMoonDude) src: \[Creator/Master GM]Alienman (/mob/HarvestMoonDude) call stack: \[Creator/Master GM]Alienman (/mob/HarvestMoonDude): Attack(null) Thats it |
Alienman22774 wrote:
runtime error: Cannot read null.Health Well, from what I can see your problem is occuring on line 58 of your obj.dm file. Paste what is on line 58 of your obj.dm file so I and others can see or at least find out whats wrong. --Lee |
verb
Attack(mob/M as mob in oview(1)) usr << "You attack [M]!" var/damage = Strength view(6) << "at [damage] damage!" M:Health -= damage if(usr.Health<=0) src.Health=src.MaxHealth src.loc=locate(33,24,1)//Change these numbers to the location you want the defeated person to go after he/she dies Levelup()//This calls the Levelup proc as defined in the other file M:DeathCheck() DeathCheck() I'm pretty sure this is it. The Attack Verb |
Alienman22774 wrote:
verb Which is line 58? |
Alienman22774 wrote:
I'm not sure exatcly I think its the Death Check So you have fixed the runtime error now? If so, good on you :) --Lee |
Alienman22774 wrote:
oh i think i see it. if(usr.Health<=0) needs to be Well, I don't really think that changing the "0" to "1" will do anything there. I haven't use "Attack" verbs in a while but let me have a think about this one ;) Try making the "var/damage = Strength" to "var/damage = usr.Strength". --Lee |
still getting the Runtime errors and now the mobs kill me in one hit. I think it gave the mobs my Str.
|
Alienman22774 wrote:
still getting the Runtime errors and now the mobs kill me in one hit. I think it gave the mobs my Str. Hmm... Well, seing as I don't really know whats wrong, why don't you just copy your full attack code and your deathcheck code as that might make things alittle more clearer for me. |
verb
Attack(mob/M as mob in oview(1)) usr << "You attack [M]!" var/damage = Strength view(6) << "at [damage] damage!" M:Health -= damage if(usr.Health<=1) src.Health=src.MaxHealth src.loc=locate(33,24,1)//Change these numbers to the location you want the defeated person to go after he/she dies Levelup()//This calls the Levelup proc as defined in the other file M:DeathCheck() DeathCheck() proc DeathCheck() if (Health <= 0) loc = locate(1,1,3) Health = MaxHealth usr << "[src] has died!" for the mob i'm attacking when testing the Death Check is.. DeathCheck() if (Health <= 0) usr << "[src] has died!" usr.gold+=2 usr<<"U found 2 Gold!" usr.Exp+=30 usr<<"U got 30 experience points!!" del(src) I have a Death Check for all my mobs because every mob gives something different. |
Alienman22774 wrote:
verb You have two of the same DeathCheck() procs...Why? |
I have one Death Check for each mob. That way if a Monkey you kill gives you 50 Exp points a Demon you kill gives you 200 Exp points. It just helps me organize code.
Alienman |
It would be easier to use one proc and check the mob with istype() for certain stat boosts. As for the runtime error ir's caused when a mob tries to attack a mob that isn't there anymore (usally when a macro buffer reaches it's end after the mob is dead) so you'll need a delay:
mob |
I get a bunch of Inconsistent Indentation errors which when i fix it gives me a TON of different errors. How would i just add that into my attack verb i already have?
|
Just to give a broad sweep over the problems you're having:
if(!M) return // e.g., if it was trying to read M.Health Put lines like that at the beginning of your proc, and after a sleep or spawn if there's a chance something else might delete the mob in the meantime.
|
Could you paste the runtime errors your are getting in here please?
--Lee