ItemFlag[4] for the ON animation and ItemFlag[5] for the OFF animation:-First, we will create a function for the amendments we want for this new custom switch:
function customisedSwitch()
local customSwitch = GetMoveableByName("lever_switch_40") -- Get which switch you want to add custom animations to.
-- The next section is where we define the two animations
local switchOn = 100 -- Lara's Animation number
local switchOff = 200 -- Lara's Animation number
-- Finally we will change the code to link up the animation changes to the switch.
customSwitch:SetItemFlags(switchOn,4)
customSwitch:SetItemFlags(switchOff,5)
end
-- Now we have the function, we can ask the engine to run it when the player loads the level.
LevelFuncs.OnStart = function()
customisedSwitch()
end
-- code: Stranger1992. 19/03/24 Users can assign custom animations to a switch: