Author Topic: Cancelling a function  (Read 2844 times)

Whenever I leave the vehicle, I get this warning in the console:
Code: [Select]
Add-Ons/Vehicle_KeiCarRacing/KeiCarRacing_Sounds.cs (54): Unable to find object: '' attempting to call function 'getDataBlock'
BackTrace: ->Armor::doDismount->[HandsOnVehicleSupport]Armor::onUnMount->[KeiCarRacing_EngineSounds]Armor::onUnMount

Whats the reason for this?  When you unMount it doesn't know what object you just unMounted from so it has to backtrace?  Is there an easy way to fix it?

Check if %col is an object before you do things with it. Other than that, I haven't dealt with this kind of issue before, so someone else might fill me in with more info of what you could do.

Check if %col is an object before you do things with it. Other than that, I haven't dealt with this kind of issue before, so someone else might fill me in with more info of what you could do.
Checked it and %col is indeed an object.

I got a bit curious of the method now, and I found out the following:
How does the method declaration look like? You got four arguments with %col as third and %slot as fourth. When looking at Badspots code, that is indeed correct. But all other Add-Ons I've taken a look at seem to ignore the %col and just put %slot as third. I did some small traces with default Add-Ons and apparently on both onMount and onUnMount it gives a 0 on the third argument. I assume that if we're using the %slot it will use the second argument %obj to get the mounted object with %obj.getMountedImage(%slot) and then get the datablock on that one.

Of course, I'm only speculating about how it really works, but I got no idea why you even would want to have a %col variable, when it might even be an ItemImage, and therefore an %image variable. And %obj is just an Armor, so that could be %player instead.