Jump to content

Question on Creating a Random Trigger Spawn


Boomer20

Recommended Posts

I've started to experiment with random triggers to add variability to my missions and was trying to work out if the following scenario is doable and I'm on the right track.

 

Scenario: Your a CAS flight taking out enemy columns. As each group is destroyed a new one will spawn. Essentially you can split it into 3 phases for each new spawn (Phase 1 starts with the 1st column and ends when its destroyed, then phase 2 starts and so on). Now what I want to do is spawn in an enemy CAP to intercept you but I want it to have a potential to not spawn at all.

As I understand I would use a flag for the particular phase combined with a random of 25% to define which phase it will spawn in plus one 25% trigger for not spawning at all. Is that correct?

 

To go one further I'm wondering if its possible to randomise when within that particular phase the CAP will spawn instead of say just spawning when the trigger to start the phase begins or from a time since flag which is a set time. Basically I want it to spawn at a random point while that phase is active. Is that possible?

Link to comment
Share on other sites

There are probably easy scripting ways through MIST and MOOSE that would get you there but if you use a variable flag between 2 values you can then set a condition that if that flag value is greater than or less than or equal to- however you want- then you can spawn the CAP.

 

You’d also set a flag for when columns were either totally destroyed or within a certain percentage of being destroyed... having a percentage can help prevent the mission from stalling in the event one pesky vehicle goes into hiding and can’t be found.

"ENO"

Type in anger and you will make the greatest post you will ever regret.

 

"Sweetest's" Military Aviation Art

Link to comment
Share on other sites

Random doesn't work like you'd expect. It's a percent chance per second. So if you make a trigger with random 5%, It's 5% chance of turning on after 1 second, then 10% after 2 seconds, then 14% after 3, etc. After a long enough time you'll get to 100%.

 

 

 

If I want to make a unit have a chance of not spawning I use the flag method like ENO suggests. If you want a 25 % chance of spawn use "Flag set random value" with a range from 1 to 100. Then activate the group if the "Flag is less" than a value of 26.

Awaiting: DCS F-15C

Win 10 i5-9600KF 4.6 GHz 64 GB RAM RTX2080Ti 11GB -- Win 7 64 i5-6600K 3.6 GHz 32 GB RAM GTX970 4GB -- A-10C, F-5E, Su-27, F-15C, F-14B, F-16C missions in User Files

 

Link to comment
Share on other sites

If I want to make a unit have a chance of not spawning I use the flag method like ENO suggests. If you want a 25 % chance of spawn use "Flag set random value" with a range from 1 to 100. Then activate the group if the "Flag is less" than a value of 26.

 

Yes...

 

I was on a phone before so I couldn't go into much detail so thanks for elaborating a bit Exorcet!

 

So the way it will work in the simplest terms is you blow up a column (or a percentage of a column" and your action is to set flag to a random value like Exorcet says. So the flag number will be... say... 1. Random value of flag 1 will be 1-100.

 

Now a flag has been set (or raised... whatever way you like to look at it) at whatever value it's going to be... let's say it comes up as a random value of 12. So now flag 1 is at a value of 12... you can't see that- but the game does.

 

The next trigger you want to set up is a run once trigger that is set with a condition that flag 1 is "less than" 25. And the action you want is to spawn your CAP group.

 

As an option, you could create a couple different types of CAP aircraft groups... so if flag one is "less than 25 but more than 20" it could come up as group A... and less than 100 but more than 80 it could activate group B... there are loads of options you can choose from. These would need to be separate triggers but you get the idea. you can pretty much just clone the trigger and very easily change the conditions and actions.

 

I'm not sure your level of expertise Boomer so I don't want to confuse you. To add to it I'm just getting back into it again so I'm a bit rusty and I don't want to mislead you. Fortunately we've got guys like Exorcet who actually know what they're talking about looking over my shoulder to help make sure I'm giving you the right info!

"ENO"

Type in anger and you will make the greatest post you will ever regret.

 

"Sweetest's" Military Aviation Art

Link to comment
Share on other sites

Finally got around to trying this out this morning, I set up a quick test/proof of concept mission for myself and got the phase idea working, just for the test I had set flag value between 1 and 4 with each corresponding to the particular phase and 4 being no spawn. Once I cleaned up my oversights (the dangers of building a quick test mission and not being thorough) it worked exactly as expected. Now to implement it into a proper mission. Flag random value seems quite a powerful and handy tool.

 

I'd like to say I'm quite capable with the mission editor, I don't make overly complex missions but that's more of a I don't want to spend forever in the editor. You guys have been quite clear and helpful and the joys of a sandbox editor is trial and error as well :)

 

Thanks for the help.

Link to comment
Share on other sites

Eh boomer I’m not great with scripting and things like that so when I first started building missions I needed to find a lot of creative ways in the ME around otherwise simple problems. I’m always anxious to help out where I can since I’ve been helped out by so many with my issues scripting- using MIST and MOOSE.

 

I remember Exorcet used to help me out all the time too since waaaaay back in my beginnings- not to mention so many others who are still familiar contributing these days. You’re in great company.

 

I think what really helps is that you demonstrated that you put in an effort, needed some help and then applied the lesson- it shows you’re eager and that the time others put in to help you won’t be wasted. You keep that up and you’ll always have someone help nudge you closer to your objectives.

"ENO"

Type in anger and you will make the greatest post you will ever regret.

 

"Sweetest's" Military Aviation Art

Link to comment
Share on other sites

Appreciate the words ENO. While I know that MIST and Moose can be really helpful and can also alleviate functionalities lacking I've tried shying away from manual lua code scripting particularly for mission building as I've never been a fan of troubleshooting lua mistakes in the past.

 

Well I have a feeling I will posting in this board a few more times, already know some more questions that will probably pop up if I don't find a solution. Its always good to have people like Exorcet and yourself around to pick the brains of and help others.

Link to comment
Share on other sites

One nice thing about the scripts is that if you look at the errors in the log you can often see exactly what line of code has an error... and some very basic, well documented functions can be completed - practically copy and pasted- in and save you a metric poop ton of time you’d need to invest in the ME. But yes, I do understand the aversion. I’m having a hard time with some very basic functionality right now and it’s hard to always come in looking for help.

"ENO"

Type in anger and you will make the greatest post you will ever regret.

 

"Sweetest's" Military Aviation Art

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...