- Code: Select all
--thanks to nschichan for documentation on the usage of require(), see: http://forums.uktrainsim.com/viewtopic.php?f=366&t=136148#p1687192
--original_Script is a string variable that we assign the file path between two quotation marks " "
original_Script = "Assets/RSC/Class52Pack01/RailVehicles/Class_52/AP/Scripts/c52-main.lua";
require(original_Script);
-- store legacy functions before redefining them, although I think you'd only need to redefine Initialise and Update for particles
old_Initialise = Initialise;
old_Update = Update;
function Initialise()
old_Initialise()
--turn on and off the various emitters as required
Call("BeginUpdate");
end
function Update(time)
old_Update(time)
--code to control the particles, you could include some of the ideas from earlier in this thread
end
--extra function for turning on emitters without needing to retype the long call function
function EmitterOn(name)
Call(name..":SetEmitterActive", 1);
end
--same as the above, but for turning emitters off instead
function EmitterOff(name)
Call(name..":SetEmitterActive", 0);
end
Chris