ID:1731706
 
(See the best response by Wild Bill Bartok.)
Error 1:
runtime error: Cannot read null.client
proc name: PLV Gain (/mob/proc/PLV_Gain)
usr: Tester the Bester (/mob)
src: Tester the Bester (/mob)
call stack:
Tester the Bester (/mob): PLV Gain(0.003, 1.1)
Tester the Bester (/mob): Melee Attack Gain(1)
Tester the Bester (/mob): Attack()


Error 2:
runtime error: Cannot read null.client
proc name: PLV Gain (/mob/proc/PLV_Gain)
usr: Tyrannosaurus Rex (/mob/Enemy/Tyrannosaurus_Rex)
src: Tester the Bester (/mob)
call stack:
Tester the Bester (/mob): PLV Gain(0.003, 1.1)
Tester the Bester (/mob): Melee Attack Gain(1)
Tyrannosaurus Rex (/mob/Enemy/Tyrannosaurus_Rex): Melee Attack()
Tyrannosaurus Rex (/mob/Enemy/Tyrannosaurus_Rex): Bump(Tester the Bester (/mob))


Code:
mob/Enemy/Bump(mob/A)
-snip-
spawn Melee_Attack()
--------------------------------------------
mob/proc
Melee_Attack()
for(var/mob/M in get_step(src,dir))
if(!attacking)
flick("Attacking",src)
if(M.monster) M.target=src
attacking=1
if(!MinuteBoost)
MinuteBoost=1
src.Melee_Attack_Gain(2)
spawn(600) MinuteBoost=0
src.Melee_Attack_Gain(5)
if(M.monster)
if(!M.MinuteBoost)
M.MinuteBoost=1
M.Melee_Hit_Gain(2)
spawn(600) if(M) M.MinuteBoost=0
M.Melee_Hit_Gain(5)
-snip-
------------------------------------------
mob/verb
Attack()
-snip-
if(M.monster) M.target=usr
attacking=1
if(!MinuteBoost&&!M.monster)
MinuteBoost=1
usr.Melee_Attack_Gain(2)
spawn(600) MinuteBoost=0
if(client) usr.Melee_Attack_Gain()
if(!M.MinuteBoost)
M.MinuteBoost=1
M.Melee_Hit_Gain(2)
spawn(600) if(M) M.MinuteBoost=0
if(M.client) M.Melee_Hit_Gain()
if(M.monster)
M.Melee_Hit_Gain(4)
-snip-
------------------------------------------
Melee_Attack_Gain(var/repeat=1)
if(repeat>1)
repeat-=1
src.Melee_Attack_Gain(repeat)
HitCounter+=1
if(ENR<MaxENR)
if(!dead||z==1)
else ENR+=((MaxENR/200)*EnergyRegen)
if(src.client)
var/GravityGain
if(CurrentGravity<=GravityMastered) GravityGain=(GravityMastered/10)+1
else GravityGain=(CurrentGravity/10)+1
src.PLV_Gain(0.003,GravityGain)
src.ENR_Gain(0.008)
if(STRENDfocus=="Balanced")
if(prob(15)) src.STR_Gain(0.015)
if(prob(10)) src.END_Gain(0.020)
if(prob(10)) src.SPD_Gain(0.007)
/*else if(STRENDfocus=="Strength")
if(prob(10)) src.STR_Gain(0.055)
if(prob(25)) src.SPD_Gain(-0.010)
else if(STRENDfocus=="Endurance")
if(prob(10)) src.END_Gain(0.056)
if(prob(25)) src.SPD_Gain(-0.010)*/

if(FORRESfocus=="Balanced")
if(prob(20)) src.FOR_Gain(0.003)
if(prob(20)) src.RES_Gain(0.003)
if(prob(10)) src.SPD_Gain(0.007)
/*else if(FORRESfocus=="Force")
if(prob(10)) src.FOR_Gain(0.02)
else if(FORRESfocus=="Resistance")
if(prob(10)) src.RES_Gain(0.02)*/

if(OFFDEFfocus=="Balanced")
if(prob(10)) src.OFF_Gain(0.037)
if(prob(10)) src.DEF_Gain(0.033)
if(prob(10)) src.SPD_Gain(0.007)
/*else if(OFFDEFfocus=="Offense")
if(prob(10)) src.OFF_Gain(usr,0.09)
else if(OFFDEFfocus=="Defense")
if(prob(10)) src.DEF_Gain(usr,0.09)*/

