Jump to content
charliereddog

Issue with a trigger not working on Dedicated

Recommended Posts

I'm having some issues with a trigger I have set up on a task which works perfectly on my local machine when hosting a mission, but does not work on a dedicated server.

 

The task is to take 4 water tanks to a village, and the trigger simply detects whether they are within 30m of the point required. 

 

7Deb2s3.jpg

 

I have checked that the count command is correctly picking up the objects on the dedicated server via server debug and it is.

 

I am tearing my hair out with this. As I said, this works flawlessly on my machine when I host and test, but on the dedicated server it does not work. Please point out my obvious mistake.

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, engima said:

There's nothing in OnActivation?

The trigger activated code can be scripted or you can have a link to a task module for example.

Share this post


Link to post
Share on other sites

Yes. Point is we don't know that. If we know what is expected to happen it would be easier to assist. Maybe there is nothing wrong with the trigger. It should "activate" even though "Server only" is checked. But the result may not impact client machines.

 

Can it be that the watertanks are local on the client machine.

Share this post


Link to post
Share on other sites
19 hours ago, pierremgi said:

Why server only? Your activation is for server only?

I usually use server only for task synced triggers but in fairness they are usually simple !alive tank type stuff and they seem to work without needing to be on individual clients. AFAIK tasks are not local.

 

3 hours ago, engima said:

There's nothing in OnActivation?

True. Because it is synced to the task status being completed. As I noted originally, this set up works when I host the mission myself.

 

1 hour ago, engima said:

Yes. Point is we don't know that. If we know what is expected to happen it would be easier to assist. Maybe there is nothing wrong with the trigger. It should "activate" even though "Server only" is checked. But the result may not impact client machines.

 

Can it be that the watertanks are local on the client machine.

True. I will add some code to the trigger to check it is not triggering silently. 

 

I'm not sure about the locality issue. If I add water tanks to the required area via Zeus when using the dedicated server and use the expanded debug for the server, I can see the result of the count is the same for the server, the HC and my client machine.

Share this post


Link to post
Share on other sites
2 hours ago, engima said:

 

Can it be that the watertanks are local on the client machine.

 

Local? created locally? In that case, they are not visible by the other players.

Owner can be a client (Zeus) but it should be created globally (createVehicle). And then, even if owned remotely, it will be detected by nearObjects.

Problem should be rather on task propagation/sharing.

Share this post


Link to post
Share on other sites

I can comfirm, also having weird problems on my dedicated server now with trigger firing, but nothing happening still. 

Just discovered the issue when testing an "air-taxi" for the players to be moved from HQ, to the FOB by AI flying back and forth.

AI helicopter with variable name "Heli1" with the following init field:

Heli1 addAction["<t color='#6D1300'>Take Off</t>", {TakeOff = 1;}, [], 1.5, false, true, "", "true", 5, false, "", ""];

This AllowDamage False;

nul = this spawn { waitUntil { if !(alive _this) exitWith {}; if (fuel _this < 0.50) then { _this setFuel 1 }; false }};


First Waypoint - on the helidpad (variable name BasePad1) with waypoint activation:

Heli1 land "BasePad1";

Second waypoint - a regular "move" waypoint directly ontop of that again, "Set Wapypoint activation"-synced to a trigger with the following info:

Repeatable: Yes

Condition:
TakeOff == 1;

On Activation:
Hint "Heli-Taxi Trigger Fired"; TakeOff = 0; 

 

Third waypoint - on the destination helipad (variable name FOBAPAD) with waypoint activation:

Heli1 land "FOBAPAD";

Fourth waypoint - a regular "move" waypoint directly ontop of that again, "Set Wapypoint activation"-synced to a trigger with the following info:

Repeatable: Yes

Condition:
{_x in Heli1} count (units player) ==  0;


Fifth waypoint - a "Cycle" waypoint linked to the first waypoint.


Basically, when testing it in the editor both on single player and in multiplayer - you have the addAction "Take Off" available once you are close/in the helicopter, which is immune to damage (crew as well) and getting endlessly refuled once the heli reaches 50% fuel. It will then fly to the FOB helipad, land and stay there till all players have left the helicopter. It will then return to the HQ helipad, land and wait for another activation of the "Take Off" addAction.

What happens when on trying this on the dedicated server - i get in the helicopter. I trigger the addAction command, i get the hint (Heli-Taxi Trigger Fired) telling me that the trigger has been activated - but nothing happens. Its like the triggers function of activating the waypoint did not happen, and as such we're stuck. 

I then noticed other triggers that previously were working, no longer working either - firing, but not executing as such.

This only happens on my dedicated server, everything works fine as said when testing in singleplayer or multiplayer through the editor.

 

Share this post


Link to post
Share on other sites
9 minutes ago, Ulfgaar said:

Heli1 land "BasePad1";

10 minutes ago, Ulfgaar said:

Heli1 land "FOBAPAD";

These are both incorrect in syntax, the STRING should be a mode(  "LAND", "GET IN", "GET OUT" or "NONE" ) not an object variable name. See land command on wiki.

 

Share this post


Link to post
Share on other sites
20 minutes ago, Ulfgaar said:

