So i'm currently working on a scenario and i want to utilize the cinematic camera in this case i named my trigger function Intro. I also have 3 key frames what would i enter in for the LUA script?
yes the camera sequence has been setup. and is functional i just need to script it for it to work. I'm typically not good with lua scripit
The camera needs to be named, firstly, using this small box. The player's first instruction must be a trigger instruction, name it something (small box above the large one). This is the LUA script you need: -- true/false defn FALSE = 0 TRUE = 1 -- condition return values CONDITION_NOT_YET_MET = 0 CONDITION_SUCCEEDED = 1 CONDITION_FAILED = 2 -- Message types MT_INFO = 0 -- large centre screen pop up MT_ALERT = 1 -- top right alert message MSG_TOP = 1 MSG_VCENTRE = 2 MSG_BOTTOM = 4 MSG_LEFT = 8 MSG_CENTRE = 16 MSG_RIGHT = 32 MSG_SMALL = 0 MSG_REG = 1 MSG_LRG = 2 function OnEvent(event) return _G["OnEvent" .. event](); end function TestCondition(condition) return _G["TestCondition" .. event](); end function OnEventStart() SysCall("ScenarioManager:LockControls") SysCall("CameraManager:ActivateCamera", "startcamera01", 0) end For the purposes of this, the trigger instruction was called "Start", and the camera was named "startcamera01". Alternatively, I was just reminded that I did a (arguably very long-winded) tutorial on this sort of thing a few years ago: (skip to 15:08 if it doesn't automatically take you there). The video concerns multiple camera shots, if you're doing more than one.
It works! thanks a bunch, one quick question do you also have a HTML lua script file plan on saving this for future work
oh damn I forgot about that: function OnEventStart() SysCall("ScenarioManager:LockControls") SysCall("CameraManager:ActivateCamera", "startcamera01", 0) SysCall("ScenarioManager:TrigerDeferredEvent", "UnlockControls", #) end function OnEventUnlockControls() SysCall("ScenarioManager:UnlockControls") end replace the # with however long the camera sequence is in seconds. I have a template LUA script kicking around somewhere. I'll try and find it.
Yes, that'll be because I forgot to include the unlock controls command. I've found the template, but I've had to upload it in .txt format because it (understandably) wouldn't let me upload it as a LUA script. Remember to save it as a LUA file if you use it. Feel free to use & distribute it. There is a way of using HTML in LUA scripts for messages: http://trainsimlive.blogspot.com/2015/02/ts2015-scenario-scripting-in-lua-part-3.html
Okay so i entered 12 seconds watched the sequence entered it and once it completes i can't even close the game i'm stuck on a external view
this is what i currently have -- true/false defn FALSE = 0 TRUE = 1 -- condition return values CONDITION_NOT_YET_MET = 0 CONDITION_SUCCEEDED = 1 CONDITION_FAILED = 2 -- Message types MT_INFO = 0 -- large centre screen pop up MT_ALERT = 1 -- top right alert message MSG_TOP = 1 MSG_VCENTRE = 2 MSG_BOTTOM = 4 MSG_LEFT = 8 MSG_CENTRE = 16 MSG_RIGHT = 32 MSG_SMALL = 0 MSG_REG = 1 MSG_LRG = 2 function OnEvent(event) return _G["OnEvent" .. event](); end function TestCondition(condition) return _G["TestCondition" .. event](); end function OnEventStart() SysCall("ScenarioManager:LockControls") SysCall("CameraManager:ActivateCamera", "startcamera01", 0) end function OnEventStart() SysCall("ScenarioManager:LockControls") SysCall("CameraManager:ActivateCamera", "startcamera01", 0) SysCall("ScenarioManager:TrigerDeferredEvent", "UnlockControls", 12) end function OnEventUnlockControls() SysCall("ScenarioManager:UnlockControls") end
remove this bit Other than that, it looks fine, but you may wish to add a statement to change the camera to the cab and display a message (just makes it look cleaner)
-- true/false defn FALSE = 0 TRUE = 1 -- condition return values CONDITION_NOT_YET_MET = 0 CONDITION_SUCCEEDED = 1 CONDITION_FAILED = 2 -- Message types MT_INFO = 0 -- large centre screen pop up MT_ALERT = 1 -- top right alert message MSG_TOP = 1 MSG_VCENTRE = 2 MSG_BOTTOM = 4 MSG_LEFT = 8 MSG_CENTRE = 16 MSG_RIGHT = 32 MSG_SMALL = 0 MSG_REG = 1 MSG_LRG = 2 function OnEvent(event) return _G["OnEvent" .. event](); end function TestCondition(condition) return _G["TestCondition" .. event](); end function OnEventStart() SysCall("ScenarioManager:LockControls") SysCall("CameraManager:ActivateCamera", "startcamera01", 0) SysCall("ScenarioManager:TrigerDeferredEvent", "UnlockControls", 12) end function OnEventUnlockControls() SysCall("ScenarioManager:UnlockControls") end So i got this now and still nothing save scenario and nothing happens
Have you compiled it in the editor? Save the script, then in TS, press this: Click reload then compile/generate MD5