PLVGain+=GAININCREASE*5*LogoutBonus*GlobalGain
else if(src.monster)
src.PLV_Gain(0.003)
src.ENR_Gain(0.008)
if(prob(15)) src.STR_Gain(0.015)
if(prob(10)) src.END_Gain(0.020)
if(prob(10)) src.SPD_Gain(0.007)
if(prob(20)) src.FOR_Gain(0.003)
if(prob(20)) src.RES_Gain(0.003)
if(prob(10)) src.SPD_Gain(0.007)
if(prob(10)) src.OFF_Gain(0.037)
if(prob(10)) src.DEF_Gain(0.033)
if(prob(10)) src.SPD_Gain(0.007)
PLVGain+=GAININCREASE*5*GlobalGain
---------------------------------------
PLV_Gain(var/mult,var/GravityGain=(src.GravityMastered/10)+1) //calculates PLV gain
if(src.client) src.PLV+=mult*src.PowerRank*src.PLVGain*src.LogoutBonus*src.PLVMod*GravityGain*src.HTCMod*src.InexperienceMult*src.SparMult*(src.CarriedWeight+1)*GlobalGain
else src.PLV+=mult*src.PLVGain*src.PLVMod*src.InexperienceMult*src.SparMult*GlobalGain


Problem description:
Basically upon using Attack() on a mob or having a mob bump into me and Melee_Attack() me, it spits out this runtime error. For some reason it's not occurring every single time a mob bumps into me, but it is occurring every time I punch one of them.

I can't figure out why src would be null by the time it reached PLV_Gain. Is there something stupidly obvious I'm missing?

I left out the entirety of Bump(/mob), Attack(), and Melee_Attack() since I doubt those are causing the issue. I'm fairly certain the runtime is coming from either Melee_Attack_Gain(/var) or PLV_Gain(/var,/var) since it's happening with both. I can add them in if you think those are causing the problem.
Well, first thing I would look at is src.player. Did you mean src.client?
src.player is causing your error.
What is that exactly?
if it's something to signify that the person playing is indead a player and not an AI, then it means ALL mobs need to have a src.player var, not just 'players'/clients.
Also, this is way to complex.Complex = harder to troubleshoot.
I'd advise you to make the formulas much simpler for this otherwise you will always deal with a crap load of troubles / head aches.
'src.player' basically is a hardcoded 'src.client'. It's an old project I picked back up after a few years, so it has some outdated and otherwise poor logic. That has nothing to do with the problem though. 'player' was working perfectly fine. If anything, it was simply unnecessary, not problem causing.

So I went in and removed it.

runtime error: Cannot read null.client
proc name: PLV Gain (/mob/proc/PLV_Gain)
usr: Tester the Bester (/mob)
src: Tester the Bester (/mob)
call stack:
Tester the Bester (/mob): PLV Gain(0.003, 1.1)
Tester the Bester (/mob): Melee Attack Gain(1)
Tester the Bester (/mob): Attack()


src.player is causing your error
No it's not.

Also, what do you mean by making the formulas simpler? If you mean "src.PLV+=mult*src.PowerRank*src.PLVGain*src.LogoutBonus*src. PLVMod*GravityGain*src.HTCMod*src.InexperienceMult*src.SparM ult*(src.CarriedWeight+1)*GlobalGain" then you're looking in the wrong spot anyway. All it is is raw number calculations and has nothing to do with something that happens BEFORE it bugging out, and most definitely has nothing to do with src suddenly going null.
In response to Tokusentai
Tokusentai wrote:
'src.player' basically is a hardcoded 'src.client'. It's an old project I picked back up after a few years, so it has some outdated and otherwise poor logic. That has nothing to do with the problem though. 'player' was working perfectly fine. If anything, it was simply unnecessary, not problem causing.

So I went in and removed it.

> runtime error: Cannot read null.client
> proc name: PLV Gain (/mob/proc/PLV_Gain)
> usr: Tester the Bester (/mob)
> src: Tester the Bester (/mob)
> call stack:
> Tester the Bester (/mob): PLV Gain(0.003, 1.1)
> Tester the Bester (/mob): Melee Attack Gain(1)
> Tester the Bester (/mob): Attack()
>

src.player is causing your error
No it's not.

Also, what do you mean by making the formulas simpler? If you mean "src.PLV+=mult*src.PowerRank*src.PLVGain*src.LogoutBonus*src. PLVMod*GravityGain*src.HTCMod*src.InexperienceMult*src.SparM ult*(src.CarriedWeight+1)*GlobalGain" then you're looking in the wrong spot anyway. All it is is raw number calculations and has nothing to do with something that happens BEFORE it bugging out, and most definitely has nothing to do with src suddenly going null.

