Community Forum

Adding specialization

Forum Overview >> Scripting

CategoryScripting
Created17.08.2019 09:27


Paul Laverick (Unknown) 17.08.2019 09:27
Hello. I have a little script and it adds a specialization to various vehicle types. I having a hard time converting it from FS17. By looking at other scripts I have found various methods. I seem to of successfully registered to specialization, but the LUA code doesn't seem to run. The update and draw subs don't trigger. I am going to look through more mods, but just wondering if anyone had a know good code. I will add my code later as I am not on my FS19 pc currently. Many thanks

Bilbo Beutlin (BBeutlin) 25.08.2019 19:56
If your mod's functions don't get triggered, you didn't register them properly.

----- examples -----
function myMod.registerEventListeners(vehicleType)
-- register the functions which should be triggered
SpecializationUtil.registerEventListener(vehicleType, "onRegisterActionEvents", myMod);
SpecializationUtil.registerEventListener(vehicleType, "onLoad", myMod);
SpecializationUtil.registerEventListener(vehicleType, "onUpdate", myMod);
end;

function myMod:onRegisterActionEvents(...)
-- here you register actionBindings/keys
end;
----------

The function 'registerEventListeners()' you call once after you have inserted the custom spec into vehicle spec list.


Note: Log in to post. Create a new account here.