lotus006 wrote:Patch note 2 : Enjoy Final Release LsBreathMeter2.A.zip https://drive.google.com/open?id=0B9Yha ... HZSbHlvV1k
> Hud go back to the other player and show incorrect air value [Fixed]
> Remasterised Hud for better performance [Updated]
> Lua code improved and optimised again [Updated]
--------------------------------------------------------------------------------------------------
New Stuff
> Added API command for adjusting and control Breath time and/or can be Enabled or Disabled now [Added]
> Added Button "CTRL" for invisible flooding the level to test easier the API [Added]
You need to put this into your lunaworld from the episode wanted. or in the folder battle for Battle Mode
CODE: SELECT ALL
local LsBreathMeter = API.load("LsBreathMeter"); -- Thanks to Enjl , it's fixed
Put this on onLoad section ( OPTIONAL Not needed if you wont change thing... ) Sorry forgot to say.
CODE: SELECT ALL
function onStart() -- Fixed Also ,thanks again Enjl
LsBreathMeter.AirMultiplierP1(Multiplier) -- Settings API for Adjusting Time decreasing of the Breath --> 1 or less decreasing slower, 1 and more decreasing faster.
LsBreathMeter.AirMultiplierP2(Multiplier)
LsBreathMeter.hudBreath(true/false) -- Enable/Disable API
LsBreathMeter.ControlFlood(true/false) -- Enable/Disable Flooding level (invisible flooding) for both player when pressing CTRL , if Disabled CTRL dont flood
end
Misc --> put this IF YOU WANT TO USE WITH YOUR API, or else not needed ... into your API to access on the Air time for player(s) wanted
CODE: SELECT ALL
LsBreathMeter = loadSharedAPI("LsBreathMeter");
[ Note : should be on onTick() or onLoop() ]
CODE: SELECT ALL
LsBreathMeter.ReturnAirTimeP1()
LsBreathMeter.ReturnAirTimeP2()
function updateOxygen(timer)
oxygen = math.abs(math.ceil((timer / 65) / 3))
end
It's usually bad practice in any language to have long chains/blocks of code like the if statements you had so keep that in mind in the future. Besides that though this looks pretty useful, nice work!
Re: [LunaLua] Time limit to stay underwater
Posted: Sat Jan 16, 2016 5:55 am
by zxcv
Thanks AeroMatter, I make no idea of what those math functions do, but I will study it
EDIT: Ok, I know what they do now, using a calculator I understood your code, but how to discover what numbers use?
I mean, how to know that I have to use 65 and 3 ?
EDIT 2: I understood everything now! Divided by 65 because the timer = 30*65, then divided by 3 to get the value between 0 and 10! Thank you for this!
Super Mario 64 power meter coming in next update!
Re: [LunaLua] Time limit to stay underwater
Posted: Sat Jan 16, 2016 9:05 am
by aero
Prado wrote:Thanks AeroMatter, I make no idea of what those math functions do, but I will study it :)
EDIT: Ok, I know what they do now, using a calculator I understood your code, but how to discover what numbers use?
I mean, how to know that I have to use 65 and 3 ?
EDIT 2: I understood everything now! Divided by 65 because the timer = 30*65, then divided by 3 to get the value between 0 and 10! Thank you for this!
No problem.
What you did here for your second edit though is a good first step because you basically figured it out on your own, and can apply the same reasoning to other situations.
I will be busy now making my CC12 level, but after this I will return to work!
Re: [LunaLua] Time limit to stay underwater
Posted: Tue Feb 23, 2016 8:18 am
by mariofan 64
Hey, will there be the timer upgrade?
Also, is it ok if I can use this in a project? I'd appreciate it because it would seem odd if one spent 5 minutes in water doing water puzzles when you can have land portions to levels as well.
Re: [LunaLua] Time limit to stay underwater
Posted: Tue Feb 23, 2016 5:05 pm
by zxcv
mariofan 64 wrote:Hey, will there be the timer upgrade?
Also, is it ok if I can use this in a project? I'd appreciate it because it would seem odd if one spent 5 minutes in water doing water puzzles when you can have land portions to levels as well.
Use it on whatever you want! And the update... I don't know if I'm going to make it, because I'm wasting a lot of my free time studying C++, but ocasionaly I can make it. Sorry for this.
Re: [LunaLua] Time limit to stay underwater
Posted: Sun Feb 28, 2016 6:32 am
by lotus006
Hi Prado I remake from scratch your Air Timer breath and just wanna know if it's ok for you if I continue this one instead ?
If any one have other idea what to add dont hesitate if Prado it's ok for you ? ( I never tried your api but you make me want to try to do one )
PS: the idea credit come from you
Maybe I can add Mario 64 hud
Re: [LunaLua] Time limit to stay underwater
Posted: Sun Feb 28, 2016 7:32 am
by zxcv
It's ok!
I would apreciate very much if someone continues the idea, since I am busy studying C++
Re: [LunaLua] Time limit to stay underwater
Posted: Sun Feb 28, 2016 7:48 am
by Super Mario Channel
For some strange reason, I thought the title said "Time Limit to Stay in Underwear"
Anyways, this might be useful if I ever decide to start doing LunaLua.
Re: [LunaLua] Time limit to stay underwater
Posted: Sun Feb 28, 2016 3:04 pm
by lotus006
Prado wrote:
It's ok!
Ok then I'll try to enhance more this one ,
Super Mario Channel wrote:For some strange reason, I thought the title said "Time Limit to Stay in Underwear"
Anyways, this might be useful if I ever decide to start doing LunaLua.
For the text in number about time limit is not be hard to add , I will make it toggable dont worry