Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Quick Reply
Search this Thread
Instructor
Original Poster
#1 Old 9th Aug 2015 at 6:27 AM
EventListener Regarding Boats
Hi everyone In an attempt to add a fuel count for boats, I am looking into handling the kUsedVehicle event for Boats. However, from this code inside Vehicle class:
Code:
public virtual void OnCarEntered(Sim s)
		{
			if (!(this is Boat))
			{
				EventTracker.SendEvent(EventTypeId.kUsedVehicle, s, this);
			}
...


Apparently, with comparison searching on the EventTypeId on NRaas, no events handle boats. It is actually a simple solution, to override this part (as it is marked "virtual") so that an Even is sent nonetheless. But what concerns me, is that I think EA has a reason to disable the SendEvent for boats (or do they???? )
Do you guys know if EA coding actually uses Event Listeners? (If no, that means they are only used by we modders, and that means EA behaviour won't be touched!)

Thanks
Advertisement
Field Researcher
#2 Old 9th Aug 2015 at 3:23 PM
Pretty sure the main purpose of the event system in the game is to track whether wishes are fulfilled or not. But if you're planning on overriding the method in the first place, why not have your new method directly call for the code you have written to run when the kUsedVehicle event is sent?
Instructor
Original Poster
#3 Old 10th Aug 2015 at 1:44 PM
Thanks @icarus_allsorts, it really clears up my stuck mind, but I find overriding a game class really troublesome, what is actually a proper way to do so? Do I inherit from Vehicle? And it says I need to "actualize" all the methods present in the inherited Vehicle class, eg CarTuning, and I don't know what value to return. I guess that I'll stick with EventListeners, since just doing all the stuff for boats is mad.
Field Researcher
#4 Old 10th Aug 2015 at 3:02 PM
It sounded like you were planning to make custom versions of each of the existing boat classes overriding that particular method, and then editing the all the boat OBJKs to use your custom classes instead. Hopefully you find a better way to achieve what you need though. Good luck
Instructor
Original Poster
#5 Old 11th Aug 2015 at 2:28 AM
That works but originally I thought I could simply override a method in the base class. OBJK override is obviously feasible so I have to try!! Much thanks and welcome back to the forums, you seem to be only lurking around for some time.
Back to top