Jump to content

Recommended Posts

WWSitttingDuck
Posted

We could really use one of these.

Posted

So would this basically reset a timer to zero?

LLv34_Temuri
Posted

So deactivate and activate don’t work for your needs?

Posted

I must admit that I was wondering about that but didn't have access to my PC to check groups

WWSitttingDuck
Posted

It's just a pain to deactivate a timer cause you want whatever sequence it is controlling to stop.  If there is still time remaining on the timer, when you reactivate it because you want what ever routine the timer is in to start over, the timer is going to start counting down from how much time was left on it when you deactivate it.

Posted (edited)

Try the group "Resettable Timer 1" in this test mission:

JimTM - Test Timer Reset.zip

 

The group is based on something Coconut did quite awhile ago.

 

The MCUs under "Begin" run a test of the resettable timer.

 

The "Restart Timer" function only works if you paused the timer while it was running.

 

The "Reset Timer" function just closes the output from the timer . Then, when you trigger "IN Trigger Timer", the output is reopened and the 10s timer in the middle is triggered. If the 10s timer is running, it resets and starts over from the beginning. If the 10s timer fired already, it starts from the beginning.

 

Group "Resettable Timer 2" omits the pause/resume function. I haven't tested that yet but it's based on the first group.

Edited by JimTM
WWSitttingDuck
Posted

Ok, maybe I should have posted "I" could really use one of these...

 

 

It's the same with counters.  You have a routine that is tracking things happening in the mission, and at some point enough (but not ALL) of what you are tracking has happened that you want to start the  routine all over again.  But some of the counters still have values, and we have no way of setting counters to 0.

Posted

I haven't run into this problem...could it be that you need to re-think your logic?

Posted (edited)

I agree that it would be nice to have more obvious ways of doing this kind of things. I'm always worried that the specific behaviours of timers (pause) and counters (delay output) when deactivated will be accidentally changed at some point, breaking lots of things.

 

For a resettable counter, I made one some time ago, should still be in the "shared groups" post. Maybe it's also included in Jim's manual.

 

26 minutes ago, Gambit21 said:

I haven't run into this problem...could it be that you need to re-think your logic?

 

I find I seldom need this in single player (and now coop) because things tend to happen only once (or a fixed number of times) in a predetermined way, but in a complex continuously running dogfight multiplayer mission, it's another story.

Edited by coconut
  • Upvote 1
Posted

I see...thanks Coconut.

A circumstance I don't run into or plan for it sounds like.

Posted
43 minutes ago, coconut said:

...

For a resettable counter, I made one some time ago, should still be in the "shared groups" post. Maybe it's also included in Jim's manual.

...

 

No, I didn't include a resettable counter in my manual. I seem to remember that your resettable counter closed the output, ran the counter up to the max so it would reset, and then reopened the output again.

  • 2 months later...
SAS_Storebror
Posted (edited)

Sorry for resurrecting this thread.

I've just stumbled upon the same issue where I need a resettable timer (or something of that kind).

Background of this is that I'd like to create an online mission where random planes spawn on ground, taxi to takeoff and leave the airfield.

A first test showed that basically this works fine, however AI doesn't avoid collisions with other planes on ground if they don't belong to your own formation - and in my case they don't, because it's 4 individual planes which could spawn at any time.

 

So the idea was to use a check zone MCU at first TAXI waypoint, so once the first plane spawned and received it's Takeoff command, all further Takeoff commands will be put on hold until the first plane reached the first TAXI waypoint. This will put enough space between the taxiing AI planes so they don't run into each other.

 

However, due to unforeseeable factors (vulchers, player planes running into AI planes etc.) it might happen that an AI plane gets stuck between Spawn point and first Taxi point.

In that case, I'd like to give way for the next AI plane to taxi to takeoff after a certain time.

That time is roughly the maximum time it could take for the furthest AI plane to taxi to TAXI waypoint no.1 (the one with the checkzone trigger) from the time when it received the Takeoff command. This can easily be 2 minutes.

 

So... the resettable timer would need to run for 2 minutes or even longer.