I can comfirm

 

In general, if something works in local and hosted but not in dedi, it's a locality issue. Triggers work on dedi, this really can't be disputed. Also, you are replying to a year-old post.

  • Like 2

Share this post


Link to post
Share on other sites

In addAction try:

{TakeOff = 1; PublicVariable "TakeOff";}

and in trigger activation:

Hint "Heli-Taxi Trigger Fired"; TakeOff = 0; PublicVariable "TakeOff";

 

Share this post


Link to post
Share on other sites

Yes, i know im responding to an old thread - but been "told off" before about not using "old threads" on the same topic. So either i cant make a new thread about the same topic, or i cant respond to old threads with the same topic. 

Anywho - its a recent thing, and this is just one example. I see no reason why it should not work on the dedicated server tho, when its working when testing it elsewise. And as said, the trigger fires - i can see the hint, but the helicopter does not move beyond waypoint 1. 

And then there are the other triggers not activating anymore, those that did just a few days ago - i cant figure out why not, and searched the web. This thread came up - so if said someone found a fix, i'd like to know what it was.

@Larrow
Ok right - so basically i dont need to refer to the helidpad at all, it'll just select it because thats where the waypoint it attached? I'll sort that out.

edit: Changing that did nothing on the dedicated server - issue persists.

But, basically what happens is that the triggers fires, hints are showing - but the effects of said triggers does nothing. This goes for both the trigger in question which i've written about above - but also on older triggers that have been working previously, for a very short time ago.

 

 

Share this post


Link to post
Share on other sites
5 minutes ago, Ulfgaar said:

I see no reason why it should not work on the dedicated server tho, when its working when testing it elsewise.

 

As Harzach said, it's typically a locality issue.

 

In this particular case your heli is AI, which usually means local to server (but maybe not).

If your trigger is marked server only, it exists only on the dedi server.  Otherwise it exists on server and each client.

Waypoint conditions are only checked on the group owner machine (if AI local to server, the dedi machine)

addAction is local effect, its code runs on a client.

Thus the trigger may not be picking up addAction setting the TakeOff variable to 1, because it only sets to 1 on a client, not the server.

 

Which is why I suggest add PublicVariable, so the server detects the change to 1, and the client detects the change back to 0.

Share this post


Link to post
Share on other sites
2 hours ago, Ulfgaar said:

it'll just select it because thats where the waypoint it attached?

No, nearest helipad when command is run. So if the waypoint that runs the command is on the helipad it should go to that helipad as long as there is not one nearer. Remember waypoint completion for helos can be something around 100m ish out, no matter the waypoint completion radius. Also there are sometimes helipads in the map so it can get awkward making a helo land at a specific pad especially around things like airports etc.

Share this post


Link to post
Share on other sites
4 hours ago, Ulfgaar said:

Fourth waypoint - a regular "move" waypoint directly ontop of that again, "Set Wapypoint activation"-synced to a trigger with the following info:


Repeatable: Yes

Condition:
{_x in Heli1} count (units player) ==  0;

 

 

If this trigger is on the dedicated server, you also need to change its condition.  Player is objNull on a dedi.  Need to somehow identify the specific unit or group to count units from.

Share this post


Link to post
Share on other sites
20 hours ago, opusfmspol said:

In addAction try:


{TakeOff = 1; PublicVariable "TakeOff";}

and in trigger activation:


Hint "Heli-Taxi Trigger Fired"; TakeOff = 0; PublicVariable "TakeOff";

 

 

There seem to be some sort of delay with this on the server, where the hint is executed immediatly, while the "set Waypoint Activation" engages a fair time after...no idea why. But, i have on the server experienced some sort of delay in commands when playing as Zeus as well, like manually setting codes in the MCC init box of units (This SetVehicleAmmo 1; ...etc.).

 

 

16 hours ago, opusfmspol said:

 

If this trigger is on the dedicated server, you also need to change its condition.  Player is objNull on a dedi.  Need to somehow identify the specific unit or group to count units from.

 

A more coding-savvy friend of mine helped me out with a different code which i'll be going with instead. Truth be told, the code is used previously is actually a code originally made for counting members of a group being inside a vehicle, i just did a hack-saw attempt at what i thought would be to count players, instead of a given group.
This is the new code im going for to check if players are out (tho, not checking if players are out - but when there are only 2 left, all players are out - as pilot/co-pilot and helicopter are invulnerable so there should be no chance of either of them dying for some reason).

count (crew Heli1) == 2;


 

Share this post


Link to post
Share on other sites

I tried a workaround, with a trigger just detecting if player was in the helicopter, that the helicopter is on the ground in the given trigger (covering the helipad) and that the hint is only broadcast to players within said trigger.

This is the trigger that activates immediatly once conditions are met - hint shows up:

Activation: BLUFOR
Activation Type: Present

Condition:
{isTouchingGround Heli1} count thisList > 0 && count (crew Heli1) > 2 && (vehicle player) in thislist;

On Activation:
Hint "Transport helicopter will take off in 30 seconds. To abort - leave the helicopter.";

On Deactivation:
Hint "Transport helicopter - Take off aborted.";

 


