Infinite Boulder - Tomb-Raider-Level-Editor/Tutorials GitHub Wiki
spawner = GetMoveableByName("Boulder_spawner")
boulder = Moveable(TEN.Objects.ObjID.ROLLINGBALL, "boulder", spawner:GetPosition())
LevelFuncs.OnStart = function()
boulder:MakeInvisible()
end
LevelFuncs.BoulderSpawn = function()
boulder:Enable()
end
LevelFuncs.resetBoulder = function()
boulder:SetPosition(spawner:GetPosition())
end
spawner = GetMoveableByName("Boulder_spawner")
boulder = Moveable(TEN.Objects.ObjID.ROLLINGBALL, "boulder", spawner:GetPosition())
this block declares and initializes 2 variables:
- spawner variable which gets the moveable by its lua name set in Tomb Editor. In this case it's "Boulder_spawner" and a nulllmesh (doesn't matter which slot)
- Boulder variable which creates a new boulder via the Moveable() function. To learn more about this function, read here: https://lwmte.github.io/2%20classes/....html#Moveable
LevelFuncs.OnStart = function()
boulder:MakeInvisible()
end
LevelFuncs.BoulderSpawn = function()
boulder:Enable()
end
LevelFuncs.resetBoulder = function()
boulder:SetPosition(spawner:GetPosition())
end
The OnStart command will make the boulder invisible since the engine will make the boulder visible so I made it invisible, however you don't have to do this if you don't want to.
Boulderspawn function will simply trigger the boulder.
ResetBoulder will reset to its initial position using the nullmesh.
Setup in TE
To set this up you need:
- nullmesh from any slot
- 2 volumes
in my test level this looks like this:
the nullmesh at the top acts as a boulder "spawner", the volume to the right makes the boulder trigger (activated by lara), the volume at the bottom resets the boulder position (activated by Other objects - we do not want Lara to reset the position of boulder).
Let's see how this looks in game!
Notes:
- You don't have to use the moveable() function to create the boulder, you can just place it in TE, however there are scenarios that moveable() can be very useful and used in an interesting way.