In regards to that i assumed that player was either a variable or a type cast, regardless of what it is, the error is self explanatory.

the mob doesn't EXIST when the proc is called.
more than likely whatever you were striking was deleted.
The mob still exists when the proc is called. The mob still takes damage and the mob still goes flying back, getting KO'd and still there for me to punch it to being dead.

The issue isn't so self-explanatory. The mob is still there, and thus somewhere in the procs the src goes null despite me making my best efforts to make every call to the proc either M. or src. (M. being the mob getting hit as opposed to the mob doing the punching)

Also, if you notice it calling 'Melee_Attack', that's the proc for the one DOING the attack gaining stats. That mob in question being the player, me.
In response to Tokusentai
The error is specifically telling you that null.player (in this case src.player - doesn't exist. that's what a null error is. null= nothing. So you should figure out why your src is disappearing. With all that code there's not much wonder why you're having a hard time.
I'm sorry I'm not making baby's first video game. I'd like to see you say that to Riot Games if they're having a bug.

Let me make things super simple for you, since you're the only one replying to the thread.

null.client doesn't exist
meaning src.client doesn't exist
meaning src doesn't exist
meaning src.PLV_Gain(/var,/var) isn't sending src despite me saying 'src.'

Make sense yet?
In response to Tokusentai
Tokusentai wrote:
I'm sorry I'm not making baby's first video game. I'd like to see you say that to Riot Games if they're having a bug.

Let me make things super simple for you, since you're the only one replying to the thread.

null.client doesn't exist
meaning src.client doesn't exist
meaning src doesn't exist
meaning src.PLV_Gain(/var,/var) isn't sending src despite me saying 'src.'

Make sense yet?

You are the one that doesn't make sense.
I told you what your issue is. This isn't my first go around either with fixing bugs. I spotted your issue yesterday, and I told you what the problem is, and also gave you an idea of how to fix it. Save your snide and rude remarks- you can't really get upset because your rip src isn't functioning right and you don't know how to fix it.

If you were that great at making games, you wouldn't be using rip code, and your attitude tells me that's probably not the case either.

the proc is attached to a mob.(if it even is a proc, it looks like it's a verb being called inside another verb if it's a verb that could be your issue), the only way a null error would occur is if the object you are trying to reference doesn't exist at the time you are trying to reference it.....what part of that don't you understand? You need to figure it out and find out WHY and judging from the looks of it you should straighten out your attitude , since it seems like I'm one of the few people actually willing to help you, and even then that's going to come to an end real soon.
In response to Tokusentai
P.S. Riot Games (whatever that is) wouldn't be using someone elses code that is (terrible btw) to make a game. That's why I suggested you clean it up. You have 40+lines there that ,if you were an able coder, you wouldn't need.
In response to Tokusentai
Tokusentai wrote:
The mob still exists when the proc is called. The mob still takes damage and the mob still goes flying back, getting KO'd and still there for me to punch it to being dead.

The issue isn't so self-explanatory. The mob is still there, and thus somewhere in the procs the src goes null despite me making my best efforts to make every call to the proc either M. or src. (M. being the mob getting hit as opposed to the mob doing the punching)

Also, if you notice it calling 'Melee_Attack', that's the proc for the one DOING the attack gaining stats. That mob in question being the player, me.

the only way a null error would occur is if the object you are trying to reference doesn't exist at the time you are trying to reference it

Like I just told you. The mob still exists.....what part of that don't you understand?
In response to Avidanimefan
Avidanimefan wrote:
I'm one of the few people actually willing to help you, and even then that's going to come to an end real soon.

That's the thing, you're not even helping. You were at the beginning when you said "It's caused by var/mob/player". So I removed player and as expected, player wasn't causing any issues. It still occurred from .client in the exact same way.

Then you said it's because src didn't exist. I then told you that it consistently shows up every time I punch the same mob that never goes nowhere but backwards. Unless there's something in there that deletes the mob and brings the mob back (that's not even snide, I'm being serious) or something like that, then there's no way for the mob to be null at the time the proc is called.

Aside from those two 'fixes' that never even fixed anything, you contributed nothing to this thread but repeating yourself and pointless (and rather ignorant) flaming.
Alright listen, obviously somewhere in your code src became null. Debug it and find what line causes the src to become null or deleted src causing it to become null.

What Avidanimefan said was correct. So stop giving them a hard time because you cannot figure out whats wrong with your ripped code.

FYI: Most ripped source code is riddled with errors on purpose so people wont use the code. But still, people get on the forums asking the same old question.
In response to Lundex
Lundex wrote:
Alright listen, obviously somewhere in your code src became null. Debug it and find what line causes the src to become null or deleted src causing it to become null.

What Avidanimefan said was correct. So stop giving them a hard time because you cannot figure out whats wrong with your ripped code.

FYI: Most ripped source code is riddled with errors on purpose so people wont use the code. But still, people get on the forums asking the same old question.


1) I've been trying to debug it (at first I thought you meant a built in debug feature). I'm not new to programming, just programming in BYOND, I simply can't figure out where src would suddenly become null, and apparently none of you guys can either. I've posted all code related to PLV_Gain(/var,/var) and I've told you guys what all is happening to the mob, and you still keep saying the mob got deleted. It wasn't. It still exists as clear as day.

