Jump to content

Recommended Posts

Hello gentlemen,

would you help me to solve this little problem. I want to make fire place burn only at night. I have found this code:

 

------Fireplace-----

f1

------Trigger-----
Condition: daytime >= 18 OR daytime <= 6
On Act: f1 inflame true

-----Trigger to stop the burning-----
Condition: daytime <= 18 OR daytime >= 6
On Act: f1 inflame false

 

Fire is being lit at 18. But it does not go out at 6. I've changed the "false" trigger since it didnt look logical to use same (=6 and =6 cant have dif vari) time, so:

-----Trigger to stop the burning-----
Condition: daytime < 18 OR daytime > 6
On Act: f1 inflame false

 

Fire gets lit, but again - doesnt go out at 6 in the morning...
 

Thnak you

Share this post


Link to post
Share on other sites

I'm no scripter, but wouldn't they want to be 'AND', not 'OR' calls as BOTH would need to be true for the fire to light/extinguish? - Keep in mind I'm just guessing here.

Share this post


Link to post
Share on other sites

I'm no scripter, but wouldn't they want to be 'AND', not 'OR' calls as BOTH would need to be true for the fire to light/extinguish? - Keep in mind I'm just guessing here.

 

oh that's brilliant! I will test it tonight. I believe this is it, since it follows the logic. Thank you mate. I will post result latter.

Share this post


Link to post
Share on other sites

I'm no scripter, but wouldn't they want to be 'AND', not 'OR' calls as BOTH would need to be true for the fire to light/extinguish? - Keep in mind I'm just guessing here.

 

Absolutly right. This is simple boolean algebra (today is Gorge Booles 200th birthday btw).

 

You want the fire to burn when:  daytime >= 18 OR daytime <= 6

And you want it out when: !(daytime  >= 18 OR daytime <= 6) (you can even use this statement as condition ;) )

When you move the ! in the bracket, it will translate according to boolean algebra to: daytime < 18 AND daytime > 6

 

Also you should add an check if the fire is already out or lit, otherwise the trigger fires every few frames, even if the condition was already met in the past.

  • Like 1

Share this post


Link to post
Share on other sites

Also you should add an check if the fire is already out or lit, otherwise the trigger fires every few frames, even if the condition was already met in the past.

 

Will you help me by coding such trigger?

 

So first trigger "true":

daytime >= 18 OR daytime <= 6

 

Second trigger "false":

!(daytime  >= 18 OR daytime <= 6)

 

And...

 

Thank you guys for assistance. I should ask for help much often, as solving takes time from my night bed...

Share this post


Link to post
Share on other sites

Make a single trigger with:

 

Cond.: (daytime >= 18 OR daytime <= 6) && !inflamed f1

On.Act.: f1 inflame true;

 

And onother one with:

Cond.: !(daytime >= 18 OR daytime <= 6) && inflamed f1

On.Act.: f1 inflame false;

 

That should be all you need.

Share this post


Link to post
Share on other sites

if (sunormoon) then {f1 inflame false} else {f1 inflame true};

Share this post


Link to post
Share on other sites

Thank you good people of internet. Up for testing.

Share this post


Link to post
Share on other sites

Make a single trigger with:

 

Cond.: (daytime >= 18 OR daytime <= 6) && !inflamed f1

On.Act.: f1 inflame true;

 

And onother one with:

Cond.: !(daytime >= 18 OR daytime <= 6) && inflamed f1

On.Act.: f1 inflame false;

 

That should be all you need.

 

Sir Neo, this one is working like a charm, thank you. In my mission, this looks very atmospheric - you can see fireplaces lighting up on top of the hilltops in different interval when night rolls in.
But I would like to ask for little more assistance. How this code should be made, to handle multiple fireplaces, like f1, f2, f3... that lights up on same time. Cause now I have to have too many triggers to handle multiple fireplaces.

Share this post


Link to post
Share on other sites

What's your definition of 'too many triggers'?

 

I have 12 fire places, I want 5 and 5 and 2 light up at unified time (like 18-6 | 21-4 | 1-5). At the moment i have 24 true and 24 false triggers. I would like to have 3 true and 3 false.

Share this post


Link to post
Share on other sites

A single trigger can run all of the fireplaces that you want to light at the same time.

 

IN the onact field that neo gave you earlier, just add more fireplaces.

 

Cond.: (daytime >= 18 OR daytime <= 6) && !inflamed f1

On.Act.: f1 inflame true;f2 inflame true; f5 inflame true.

Share this post


Link to post
Share on other sites

 && !inflamed f1

 

But this checks only f1 state (lit or not)?

Share this post


Link to post
Share on other sites

To be honest, I wouldn't bother with the inflamed test. If the thing is already alight and you light it again, there's no harm done.

Share this post


Link to post
Share on other sites

Yes yes, but I am worried about too many triggers living in the missions. Might it hit on performance? Guess yes, since so many. Keeping in mind I am using ALiVE and ACE and so on.

Share this post


Link to post
Share on other sites

12 triggers isn't going to hurt performance. As I say, you only need 1 trigger for each different activation time. Every fireplace that you want to light at 1900 can use the same trigger. Same for every fireplace that lights at 2000

Share this post


Link to post
Share on other sites

Condition:

(daytime >= 18 OR daytime <= 6)

On Act:

f1 inFlame true; 
f2 inFlame true; 
f3 inFlame true; 
f4 inFlame true;
etc.

On Deact:

f1 inFlame false;
f2 inFlame false; 
f3 inFlame false; 
f4 inFlame false; 
etc.

Will light all fires simultaneously, and also remove them when daytime comes. (Make sure triggers are set to repeatable)

Or, make two triggers and have one set up for deactivating the flames.

 

Condition:

!(daytime >= 18 OR daytime <= 6)

On Act:

f1 inFlame false;
f2 inFlame false;
f3 inFlame false;
f4 inFlame false;
etc.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×