Jump to content
Sign in to follow this  
Guest

Why doesn't this trigger fire in MP?

Recommended Posts

Guest

So I have a trigger with this in it:

Activation

None

Condition

((p1 distance captive1 < 4) OR (p2 distance captive1 < 4) OR (p3 distance captive1 < 4) OR (p4 distance captive1 < 4))

On Act

["Task1","succeeded"] call SHK_Taskmaster_upd; captive1 addweapon AK_74; captive1 addmagazine AK_74;

It fires perfectly in the editor but doesn't work in multiplayer. How come?

Edited by Guest

Share this post


Link to post
Share on other sites

i would have typed it another way, but not sure if that really matters, looks like a similar check i have used in a MP mission and it should work.

Anyway this is how i usually do it:

(p1 distance captive1) < 4 OR (p2 distance captive1) < 4 OR (p3 distance captive1) < 4 OR (p4 distance captive1) < 4

Are you sure that p1, p2, p3, p4 and captive1 really are names in your mp mission, if one of them isnull, ie non existing i think check will break.

Edit: i think maybe the error was the () around all the OR statements try my version above.

Edit 2: also set activation to whatever present, and just remove the this from condition line.

just incase None f...s it up somehow in MP.

Edited by Demonized

Share this post


Link to post
Share on other sites
Guest

Hi, p1,p2,p3,p4 and captive1 are all proper names. I tried your code and it still doesn't fire:confused:

EDIT: I do have disabledAI = true; set in description.ext so that if player slots are not taken then the AI will not be visable. Apart from that, I have no clue why it shouldn't work...

EDIT2: Changing it to anybody present didn't make a difference either.

---------- Post added at 12:25 AM ---------- Previous post was Yesterday at 11:58 PM ----------

I just took out disabledAI = true; from description.ext and it now fires correctly in MP. Thing is, I don't want to take that out... Is there another way to check if either p1,p2,p3, or p4 are within 4m of captive1 without it interfering with disabledAI = true?

Edited by Guest

Share this post


Link to post
Share on other sites

have you tried testing without the disableAI in description.ext? just to eliminate that as the cause for the problem.

Share this post


Link to post
Share on other sites
Guest

Yeah, I done that and it was the cause of the problem but I kinda need it in there so I guess I'm kinda screwed:confused:

Edited by Guest

Share this post


Link to post
Share on other sites

youll need to check if p1 is player then check for condition, else false.

think best bet is to use a script run from a trigger, with waituntil inside. basically works as trigger.

Edit: maybe this will work:

(p1 == player AND p1 distance captive1 < 10) OR (p2 == player AND p1 distance captive1 < 10) OR (p3 == player AND p1 distance captive1 < 10) OR (p4 == player AND p1 distance captive1 < 10)

Share this post


Link to post
Share on other sites
Guest

I edited the code you suggested to this:

(p1 == player AND p1 distance captive1 < 4) OR (p2 == player AND p2 distance captive1 < 4) OR (p3 == player AND p3 distance captive1 < 4) OR (p4 == player AND p4 distance captive1 < 4)

I had a good feeling that it was gonna work but it still didn't:(

Edited by Guest

Share this post


Link to post
Share on other sites

then you need to use a script and check if p1 is not isnull

then add that unit to an array if its not isnull and after check all units in array for distance.

Note: if you know that there will be a player filling all p´s place you dont need to do anythig, just stick with your first post.

---------- Post added at 02:11 AM ---------- Previous post was at 02:03 AM ----------

try this script:

//check
_runcheck = true;
while {_runcheck} do {
   if (isNull p1) then {hint "nothing happens as p1 is not apresent on map";} else {
       if (p1 distance captive < 4 AND _runcheck) then {
           hint "here is what happens when p1 is within 4 of captive1";
           _runcheck = false;  // this will end the lwhile loop and will proced with lines after.
       };
   };
   if (isNull p2) then {hint "nothing happens as p2 is not apresent on map";} else {
       if (p2 distance captive < 4 AND _runcheck) then {
           hint "here is what happens when p2 is within 4 of captive1";
           _runcheck = false;  // this will end the lwhile loop and will proced with lines after.
       };
   };
   if (isNull p3) then {hint "nothing happens as p3 is not apresent on map";} else {
       if (p3 distance captive < 4 AND _runcheck) then {
           hint "here is what happens when p3 is within 4 of captive1";
           _runcheck = false;  // this will end the lwhile loop and will proced with lines after.
       };
   };
   if (isNull p4) then {hint "nothing happens as p4 is not apresent on map";} else {
       if (p4 distance captive < 4 AND _runcheck) then {
           hint "here is what happens when p4 is within 4 of captive1";
           _runcheck = false;  // this will end the lwhile loop and will proced with lines after.
       };
   };
   sleep 1;
};

// after p1, p2, p3 or p4 is within 4 of captive1 script will jump to this part.
hint "someone is near the captive";  

Edited by Demonized

Share this post


Link to post
Share on other sites
Guest

When I try that script, I get nothing... No hints show up or anything. As if the script is not running.

init.sqf

execVM "playerdistancecheck.sqf";

playerdistancecheck.sqf

//check
_runcheck = true;
while {_runcheck} do {
   if (isNull p1) then {hint "nothing happens as p1 is not apresent on map";} else {
       if (p1 distance captive < 4 AND _runcheck) then {
           hint "here is what happens when p1 is within 4 of captive1";
           _runcheck = false;  // this will end the lwhile loop and will proced with lines after.
       };
   };
   if (isNull p2) then {hint "nothing happens as p2 is not apresent on map";} else {
       if (p2 distance captive < 4 AND _runcheck) then {
           hint "here is what happens when p2 is within 4 of captive1";
           _runcheck = false;  // this will end the lwhile loop and will proced with lines after.
       };
   };
   if (isNull p3) then {hint "nothing happens as p3 is not apresent on map";} else {
       if (p3 distance captive < 4 AND _runcheck) then {
           hint "here is what happens when p3 is within 4 of captive1";
           _runcheck = false;  // this will end the lwhile loop and will proced with lines after.
       };
   };
   if (isNull p4) then {hint "nothing happens as p4 is not apresent on map";} else {
       if (p4 distance captive < 4 AND _runcheck) then {
           hint "here is what happens when p4 is within 4 of captive1";
           _runcheck = false;  // this will end the lwhile loop and will proced with lines after.
       };
   };
   sleep 1;
};

// after p1, p2, p3 or p4 is within 4 of captive1 script will jump to this part.
hint "someone is near the captive";

Share this post


Link to post
Share on other sites

you need at least an empty [] to run a script:

like this

[] execVM "playerdistancecheck.sqf";

Share this post


Link to post
Share on other sites
Guest

It still doesn't seem to run. I tried misspelling the file name and it says cannot locate file so it is picking it up, just not running for some reason.

EDIT: I put a hint at the top of the sqf and it outputed fine so its something within the script thats causing it not to run I think.

Edited by Guest

Share this post


Link to post
Share on other sites

I assume it's a mission for 4 players.

{_x distance captive1 < 4} count playableunits > 0

PS. Doesn't work in SP editor, only in MP editor/host or dedicated server.

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
Sign in to follow this  

×