Jump to content
dachs

Trigger fires prematurely at mission start, on dedicated server

Recommended Posts

(!(scientist in ThisList) && !(vehicle scientist in ThisList) && (alive scientist)) OR
(!(target1 in ThisList) && (alive target1)) OR
(!(target2 in ThisList) && (alive target2));

I have the above (probably clunky) code in the on condition field, of a trigger placed in editor.

Type :NONE

Activation : Anybody

Activation Type : Not Present

 

It's supposed to check if either scientist or target1 or target2 are leaving the trigger area, and gives a hint about it.

In hosted MP it works as it should, no problems, but on a dedicated server, it triggers right at mission start, and I can't figure out why?

 

Can it be because the targets and the scientist are slow to spawn on a dedicated, and therefore are not in ThisList on mission start?

Target 1 & 2 are trucks, and the scientist is an AI with waypoints to flee the scene in a SUV, hence the !vehicle scientist part.

All three are placed in the editor, not spawned in by something fancy..

 

Share this post


Link to post
Share on other sites


{alive _x && !(_x in thisList)} count [scientist, target1, target2] > 0

Share this post


Link to post
Share on other sites
{alive _x && !(_x in thisList)} count [scientist, target1, target2] > 0

LOL, that is considerably more elegant than my attempt, and it works just like it should in hosted MP.

 

However, the problem persists, the trigger still fires right at mission start, when running on a dedicated..?

 

And, just so I can maybe learn a bit about code here;

Am I right in saying the above code, counts the number of units alive and not in thisList, but should only count those units mentioned in the array?

Share this post


Link to post
Share on other sites

And, just so I can maybe learn a bit about code here;

Am I right in saying the above code, counts the number of units alive and not in thisList, but should only count those units mentioned in the array?

Correct.

Share this post


Link to post
Share on other sites

 However, the problem persists, the trigger still fires right at mission start, when running on a dedicated..?

 

Hi dachs, without commenting your script, please notice that there's an issue related with triggers on dedicated server.

I suggest you wait for the next patch before scratching your head too much :)

 

Nikander

Share this post


Link to post
Share on other sites

Your code is clunky, but it is correct. It does short circuit evaluation of your logical expression, whereas count does not (only within condition for every element).

Most triggers exist and being checked for the whole mission run, so speed matters.

I would also suggest put fast checks and checks that would most likely short circuit the whole expression first.

 

Regarding the trigger. Try to delay its check by some flag variable or simply by checking that some time has passed since mission start:

(diag_tickTime > 2000) && (/*...other checks go here...*/)

or

(!isNil "flagVariable") && (/*...other checks go here...*/)

Assign any value to flagVariable soon after mission start, e.g. when your scientist gets in car, or, again, simply by time

[] spawn {
  sleep 2;
  flagVariable = 1;
};

Share this post


Link to post
Share on other sites

Thanks all for your input!

Unfortunately I think we'll have to chalk it up to a bug in Eden for now, it certainly fits pretty well with the decription in this other thread:

https://forums.bistudio.com/topic/188139-trigger-broken-for-dedicated-server/

Nik4nder, thanks for bringing it up.

 

@pedeathtrian

I did try delaying the trigger check using your suggestion, but the results were the same. Works in Hosted MP, but triggered at once in Dedi.

Share this post


Link to post
Share on other sites

could be a locality issue   

 

try this

 

(({alive _x && !(_x in thisList)} count [scientist, target1, target2] > 0) && isServer)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×