marcon 0 Posted August 4, 2010 Hi, In my mission I have a trigger which activates a script. This script will teleport the player to the position of a GameLogic. The trigger is activated by anybody and has the following init: [] exec "teleport.sqs" teleport.sqs looks like this: ?(player == p1) : goto "teleport" ?(player == p2) : goto "teleport" ?(player == p3) : goto "teleport" ?(player == p4) : goto "teleport" ?(player == p5) : goto "teleport" goto "end" #teleport player setPos (getPos TP); goto "end" #end EXIT When I use this script in SP everything works fine but in MP when one of the players (p1, p2, p3, p4 or p5) walks into the trigger everyone gets teleported. This script worked fine for me in OFP:R. Since when is a script run on all Clients in MP using a trigger? Is there a way to just run this script locally only on the pc of the player who triggered the trigger? Thanks in advance! P.S. i know exec and .sqs are outdated and should not be used but I'm used to that way of scripting since OFP(:R) Share this post Link to post Share on other sites
Junker 0 Posted August 4, 2010 try this: ?(player == p1) : p1 = unit; goto "teleport" ?(player == p2) : p2 = unit; goto "teleport" ?(player == p3) : p3 = unit; goto "teleport" ?(player == p4) : p4 = unit; goto "teleport" ?(player == p5) : p5 = unit; goto "teleport" goto "end" #teleport unit setPos (getPos TP); goto "end" #end EXIT Share this post Link to post Share on other sites
marcon 0 Posted August 4, 2010 (edited) Doesn't work because the .sqs is line executed and stops at a ;. so the goto isn't called. Second this will give the same 'error' because the script will still be run on all clients so every client/player will be teleported because the player will still match one of the P's. Isn't there a way to run this script locally from a trigger? Still thanks for your answer! Edited August 4, 2010 by marcon Share this post Link to post Share on other sites
shuko 59 Posted August 4, 2010 Why not just put: player setpos getpos tp in the onact field? Share this post Link to post Share on other sites
marcon 0 Posted August 4, 2010 Forgot to tell that, there are also other players, like p6 and p7 which should not be teleported when walking through the trigger :o. Share this post Link to post Share on other sites
shuko 59 Posted August 4, 2010 how about: condition: player in [p1,p2,p3,p4,p5] && player in thislist onact: player setpos getpos tp Share this post Link to post Share on other sites
marcon 0 Posted August 4, 2010 (edited) Wow it works! Thanks for your input shk, now I'll figure out how your line of code works haha Thank you very much shk! Edited August 4, 2010 by marcon Share this post Link to post Share on other sites
shuko 59 Posted August 4, 2010 Yes, just replace the "this". Share this post Link to post Share on other sites
marcon 0 Posted August 4, 2010 One more question, this doesn't work when the player is in a vehicle, how to change it so it does? changing player into (vehicle player) isnt the key. should it be like this?: condition: player in [vehicle p1,vehicle p2,vehicle p3,vehicle p4,vehicle p5] && player in thislist Share this post Link to post Share on other sites
Heatseeker 0 Posted August 4, 2010 condition: player in [p1,p2,p3,p4,p5] && vehicle player in thislist Maybe like that? Share this post Link to post Share on other sites
marcon 0 Posted August 4, 2010 (edited) No my suggestion doesn't work. Ill try that one heatseeker! ---------- Post added at 12:45 PM ---------- Previous post was at 12:43 PM ---------- player in [p1,p2,p3,p4,p5] && vehicle player in thislist doesn't work ---------- Post added at 12:46 PM ---------- Previous post was at 12:45 PM ---------- Off topic: I agree with your signature Heatseeker, never understood why people said OFP haha ---------- Post added at 01:25 PM ---------- Previous post was at 12:46 PM ---------- It still isnt a real answer to my question because shk solution is working but still i have got more triggers in my mp mission which activates scripts and which arent ment to be run when someone else activates them in MP. Is there maybe a way to see who activate the script? i tried triggerActivation but that one doesn't display the player or his name. Any help is welcome! Edited August 4, 2010 by marcon Share this post Link to post Share on other sites
kylania 568 Posted August 4, 2010 Just remember that a trigger will execute on all clients connected (even the server) so filter your programs accordingly. This is why if you spawn something in a trigger for example you'll end up with multiple copies instead of just one. :) Share this post Link to post Share on other sites
marcon 0 Posted August 4, 2010 But is it possible that a script will be executed or only affect the player that has triggerd the trigger? Because the code found on page one won't filer the player because on all the clients it gives a true on ?(player == pX) Share this post Link to post Share on other sites
shuko 59 Posted August 4, 2010 Using "player" already specifies/filters who activates it. The trick just is that each player will active it for themselves once they go into the area. However, since "player" will point to a different unit on each player, you can decide who will do what. Share this post Link to post Share on other sites
marcon 0 Posted August 4, 2010 I think I need to think different. thanks for the advice shk Share this post Link to post Share on other sites