PDA

View Full Version : Accessed Nones - Techniques to Fix?


Eyegore
8th Dec 2003, 09:01 AM
Hi all,

I have been experimenting with Unreal script now for about a month, and with decent result, but I was wondering what techniques you all use to track and fix accessed nones?

For example, I have made a sniperrifle whose fire class is a modified version of the lightninggun fire, to make it more like a regular sniperrifle.

It works fine, but I am getting sporadic accessed nones in the DoTrace function and I am haveing trouble tracking them down.

I'm not asking for the answer, I'd like to figure it out myself, but I was hoping that maybe someone could point me in the right direction to take a look at this. As the code is mostly lightninggun code, I haven't really made drastic changes, which is why it seems so strange.

Thanks for any advice you may have.

Kangus
8th Dec 2003, 11:04 AM
Acessed Nones are generally caused by casting classes as things they are not and trying to access variables in them, or from trying to access a variable in sopmething that did not spawn properly. The best way to track them down is to make sure there aren't still references to the SniperRifle class (the lightning gun), or the SniperFire class.

To track down the approximate locations of specific ones, look at the error line in the log where you found it.For example:
Warning: MyGun CTF-Face.MyGun (Function MyPackage.MyGun.CreateSuperFX:0042) Accessed None
This accessed none is being caused by something somewhere in the CreateSuperFX function in the MyGun class.

Hope this helps.

Eyegore
8th Dec 2003, 11:36 AM
OK! I'll check that out - Thanks

I do get Accessed Nones not terribly often, but I want to get rid of all of them.

Now, one more question having to do with accessed nones, though it's not really a 'how to fix' but rather just asking to see if this happens to ayone else:

When I use the Traslocator camera I get this:


Warning: TransLauncher DM-Inferno.TransLauncher (Function XWeapons.TransLauncher.ViewPlayer:0097) Accessed None

This occurs in every map, and it is obviously in the ViewPlayer function of the TransLauncher, but I'm wondering - Is this something I can fix? Obviously, I don't mean to rewrite the code, but is this a bug in the game code itself that someone else has experienced?

I tried to reinstall the game - to no avail. My friends don't seem to get this error on their machines. I'm wondering if a configuration on my PC could be causing this?

I'll let you know how it goes with my Sniper Rifle - Thanks again for the advice!!

Kangus
8th Dec 2003, 12:16 PM
nope. If its not related to your code, you can't fix it. Acessed nones aren't so big a deal you need to worry about them, unless your code is causing a boat load of them.

Eyegore
8th Dec 2003, 12:22 PM
Sounds good then!

Kangus, thanks a lot for your help!!

EvilDrWong
8th Dec 2003, 07:57 PM
One method i use to track down AN's is to put a log every other line, like so
function bool ReturnFalseOrTrue(int Integer, float Float, string Cornwallace)
{
log("1");
Integer+=int(Float/36);
log("2");
Integer*=pawn(Owner).Health;
log("3");
if(Integer<6)
{
Log("Integer:"@Integer@"is less than 6");
return False;
}
else
{
Log("Integer:"@Integer@"is more than 6");
return True;
}
}

as you can see, it helps to identify any problem area by sticking all of the accessed none's and warnings between your own scriptlogs. Granted, itll run a bit slower... but in the case of bughunting speed doesnt really matter so much ;)

Eyegore
9th Dec 2003, 09:00 AM
Thanks EvilDrWong - that's what I did and I found the problem - the TraceRange setting was too short, so if you missed and your aim was set really far away like the sky or those spires in CTF-Magma, 'Other' was set to None. All that was needed was to extend the range of the trace. I don't know if this is a 'proper' fix... I suppose in the case of the lightninggun there is a contigency in place to set a max trace range at 17000.000000 and place an actor there so it won't return a None, however, I don't understand how as the line that sets 'Other'


Other = Trace(HitLocation, HitNormal, End, Start, true);


which occurs in the same place as in the 'my' code (my code actually being their code, without all the reflection stuff), yet their's doesn't return none if you hit empty space.

Since I am new to Unreal script, this lack of understanding does not come as a surprise. I plan on making a class that uses their sniper fire code peppered with log entries to trace the flow of it all - then I'll be able to figure out how they can hit nothing and not return a none, or if they do return none, how to keep it from erroring out.

Thanks for your advice - I'm really quite happy with what I have learned so far - now all I have to do is figure out how to achive my own unique weapons and fire styles.

EvilDrWong
9th Dec 2003, 11:20 AM
IIRC traces will return none if they hit world geometry, such as a static mesh or a bit of BSP. Instead of trying to rely on Other being something, check right after the trace to see if you actually hit something

if(Other!=None)

Then anything you try and do to 'Other' should go across smoothly and not pump out errors like nobody's business.

Eyegore
9th Dec 2003, 09:18 PM
You know, I tried that and I still got the error - but, I deleted this line


Log("OtherName: " $Other.GetHumanReadableName());


from when I was trying to track the AN down... And all is well!!

It took me a 0.5 hours to figure to figure that one out:rolleyes: Duh...

Thanks for the tips! I really appreciate it!