Jump to content

Recommended Posts

Posted

Hi All,

 

I'm reaching out the community for some help on a something I am trying to do, but am not sure how.  In the attached screenshot you can see a piece of logic from Gruber's plane-checking group. There is a 10 second timer which activates a checkzone for 500ms, then deactivates it again for 10 seconds (dont worry about the rest of the logic which deals with what happens when a plane is spotted, thats not relevant to this).

 

image.png.395cad3e1dfcd3a07f957b237bc10fae.png

 

 

The idea being to only check for enemy planes for a short time every 10 seconds, and not have the checkzone running continuously and sucking up mission resources.

 

 I want to combine many of these groups and, instead of each group just having its own 10 second timer to check the checkzone, I want to loop through all the checkzones, checking them for 500ms each. Once the last checkzone is reached, the loop must restart at the first checkzone again. In other words, if I have 50, or 100, or 500 of these checkzones, I want the mission to loop through and check each one for 500ms in a linear fashion, then start again once the last one is checked (think of it like electric signal traveling down down a nerve, each neuron being activated for a split second as the signal reaches it and then deactivating again).

 

The key thing here is ONLY ONE checkzone should be active at any one time 
 
 I am not sure how to create a loop in the mission editor which works for an unknown number of output timers, and which activates the timers one at a time (for a specified amount of time), and then repeats the process once the last output timer is reached and starts again from the first output timer. Here is the pseudocode of what I am trying to do:

 

 

# Assume we have a list (array) of output timers: T[1...N]
# Each timer is activated for DURATION seconds before moving to the next

# Initialization
current_index = 1
N = total_number_of_output_timers
DURATION = desired_activation_time

# Start the loop
while (true):
    activate(T[current_index])        # Turn ON or trigger this output timer
    wait(DURATION)                    # Wait for DURATION seconds

    # Move to the next timer
    current_index = current_index + 1

    # If we've reached the end of the list, loop back to the start
    if current_index > N:
        current_index = 1
    end if
end while
 
 Does anyone maybe have some ideas on the easiest way to do this?
 
 thanks!  

Posted

okay actually I am being stupid, this is pretty easy to solve:


Timer_1 → triggers Output_1 and Timer_2
Timer_2 → triggers Output_2 and Timer_3
...
Timer_N → triggers Output_N and Timer_1   (loops back)

 

gonna need a lot of target links, but with some simple modification of the checkzone group logic, this should be easy-ish to set up..

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...