2) What Avidanimefan said wasn't correct. He's just senselessly trolling by now seeing as he defaulted to the 'hur dur ripped' argument.

3) It's not ripped. I've been working on it for a while and when I decided to start weeding out senseless repetition of chunks of code or algorythms, I decided to start condensing it with procs so I'm not repeating myself over and over again for the prior or so if I'm balancing the combat system, I only need to edit one thing. It's actually the first thing that's come by way that's gotten me stumped, therefore I came here.

Not really sure why everyone is saying it's ripped.
Sorry If I say this, your an idiot for making senseless argument to people who trying help.
Avid is correct, and it is src.player.
Also I want you look into your attack() you might find something their.then make plv_gain() cleaner.
Best response
You are relying on the default var passing (src and usr) far too much, so your code will inevitably be fragile and you will spend hours debugging things like this.

If a proc expects certain arguments, stop wasting your time and just pass them explicitly.
In response to Wild Bill Bartok
DarkNinjaNaut wrote:
Sorry If I say this, your an idiot for making senseless argument to people who trying help.
Avid is correct, and it is src.player.
Also I want you look into your attack() you might find something their.then make plv_gain() cleaner.

I already said that it's not 'src.player' since I removed src.player in its entirety and it continues to do it except with 'src.client'. I, too, mentioned this earlier in the thread.

Will do on looking into Attack(), but PLV_Gain(/var,/var) is as clean as it can get. The only 'mess' is the calculation to get the mod on the stat's gain itself, which while it might cause problems down the road, it isn't causing the problem here. All PLV_Gain() does aside from the algorythm is:

PLV_Gain(/var,/var)
if(src.client) //num based algorythm 1
else //num based algorythm 2


If there is a problem, it's outside of PLV_Gain() or the call to PLV_Gain() itself. Like you said about Attack(), I'll look into that more closely.

Wild Bill Bartok wrote:
You are relying on the default var passing (src and usr) far too much, so your code will inevitably be fragile and you will spend hours debugging things like this.

If a proc expects certain arguments, stop wasting your time and just pass them explicitly.

I will admit, I am relying on src and usr passing on default reliably, but I expected it to work reliably. I suppose the issue is the fact that it isn't entirely stable at passing src and usr. I was thinking of just resorting to passing the mob through manually since that isn't really that difficult, I was just hoping to make things simpler by not passing src/usr every single time I do something.

Also, since I didn't know it wasn't reliable, I figured the problem was more than just "It doesn't pass src/usr reliably" so that's why I posted here.
In response to Wild Bill Bartok
Yeah, it simply wasn't passing src despite calling 'src.PLV_Gain()' explicitly. Like I said, I was saving passing it manually as an absolute last resort since I figured that was unnecessary when coding with Dream Maker, and I didn't want to potentially leave in a bug that was greater than just 'it doesn't pass src consistently'. Thanks.
In response to Tokusentai
Tokusentai wrote:
Yeah, it simply wasn't passing src despite calling 'src.PLV_Gain()' explicitly. Like I said, I was saving passing it manually as an absolute last resort since I figured that was unnecessary when coding with Dream Maker, and I didn't want to potentially leave in a bug that was greater than just 'it doesn't pass src consistently'. Thanks.

So basically you just wanted someone to solve the problem for you. Got it. Also just for the record, I mentioned the exact same thing as the guy you voted best answer. You were just too busy arguing to pay attention. *whistles and walks off post*
Page: 1 2