Jump to content

how to combine "random" and "time since flag"


Recommended Posts

Hi,

 

I'm working on a more realistic SAM for our training mission. I have a SAM station, which goes offline, when it will be attacked. And now, I want, that these unit comes back online (unit AI on) in a random time, between 30 seconds and ... let's say 5 minutes.

 

How could I get this done? IMO, I need the random and the tme since flag conditions, right? But what to do exactly?

 

Thanks in advance.

 

 

Fire

Hardware: Intel i5 4670K | Zalman NPS9900MAX | GeIL 16GB @1333MHz | Asrock Z97 Pro4 | Sapphire Radeon R9 380X Nitro | Samsung SSDs 840 series 120GB & 250 GB | Samsung HD204UI 2TB | be quiet! Pure Power 530W | Aerocool RS-9 Devil Red | Samsung SyncMaster SA350 24" + ASUS VE198S 19" | Saitek X52 | TrackIR 5 | Thrustmaster MFD Cougar | Speedlink Darksky LED | Razor Diamondback | Razor X-Mat Control | SoundBlaster Tactic 3D Rage ### Software: Windows 10 Pro 64Bit

[sIGPIC][/sIGPIC]

Link to post
Share on other sites

In all missions I do for myself I have a flag (flag 1) that is set to a random value between 1 and 60 at mission start and then with switched condition set again the same way every 60 seconds. This way I have a flag that sets every 60 seconds that I can use to trigger various random things throughout the mission, I use 1 to 60 and 60 second interval based on a very basic theory that the mission will take me about 1 hour at most and during that time all numbers between 1 and 60 have a reasonably big chance to be drawn. If I would set it to between 1 and 120 instead im thinking that it would take about double the amount of time for all things to happen and the opposite if you want shorter time with more things happening.

So, in your case, you could make such a flag that sets every 30 seconds because you said you wanted 30 seconds at minimum, since you want around 5 min you could set the flag between 1 and 10 perhaps because in 5 minutes is 10 x 30 seconds.

Then you need to make two triggers:

MISSION START                                                                                          Set flag 1 to random value 1 to 10
SWITCHED CONDITION        Time since flag 1 30 seconds                    Set flag 1 to random value 1 to 10

Then you need to have a triggered task for your SAM site, GROUP AI ON, on the vehicle group.

 

Because in the trigger list you do:
SWITCHED CONDITION         Flag 1 equals 1                                            AI TASK PUSH SAM site GROUP AI ON

Its smart to set the condition to Flag equals 1 instead of any other number, because if you use 1 you can tweak how fast it goes online again by increasing or decreasing 10 in the triggers above.

What happens here is that every time flag 1 is set to 1 the group will go online, i suspect you have another trigger for GROUP AI OFF for it to go online when damaged or something that should also be SWITCHED CONDITION and not ONCE.

 

Be aware though that in teory you can drop a bomb on the SAM site so it becomes damaged and goes offline and then 2 seconds later it goes online again if flag 1 happens to set just then to the value 1. I think this will work pretty ok though because this will only happen if flag 1 gets the value 1 right away, if it gets any other number the first time the flag is set after the SAM site was hit then it will atleast be 30 seconds until it goes online again.

Also be aware that the timeperiod im talking about will be roughly about what I say because every time the flag is set it can get any number between 1 and 10, if 3 was drawn the first time it is not removed from the lottery the next time so to say, if it would then the timeperiod would be almost exactly between 30 seconds and 5 minutes.

 

 

  • Thanks 1
Link to post
Share on other sites

If you really want to make sure that it can not go online again before 30 seconds you can combine the flag 1 equals 1 condition with another one.

You make a flag turn on every time the SAM site is damaged, lets call it flag 3:
SWITCHED CONDITION           SAM site damaged                  Flag 3 on


and another trigger:

SWITCHED CONDITION           Time since flag 3  29 seconds          Flag 3 off

 

This means that every time the SAM site is hit (damaged) then flag 3 gets set to on and remains on for 29 seconds and then it turns off.

 

Combine that into the last trigger I wrote into my previous post like this:

SWITCHED CONDITION         Flag 1 equals 1, Flag 3 is false                                            AI TASK PUSH SAM site GROUP AI ON


Then the SAM site cant come online until at least 30 seconds after it was damaged.

 


Edited by Fisherman82
Link to post
Share on other sites

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...