Home   Help Search Login Register  

Author Topic: Condition of presence  (Read 1721 times)

0 Members and 1 Guest are viewing this topic.

Condition of presence
« on: 25 May 2009, 23:19:20 »
Hi: I have a code I am messing with on an object fire lit. in the Condition of presence i have put
Code: [Select]
if ((daytime > 5) and (daytime < 19)) then {false} else {true};. Now this works if you start the game/map after 5am the fire is invisible and if you start the game/map after 7pm the fire is visible. How would I rewrite this or what would I put in a triger to make the fire become visible and go invisible as the time runs in the game and goes past the set times ( 5am and 7pm ). So if in game at 6:55pm and stay there 5 minutes the fire becomes visible and play all night untill 5am and the fire disapears/invisible? I am sorry for starting a new topic on Condition of presence but when I did a search I must of miss typed because when I searched again I found Shadow_Spyder's topic, but it sounds like he is looking for something a little different than what I am looking for help on.

Offline Rommel92

  • Members
  • *
Re: Condition of presence
« Reply #1 on: 26 May 2009, 00:21:12 »
You'd be best to simply write a script; so for the fire place, it would probably be better to just have this going:

(nil = [this,5,19,{_this inflame false},{_this inflame true}] execvm "firelit.sqf")

Code: (firelit.sqf) [Select]
_object = _this select 0;

_time0 = _this select 1; //min daylight
_time1 =_this select 2; //max daylight

_code0 = _this select 3;
_code1 = _this select 4;

waituntil {
if ((daytime > _time0) and (daytime < _time1)) then {
_object call _code0
} else {
_object call _code1
};
sleep 60;
0 >= 1 //(or any exit condition of your choice)
}

Should do the trick, tell me if you have any problems.
« Last Edit: 26 May 2009, 00:22:44 by Rommel92 »

Re: Condition of presence
« Reply #2 on: 26 May 2009, 13:57:32 »
Thank you very much Rommel works perfect.
« Last Edit: 26 May 2009, 14:27:56 by SpectrumWarrior »