bombajack Posted July 18, 2015 Report Share Posted July 18, 2015 Hello. Im total noob in scripting.This is my first try of script...where have i mistake? In init i have this : [] execVM "scripts\tired.sqf"; Can anyone help with this? getFatigue player; if (getFatigue player > 25) Then { playSound "sounds\heartBeat.ogg"; player sideChat "I'm very tired,need break!" }; Link to comment Share on other sites More sharing options...
0 PixelDetonator Posted July 18, 2015 Report Share Posted July 18, 2015 It need a loop function. and need define sound file to description.ext. description.ext : class cfgSounds { sounds[] = { heartBeat }; class heartBeat { name = "heartBeat"; sound[] = {"sounds\heartBeat.ogg",0.2,1}; titles[] = {}; }; }; tired.sqf : waitUntil {!isNull (findDisplay 46)}; waitUntil {typeOf player != "VirtualMan_EPOCH"}; while {alive player} do { if (getFatigue player > 0.25) then { playSound "heartBeat"; systemChat "I'm very tired. Need break!"; }; sleep 10; }; Link to comment Share on other sites More sharing options...
0 bombajack Posted July 18, 2015 Author Report Share Posted July 18, 2015 Thanks so much..i try it.thx! ;) Link to comment Share on other sites More sharing options...
0 bombajack Posted July 18, 2015 Author Report Share Posted July 18, 2015 It need a loop function. and need define sound file to description.ext. description.ext : class cfgSounds { sounds[] = { heartBeat }; class heartBeat { name = "heartBeat"; sound[] = {"sounds\heartBeat.ogg",0.2,1}; titles[] = {}; }; }; tired.sqf : waitUntil {!isNull (findDisplay 46)}; waitUntil {typeOf player != "VirtualMan_EPOCH"}; while {alive player} do { if (getFatigue player > 0.25) then { playSound "heartBeat"; systemChat "I'm very tired. Need break!"; }; sleep 10; }; maybe must be sound[] = {"\sounds\heartBeat.ogg",0.2,1}; right? Link to comment Share on other sites More sharing options...
0 DirtySanchez Posted July 18, 2015 Report Share Posted July 18, 2015 Interesting idea, would you mind I try it with my health script? Link to comment Share on other sites More sharing options...
0 Halvhjearne Posted July 18, 2015 Report Share Posted July 18, 2015 It need a loop function. and need define sound file to description.ext. description.ext : class cfgSounds { sounds[] = { heartBeat }; class heartBeat { name = "heartBeat"; sound[] = {"sounds\heartBeat.ogg",0.2,1}; titles[] = {}; }; }; tired.sqf : waitUntil {!isNull (findDisplay 46)}; waitUntil {typeOf player != "VirtualMan_EPOCH"}; while {alive player} do { if (getFatigue player > 0.25) then { playSound "heartBeat"; systemChat "I'm very tired. Need break!"; }; sleep 10; }; nice idea, but ... im not sure why you want all these waituntil's also this will spam the chat when the player is tierd. perhaps set a timer, something like this: _msg = true; _nextmsgtime = 300; _diag_tickTime = 0; while {alive player} do { if (getFatigue player > 0.25) then { playSound "heartBeat"; if(_msg || (diag_tickTime - _diag_tickTime) > _nextmsgtime)then{ systemChat "I'm very tired. Need break!"; _msg = false; _diag_tickTime = diag_tickTime; }; }else{ _msg = true; }; sleep 10; }; also, when you use alive player, you might want to add some way to re-execute the loop if the player is revived Link to comment Share on other sites More sharing options...
0 bombajack Posted July 19, 2015 Author Report Share Posted July 19, 2015 Interesting idea, would you mind I try it with my health script? No...use it buddy..;) Link to comment Share on other sites More sharing options...
Question
bombajack
Hello.
Im total noob in scripting.This is my first try of script...where have i mistake?
In init i have this : [] execVM "scripts\tired.sqf";
Can anyone help with this?
Link to comment
Share on other sites
6 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now