![]() |
![]() |
#11 | ||
Hobbyist
Join Date: Jun 2022
Location: Behind You
Posts: 66
|
![]()
Hello! I am here to show you how to replicate the wait() function from Roblox. It's a commonly used function in roblox as it allows for easier coding of certain things in that game engine.
What is the wait() function? Very simple. It takes the time you put as the argument inside, and it "pauses" the code from running further. So, you can have something happen, use wait(5) { progressing five seconds }, and then something else. Let's get started with a quick example of how you can do something similar Quote:
This is the starting base for our code. The level layout doesn't matter, neither goes the other .lua files for this tutorial. I set the FOV to 105 for personal preference. Here is the code you could use for this replication: Quote:
The TriggerExample function makes a boolean variable become true, and thus our if statements in the control phase function can run. When that gets triggered, it start incrementing another variable by 1 according to the 30 fps framerate. - 5 seconds would be 150 frames, so that's what we do for the first one, where we set Lara's health to 10 as an example. After another 5 seconds Lara explodes as the variable is 300.
__________________
< You must break the cycle, or the loop will repeat tommorow. > |
||
![]() |
![]() |
![]() |
#12 |
Historian
Join Date: Dec 2018
Location: Russia
Posts: 434
|
![]()
this is all great, but how to do without scripting, and for example with the help of the node editor to do for example: opening doors after a certain time, and then so that the fire is lit after some more time, etc. etc....
Lua may be a good language, but I don't really want to study it thoroughly. (I barely understood how to assign names to objects at the level (well, keys, etc..)) Last edited by vasatomb; 15-03-23 at 19:04. |
![]() |
![]() |
![]() |
#13 | |
Explorer
Join Date: Nov 2019
Location: Polska
Posts: 772
|
![]() Quote:
Ask questions on the general forum threads
__________________
Chronicles Lara: "Whatever" |
|
![]() |
![]() |
![]() |
#14 |
Hobbyist
Join Date: Apr 2013
Posts: 36
|
![]()
This is an update of the ammo counter
This counter displays the ammo available for the weapon being wielded. If the ammunition is infinite it displays "infinite". This part of code can be inserted at the end, under the functions .ON The AddCallback function will cause the values of the munitions to update automatically Code:
--customization-- local color = Color(0, 255, 128) local x = 1.8 local y = 6.2 local text = 'Ammo:' ---- local halfwayX, halfwayY = PercentToScreen(x, y) local ammoMessage = DisplayString('', halfwayX, halfwayY, color, false) LevelFuncs.__ShowAmmoCounter = function() if Lara:GetHandStatus() == 4 then if not (Lara:GetAmmoCount() == -1) then ammoMessage:SetKey(text .. ' ' .. Lara:GetAmmoCount()) else ammoMessage:SetKey(text .. ' Infinite') end ShowString(ammoMessage) else HideString(ammoMessage) end end AddCallback(TEN.Logic.CallbackPoint.POSTCONTROLPHASE, LevelFuncs.__ShowAmmoCounter) It is possible to customize the counter:
Examples of customization (click to open image) ![]() ![]() Last edited by DaviDM; 18-04-23 at 11:46. |
![]() |
![]() |
![]() |
Thread Tools | |
|
|