Jump to content

Recommended Posts

Posted

I'm trying to think of a practical way of implementing a blockade that clears once a group of A-10s has loitered in an zone for 5 minutes as a "show of force" that eventually leads to the blockade moving aside.

 

This happens in the water and is basically a blockade of civilian vessels that are blocking a US warship from entering port. There is a bit of a standoff and A-10s are called in to help coerce the flotilla to move aside.

 

I'm a bit stuck as to how to get this to happen and though I've found some countdown timers that grimes made for another mission... I'm a bit hung as to how to implement such a feature into this circumstance.

 

The way I figured I could do it is not activate the group until a time since flag had elapsed passed 5 minutes... my issue is I have to enter that in as a condition for the civilian boats somehow... but I want the civilian boats to be visible the whole time- not just when they're activated.

 

Also, the boats don't have a hold function- so I'm at a bit of a loss overall. Scripting is not my forte.

 

Thanks for any help in advance.

"ENO"

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

 

"Sweetest's" Military Aviation Art

Posted

Ensure the "Visible before start" checkbox is checked and then spawn the group in with waypoints when you want them to move. Blue ships might have to have the same waypoint set as in they already "arrived" at the blockade. Otherwise you could always to the old switcharoo and group deactivate the group that arrive and get "blocked" by the the blockade, then just group activate another group with the same contents in roughly the same spot with orders to move forward.

 

The countdown timer is a pretty straight forward trigger.

Set initial value

Once> Whatever> Set Flag Random Value

Note: Set Flag Random Value and Flag increase are limited to 100, you can get around this by using multiple flag increase actions. The maximum flag value is something like 1 x 10^23, so don't worry about logical limits. Or just use this code in a do script:

trigger.action.setUserFlag('flagnum', value)

 

Set interval to count down

Switched Condition>Time since Flag is x> decrease by 1

Timer end

Once> Flag x = 1> Do Action

 

By adjusting the initial value and the interval you can manipulate the overall time it takes for the action to occur. Assuming you want the players to stay in the zone you could do something like this:

Once> Whatever> Do Script: trigger.action.setUserFlag('1', 300)

Switched Condition> Time since flag 1 is 1 second AND Part of Blue Coalition in Zone> Flag 1 Decrease 1

Once> Flag 1 = 1> Group Activate(Blockade)

 

Assuming the blue pilots could be the only bluefor units in a zone this trigger will require a pilot to be in the zone for every second of the 5 minutes. If the zone is empty the trigger will not count down, but it will resume once a blufor unit gets inside the zone.

 

 

But yeah... boats need a bit of an overhaul as about all they can do is "fire at point". Even new waypoint tasking via scripting engine doesn't work with em...

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

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Posted

Okay... so "visible before mission start" will allow us to not activate a group but still have it visible sitting there. That's perfect, actually. Then when I activate it after such conditions are met it can move out of the way.

"ENO"

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

 

"Sweetest's" Military Aviation Art

Posted

Yep. Keep in mind the group will show up as "alive" for the relevant triggers, but the AI is essentially not active. So they won't react to anything until activated other than getting killed.

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

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Posted (edited)

I'm trying to make it so that any two aircraft can activate the trigger. I'm currently doing this by setting unit / under altitude / in zone activate flag... then cloning for each aircraft.

 

My issue is that any two aircraft need to be able to trigger the event (pending the random). In addition, want to make it so that if the random trigger doesn't activate and later group of aircraft go through the trigger set- that provided the flag that trips when the trigger IS activated isn't set- that the later group can still "randomly" be issued that task. Keeping in mind again it could be "any" group of any number of aircraft.

 

I guess the challenge is that I could used "switched condition" but I don't want it to switch for every single aircraft (like if they're flying in a group of 4). If each aircraft is "switched" in the trigger zone separately- then each time one of them enters the zone the randomizer will activate. I guess I can have it set a different flag if the event DOESN'T happen... and make the original trigger one that is (also) based on that flag happening X amount of minutes prior. That will allow it to happen for the first aircraft of a group- and it won't be randomized again for at least X amount of minutes to allow it to run again for another aircraft in a later group.

 

I've cloned that set of conditions for each unit- but I'll need to add that "false" flag as mentioned above.

 

