Jump to content

Recommended Posts

Hi..

I dont use scripts.

 

I have a mission where i need to set the probability of succes depending on the amount of troops unloaded in an area..

 

right now I have a flag 5..

with 4 values.. (4 helicopters)

 

if 1 helicopter delivers troops.. flag 5 value at 20 (on a 20% chance succes)

if 2 helicopters land................flag 5 value at 40

"""""""""""""""""""""""".............Flag 5 value at 60

...........................................Flag 5 value at 80 (on a 80% chance success max)

 

Im using a base vlaue of 100 porcent to make things easier..

 

My question is.. and after spending all morning reading.. how do I make a final trigger or set a new flag based on those chances of success?

A.K.A. Timon -117th- in game

Link to post
Share on other sites

Using a "FLAG IS MORE" condition should do the trick.

 

In the screenshot example I set a start flag on first and used 3 APC's instead of troops. Each APC increases the flag value by 30 as they enter the zone, so 90 total if all are in the zone. (Actually 91 as flag started out with value of 1)

 

Then I used a "FLAG IS MORE" condition to trigger a "Message to all", if the flag value goes over 80. Triggers as soon as the third APC enters the zone.

 

Hope that helps.

EDIT: Posted mission example as well in case you want to look at it. Made in DCS stable.

1985028798_FlagisMore.thumb.jpg.d368b21f501957c4d890305138c7257f.jpg

Flags Test Mission.miz


Edited by Hunter_5E
Link to post
Share on other sites

You'd have a trigger for each group being dropped off.

 

Once>Part of Group 1 In Zone>Flag 5 increase value by 20

Once>Part of Group 2 In Zone>Flag 5 increase value by 20

Once>Part of Group 3 In Zone>Flag 5 increase value by 20

Once>Part of Group 4 In Zone>Flag 5 increase value by 20

 

Then you turn some flag on when you want to check the success rate. Call it flag 10.

 

Once> Flag 10 True and Flag 5 equals 20 and random 20%> Do action

Once> Flag 10 True and Flag 5 equals 40 and random 40%> Do action

Once> Flag 10 True and Flag 5 equals 60 and random 60%> Do action

Once> Flag 10 True and Flag 5 equals 80 and random 80%> Do action

 

However due to how random is evaluated you must have another trigger to remove the condition.

Once> Time since Flag 10 is 1 second> Flag 10 Off.

 

 

 

Alternatively you can use a simple script when evaluating the success.

 

Do Script

 

local val = trigger.misc.getUserFlag('5')
if math.random(100) < val then
   trigger.action.setUserFlag('1', true)
end 

 

Once> Flag 1 is true > Success!

The right man in the wrong place makes all the difference in the world.

Current Projects: Scripting Wiki, Something...

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread), SLMOD, IADScript, Mission Editing Wiki!, Mission Building Forum

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