Jump to content

2.8 Adv WP Action - Switch Waypoint CONDITION (LUA PREDICATE) is broken


Recommended Posts

Posted

I have an advanced waypoint action, where I want it to choose between carrying on or switching to an alternate waypoint.

I first tried to do with with the 'PROBABILITY' but no matter the value, it always made 'true' and diverted to the alternate waypoint.

So I wrote a LUA PREDICATE:

 

local rng = math.random(1,100) 
local text = string.format("%d", rng)
trigger.action.outTextForCoalition(2, text, 10, false)
if rng < 40 then
 
  return true

else

  return false

end

And I repeated the mission to see what happened when it hit that waypoint.
 

What I did not expect was that it was repeated CONSTANTLY UNTIL the condition was true. 

It should only fire ONCE, but it fires repeatedly until it is forced to become true.

This is identical to what was happening when I used the PROBABILITY function on the advanced waypoint action. 

 

This is now utterly useless. 

Posted (edited)

I have an advanced waypoint action, where I want it to choose between carrying on or switching to an alternate waypoint.

I first tried to do with with the 'PROBABILITY' but no matter the value, it always made 'true' and diverted to the alternate waypoint!?!? BUG #1

So I wrote a LUA PREDICATE:
 

local rng = math.random(1,100) 
local text = string.format("%d", rng)
trigger.action.outTextForCoalition(2, text, 10, false)
if rng < 40 then
 
  return true

else

  return false

end

And I repeated the mission to see what happened when it hit that waypoint.
 

What I did not expect was that it was repeated CONSTANTLY UNTIL the condition was true. 

It should only fire ONCE, but it fires repeatedly until it is forced to become true.

This is identical to what was happening when I used the PROBABILITY function on the advanced waypoint action. BUG #2!

 

So instead I reverted back to yet more Trigger Zones and set this up:

trigger.jpg

And guess what - IT STILL ALWAYS RESOVLES TO TRUE. BUG #3!

No matter what 'way' I try and do this, it will keep firing this condition until it returns true. So it's utterly pointless and useless. 

 

Edited by Elphaba
Posted

O believe this works as intended. 

Triggers are evaluated every second, so every second you have a given probability (defined in RANDOM X) to trigger the action. So with this you can make the timing random, but it will eventually happen. 

If you want to make something happen only sometimes, you need to use "flag set random value" in a separate trigger. 

Posted
Just now, Night Owl said:

O believe this works as intended. 

Triggers are evaluated every second, so every second you have a given probability (defined in RANDOM X) to trigger the action. So with this you can make the timing random, but it will eventually happen. 

If you want to make something happen only sometimes, you need to use "flag set random value" in a separate trigger. 

Hi Night Owl.

With all due respect, that's insane. 

The Trigger Condition is set to ONCE. 

There is no point in it evaluating it every second until is passes - that's what REPETITIVE ACTION is for. 

This is a bug

Posted

A trigger has to evaluare the condition every second, otherwise how would it check if the condition is true without evaluating it. But once it is true, it will fire only once and then be inactivated, hence the type ONCE. 

As for the example of the waypoint action, it's likely that there it's the same, the trigger will be started at the waypoint and then behave öike a normal trigger. 

Posted

https://wiki.hoggitworld.com/view/DCS_editor_triggerBasics#Once and https://wiki.hoggitworld.com/view/DCS_editor_Randomization#Triggers_2 might be helpful to understand random in the context of trigger conditions. 

The type defines how a trigger is allowed to do a given action. Basically all of them get continuously evaluated unless you set an event and mission start, which is also an event in itself. 

 

Start conditions for tasks should only check the conditions once upon arrival at a given waypoint though. So if that is evaluating multiple times then it is a bug. IIRC that has been a problem in the past. 

  • Like 1

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 think, the issue is not the conditions set for this action. It seems to me rather that there is a general bug in the "switch waypoint" logic.

The behaviour of the AI after a "swicht waypoint" seems to be rather erratic. I made a test mission with a Humvee, which is supposed to drive continuous in a either left hand circle or right hand circle. One waypoint decides which direction to take: left hand or right hand. Once the AI took the left hand route (using "switch waypoint"), things go downhill.

This is the path the AI took (2/3 of the time left hand route - although 50% probability was set ... but might be a coincidence):

Screenshot 2022-12-30 213303.png

The route setup in the ME:

Screen_221230_213640.png

It almost looks like the AI sometimes "forgets" what it was doing or is supposed to be doing. I.e. once arrived at WPT 9 (lower left corner), it should stay "ON ROAD" - but as can be seen in the first screenshot, it randomly veers off into the meadows, wiggling around as if it can't decide which WPT it is supposed to head for next. It even skips one or more WPTs occasionally.

The DCS.log might support this hypothesis as well:

Screenshot 2022-12-30 213149.png

(.TRK and TacView attached)

Tacview-20221230-211848-DCS-test go wpt.zip.acmi test go wpt.trk

Edited by Flagrum
Posted

Update to my last posting: I simplified the test case - no more conditions, just a simple route:

Screen_221231_022700.png

The Humvee should simply follow the waypoints 1...2...3...4...5 and when reaching 5 it should start over again at 1.

Each time it passes a waypoint, a message is transmitted of which wpt was just passed. After 1 or 2 rounds, it starts to get erratic again and the transmissions do not match the actual position of the vehicle. And here as well, the AI starts skipping waypoints.

test go wpt2.trk

  • Recently Browsing   0 members

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