This is the trigger that activates after 30 seconds has passed, and which is "set Waypoint Activation" synced to the waypoint that releases the helicopter - once conditions are met, and the hint shows up:

Activation: BLUFOR
Activation Type: Present

Condition:
{isTouchingGround Heli1} count thisList > 0 && count (crew Heli1) > 2 && (vehicle player) in thislist;

On Activation:
Hint "Helicopter taking off!";

Timeout: 30 sec

But again ,working on singleplayer and multiplayer through the editor - the hints show up on dedicated server, but does jack shit in regards to releasing the waypoint.


Why the helicopter trigger does not release the waypoint of the helicopter however....it just breaks my head in.

 

I've made dedicated server missions for years, using all sorts of conditions to activate triggers, which would put an AI group onto its planned path by using a trigger and its "set Waypoint Activation" - however, now all of a sudden this simply does not work.

Share this post


Link to post
Share on other sites

In SP and hosted, (vehicle player) will return a player's vehicle.  On dedicated server (vehicle player) is the same as (vehicle objNull).

 

As trigger condition(s) maybe try:

(Heli1 In thisList && isTouchingGround (vehicle Heli1) && {_x In AllPlayers} count (crew Heli1) > 0)

I never use semicolons ( ; ) at end of trigger conditions, don't know if it effects anything though.

Share this post


Link to post
Share on other sites
3 hours ago, opusfmspol said:

In SP and hosted, (vehicle player) will return a player's vehicle.  On dedicated server (vehicle player) is the same as (vehicle objNull).

 

As trigger condition(s) maybe try:


(Heli1 In thisList && isTouchingGround (vehicle Heli1) && {_x In AllPlayers} count (crew Heli1) > 0)

I never use semicolons ( ; ) at end of trigger conditions, don't know if it effects anything though.

 

What im making here is an AI air-taxi for a persistent campaign thats been rolling for soon two months (with resets to server ofc) - but where we are now, players will still spawn at our HQ - but have an option for transport to the FOB in question when our flyboys are not online. To do this, i've placed an AI chopper having a pilot and co-pilot, following a circle of waypoints which will fly players to the FOB, and return to base for another run whenever needed. 
 

{_x In AllPlayers} count (crew Heli1) > 0)

This part tho, is counting if all players are in the heli, no? As im not after having it as a requirement to have all the players be in, and thought that counting the crew of the helicopter being more than the two that is supposed to be there be what is counted. If i understood your suggestion right, its counting if there are more than 0, which would then make the 2 AI always present trigger that particular code, no?

And what i need, is for the triggers "Set Waypoint Activation"-sync to the waypoint preventing it to leave to fire. As said, my version is giving me the hints, so the triggers are firing - but the trigger seemingly is not "releasing" said waypoint - so the chopper does not go anywhere.

Share this post


Link to post
Share on other sites

You're getting the hint because the trigger is firing on client.  But the waypoint is not releasing because the trigger is not firing on server.

Server has control of the AI leader's waypoint condition check.  The waypoint condition is not fulfilled until the trigger fires on server.

 

If you want to know that the dedicated server's trigger has fired, try:

if (isServer) then {"Transport helicopter will take off in 30 seconds. To abort - leave the helicopter." remoteExec ["hint", (if (isDedicated) then {-2} else {0})]};

and,

if (isServer) then {"Helicopter taking off!" remoteExec ["hint", (if (isDedicated) then {-2} else {0})]};

-2 for dedicated server since it has no interface for hints.  For SP and hosted MP, using 0 has the hint run for all.

 

 

 

2 hours ago, Ulfgaar said:

{_x In AllPlayers} count (crew Heli1) > 0

This part tho, is counting if all players are in the heli, no?

No.

-  allPlayers is an array of all players + headless clients in the mission.  AI units are excluded.  It's a better check than isPlayer which sometimes gives a bad return.

-  _x is the element of the counted array, in this case the array counted is everybody in the helicopter (heli crew).

-  In checks whether the inspected element _x is found within the AllPlayers array.

 

It counts the heli crew, and returns number of crewmembers who are players, not AI.

So if one or more of the heli crew is a player, the condition returns true.

 

 

(Heli1 In thisList && isTouchingGround (vehicle Heli1) && {_x In AllPlayers} count (crew Heli1) > 0)

The condition is: (heli in the trigger + heli on the ground + one or more of the heli crew is a player).

 

Share this post


Link to post
Share on other sites

We resolved the case, by utilizing the condition fields of the waypoints instead - and our inhouse code-head. 

Thanks for all the efforts of helping tho, really appreciate it - if for nothing else it has -somewhat- made locallity clearer to me - which is a big deal 😄

 

Share this post


Link to post
Share on other sites
37 minutes ago, Ulfgaar said:

We resolved the case

 

Locality is a common point of confusion for a lot of folks, myself included. Not so much what locality is, but how to manage it, with what commands, and in what situations, etc. Glad you got it solved.

It's good form to share the solution.

Share this post


Link to post
Share on other sites

Yeh, i'll do so once i've got bit more time - need to put it into "wording" that makes sense and not just ramble on 😄

 

  • Like 1

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

×