I've tried JimTM's Timer Reset version 2 (I don't need no pause or resume), but the problem is that at the time when e.g. the first AI plane reached waypoint 1, the second will start to taxi and I need to restart the timer.

At that time, the timer already has e.g. 1 minute elapsed. It has been "resetted" using the "IN Reset Timer" input, and then it has been restarted by using the "IN Trigger Timer" input again.

However the result is not that it will fire after 2 minutes now as intended, but already after 1 minute - which is because the internal timer was active already from the previous "IN Trigger Timer" input I guess.

 

The question now is: How to really reset the timer? It seems like the internal timer, the one that is responsible for the timeout, simply doesn't reset.

 

Cheers!

Mike

Edited by SAS_Storebror
Posted (edited)
10 hours ago, SAS_Storebror said:

Sorry for resurrecting this thread.

...

So... the resettable timer would need to run for 2 minutes or even longer.

I've tried JimTM's Timer Reset version 2 (I don't need no pause or resume), but the problem is that at the time when e.g. the first AI plane reached waypoint 1, the second will start to taxi and I need to restart the timer.

At that time, the timer already has e.g. 1 minute elapsed. It has been "resetted" using the "IN Reset Timer" input, and then it has been restarted by using the "IN Trigger Timer" input again.

However the result is not that it will fire after 2 minutes now as intended, but already after 1 minute - which is because the internal timer was active already from the previous "IN Trigger Timer" input I guess.

 

The question now is: How to really reset the timer? It seems like the internal timer, the one that is responsible for the timeout, simply doesn't reset.

...

 

Check out this test mission to reset a 2-minute timer. The timer runs for one minute and then it's reset and re-triggered. The result is that the timer fires after 3 minutes.

 

JimTMTestReset2MinuteTimer.zip

 

Edited by JimTM
  • Thanks 1
  • Upvote 1
SAS_Storebror
Posted

Thanks Jim, will test and report either tomorrow or on Monday.

 

Cheers!

Mike 

  • Like 1
Posted

I think I can make use of this...thanks Jim.

  • Like 1
SAS_Storebror
Posted (edited)

... and here's the promised feedback:

It works like a charm! Thanks so much Jim!

Everything's fine and dandy now.

 

I've put a reminder into the Mission Editor Manual for myself to re-read the precise usage notes about counters and triggers again after a couple of time, because not all of their features are quite intuitive.

For instance, I wasn't aware that a timer MCU would restart at 0 when you trigger it again, whereas in order to pause and resume it, you can use the Deactivate/Activate Triggers.

Also it's always good to remember the difference between a 0-second timer and a self-resetting "1" counter: In deactivated state, the 0-second timer will act as a "blocked link" between MCUs and will ignore all signals it receives while being deactivated, whereas the counter will act as a "hold" link which, if it gets triggered while being deactivated, will fire once being reactivated.

 

Cheers!

Mike

Edited by SAS_Storebror
  • Upvote 1
Posted
1 hour ago, SAS_Storebror said:

... 

I've put a reminder into the Mission Editor Manual for myself to re-read the precise usage notes about counters and triggers again after a couple of time, because not all of their features are quite intuitive.

For instance, I wasn't aware that a timer MCU would restart at 0 when you trigger it again, whereas in order to pause and resume it, you can use the Deactivate/Activate Triggers.

 

Actually, there is no usage note about the "restart at 0" behavior in the manual, just the note about deactivating/activating the timer. I'll add a "restart" note to the next version of the manual.

SAS_Storebror
Posted

True that Jim, and thanks for keeping track of this.

That "restart at 0" behaviour was something I've learnt from your resettable timers.

Thany you very, very much for these useful tools. Would be worth providing as a group for download.

 

Cheers!

Mike

  • 6 months later...
WWSitttingDuck
Posted

From 3.008 update:

 

For mission designers we added a way to control Timer and Counter values dynamically. To do this, there are two new logical objects Modifier: Add Val and Modifier: Set Val. We plan to widely use them to alter various triggers in the future, but at the moment they can be used for:
- modifying a Timer trigger value. A modifier can set, add or substract the time value in a timer by using the 0 index of the controllable value and 1-st field of the value vector. When set to a negative value, the time counter is reset and the timer stops until the next input. For example, this can be used to reset and stop a timer in a mission, delaying some events tied to it.
- modifying a Counter trigger value and threshold (initiall set in a mission). To alter a Counter value, use the 0 index of the controllable value or alter Counter threshold using the 1-st index. For example, a certain mission event like a premature elimination of some targets can lower the threshold of a Counter to make sure the others are eliminated at the moment the player arrives to the waypoint.

 

THANK YOU!!!!

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...