If the aircraft need to stay in the zone for 5 minutes (I've already applied the script above, thanks again grimes)... if it drifts out of play do I need to set that flag as false again or will the switched condition set it to false... or at least "not true." The timer is only working if a flag is "true." Will it stop and reset if the aircraft leave the zone... or will I need to set a "trigger to false?"

 

 

It IS confusing... and maybe I'm overcomplicating it... but is there an easier way?

 

Is there any limit to the triggers? I know by the time I've cloned a lot of these different triggers to allow for each aircraft to be eligible- I'm going to have quite a few...

 

Is it better to put in the "or" condition or simply clone the whole trigger independently for each unit?

Edited by ENO

"ENO"

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

 

"Sweetest's" Military Aviation Art

Posted (edited)

Trigger 1: Check if one of the Units is inside the zone below the given altitude

 

Condition:

Flag x = false

Unit 1 inside zone

Unit 1 altitude lower than

[OR]

Flag x = false

Unit 2 inside zone

Unit 2 altitude lower than

 

Action:

Flag x = true

 

 

Trigger 2: Check, if trigger 1 was triggered before, whether both units stop meeting the conditions above

 

Condition:

Flag x = true

Unit 1 outside zone

Unit 2 outside zone

[OR]

Flag x = true

Unit 1 outside zone

Unit 2 altitude higher than

[OR]

Flag x = true

Unit 1 altitude higher than

Unit 2 outside zone

[OR]

Flag x = true

Unit 1 altitude higher than

Unit 2 altitude higher than

 

Action:

Flag x = false

 

With these 2 triggers you should be able to track, whether at least one of the 2 Units is inside the zone and below the specified altitude.

Should be switched conditions.

Careful with the altitude condition, the value is altitude in meters, most displays show altitude in ft.

 

edit: should work now..

 

edit 2: not sure, but you can try to make the 1st trigger check continouusly, maybe it sets the flag to false automatically, as soon as both units stop meeting the conditions..

Edited by MasterZelgadis
  • Like 1

"Sieh nur, wie majestätisch du durch die Luft segelst. Wie ein Adler. Ein fetter Adler."

http://www.space-view.net

Posted

The ONLY thing I've miscommunicated here is that there are actually 8 aircraft- of which any 2 need to be able to (well, ideally) set the trigger off.

 

So now with that- perhaps I'm just expecting too much for too little here. I mean... given some time, any number of flights can be accommodated- but I've got to think of the work versus reward here.

 

I guess with the clone feature it really makes things easier- but again... I do ask is it better for efficiency to clone the whole trigger 300 times or clone one trigger with 300 conditions? (exageration slightly but you get my meaning)

"ENO"

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

 

"Sweetest's" Military Aviation Art

Posted

That's exactly what I thought when I wrote these triggers..if more units shall be able to meet the conditions, the trigger would be very complex.

But maybe it works with the continouus version, i wasn't able to test that yesterday

"Sieh nur, wie majestätisch du durch die Luft segelst. Wie ein Adler. Ein fetter Adler."

http://www.space-view.net

Posted

Okay... question for you while you're around...

 

The OR condition... If I do unit 1 or unit 2 or unit 3... once this condition has been met- does it only happen the once? If I put "or" between multiple units will it continue to evaluate? If I make THAT continuous will it continue to increase as other units come in... or decrease as they leave? Or will it just keep adding 1 every time the condition (unit in zone) is found to be true.

 

 

If switched condition is applied as an alterative... can I "count" units through the trigger system with a "switched condition / unit X in zone Y / Flag Z increase 1?

 

And alternately switched condition "unit X out of zone Y / Flag Z decrease 1"... Or do I need to do it "continuous? If I do continuous- will it just keep increasing?

 

Thanks for your help MZ..

"ENO"

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

 

"Sweetest's" Military Aviation Art

Posted

I guess with the clone feature it really makes things easier- but again... I do ask is it better for efficiency to clone the whole trigger 300 times or clone one trigger with 300 conditions? (exageration slightly but you get my meaning)

 

No there is no limit to triggers, but at somepoint triggers become cumbersome to use when you require multiple conditions to exist for different units. So you either have to restrict the number of conditions or simplify the overall logic required. For example requiring specific aircraft to be in the zone or requiring an altitude adds x number of triggers per unit, thus the overall complexity. Also if you set the mission up in a certain way where "part of coalition in zone" can work, that will help save you some work.

 

But ultimately my answer should simply remind you to use lua as its good for this sort of thing.

 

 

 

 

 

Add Mist to mission. Change the triggers to look something like this:

Once> Whatever> Do Script: trigger.action.setUserFlag('2', 300) AND Set Flag 3 true

Continuous > Flag 3 True> Do Script (Paste code below)

Switched Condition> Time since flag 2 is 1 second AND Flag 1 True> Flag 2 Decrease 1

Once> Flag 2 = 1> Group Activate(Blockade)

 

local agl = 500
local count = 0
local zone = 'zoneName'

for clientId, clientData in pairs(mist.DBs.humansById) do
if clientData.coalition == 'blue' and clientData.type == 'A-10C' then
	local pos = Unit.getByName(clientData.unitName):getPosition().p
	local land = {['x'] = pos.x, ['y'] = pos.z}
	if pos.y < land.getHeight(land) + agl and (((pos.x - zone.point.x)^2 + (pos.z - zone.point.z)^2)^0.5 <= zone.radius) then
		count = count + 1
	end
end

if count >= 2 then
	trigger.action.setUserFlag(1, true)
else
	trigger.action.setUserFlag(1, false)
end
end

 

'zoneName' needs to be changed to whatever your zone name is. This script iterates through the clients aircraft in the mission to make sure they are on the blue coalition and are A-10Cs. It then gets the current position of the current unit and the ASL of ground level at the point where the player is at.

 

It then checks to see if the player is below 500 meters AGL and if its in the zone. If it is count + 1.

 

If counter is greater than or equal to 2 it will set the flag 1 to true, thus the triggers allowing the timer to move forward will move forward.

 

 

 

Suffice to say, scripting has its advantages with this sort of thing. Assuming you wanted to add 8 more A-10Cs to the mission on blue, with triggers you'd have to modify each trigger to account for each unit, possibly making new triggers. If you used scripting, you'd just have to add the 8 A-10Cs and grab a beer because there is nothing else you need to change.

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

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Posted

I continue to be amazed at how you guys drum that up so easily. I'm going to need to take some time to interpret which parts I need to modify to my given situation- and I MIGHT need to reconsider how I apply the logic if I get myself lost... but I sure appreciate the help.

 

It doesn't help that up until about a month ago I thought a lua was just a delicious meal on the beach in Hawaii.

"ENO"

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

 

"Sweetest's" Military Aviation Art

  • Recently Browsing   0 members

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