5133p39 16 Posted February 4, 2005 I am new to MP missions, so i don't know... I have a simple MP mission with two players and ONE trigger. Each player's init field contains command to run a script which does the following: When any of the players moves, the trigger is positioned on this player position and displays a message (for me to be sure it works, and it does work, even if there is only one trigger for two players). I just want to know: if there would be 20 players (each is running a mission which contains the trigger) - will there also be 20 triggers, each of them LOCAL to the corresponding client? or would be all of them managed by the server? or would be there only one trigger tested by server for each of the 20 players? Another, probably more understandable question: When i make variable public by <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">PublicVariable "_var_name" will the variable be sent to each client automaticaly when it is changed? or do i need to issue a PublicVariable command manually each time when the value changes? I would be grateful for any info on client/server handling of objects and variables. Every link is welcome Share this post Link to post Share on other sites
Wadmann 0 Posted February 4, 2005 I am no scripter, and definately not an MP scripter, but I do know a couple of things that may help you out, but may not answer your question directly. 1) Anything that is put in the mission editor becomes global as every client has a copy of the mission.sqs. 2) A wise sage once stated that the "publicvariable" command should have been named "broadcastPublicVariable" as you will need to send out the variable each time it changes if you want it updated on all machines. 3) Unit psoitions are global as whenever a unit moves, it must be at the same position on all machines. Those that have a greater understanding of MP editing please correct me if I am wrong as I need to learn more myself about MP scripting. Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Wadmann Share this post Link to post Share on other sites
killswitch 19 Posted February 5, 2005 First: asking oneself if something is "local or server-side" shows a bit of a misunderstanding of the concepts. Let's sort them out:<ul>[*] On one hand, there's the concept of an object being local or remote [*] OTOH, things can be viewed as being server-side or client-side Make sure to understand the difference between these two. An example: object A can be local to a server and therefore regarded as server-side. Another object, B, can be local to a client and therefore client-side. To the client, object A is remote whereas B is local. The opposite goes for the server's view of things - A is local and B is remote. Quote[/b] ]I just want to know: if there would be 20 players (each is running a mission which contains the trigger) - will there also be 20 triggers, each of them LOCAL to the corresponding client?or would be all of them managed by the server? or would be there only one trigger tested by server for each of the 20 players?I'm not sure locality is a relevant aspect to think about when dealing with triggers. You could call them somewhat "global" in that <span style='color:red'>trigger conditions are evaluated on all machines</span>. Have a look at my reply in this OFPEC thread: "Scripts activated by triggers in MP are not local?" and see if that helps.Quote[/b] ]Another, probably more understandable question: when I make variable public by<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">PublicVariable "_var_name" Before I answer the questions, I need to mention that the variable you're trying to broadcast in that pV call will make OFP complain - you are trying to broadcast a local scope variable (i e one prefixed by an underscore). <span style='color:red'>Important: don NOT confuse local and global variable scope with locality of objects(local-remote)</span> Quote[/b] ]will the variable be sent to each client automaticaly when it is changed?Nope, publicVariable is a one time thing and you need to reissue that every time you need to broadcast a variable.Quote[/b] ]or do i need to issue a PublicVariable command manually each time when the value changes? Yep I hope that clears up things more than it confuses Share this post Link to post Share on other sites
InqWiper 0 Posted February 6, 2005 Quote[/b] ]local obj Operand types: Â Â obj: Object Type of returned value: Â Â Boolean Description: Â Â MP: Check if given unit is local on the computer. This can be used when some activation fields or scrips need to be performed only on one computer. In SP all objects are local. Note: All static objects are local everywhere. Example: Â Â local unitName Im not sure about the triggers but I think they can only be at one place at a time like soldiers and vehicles. If you have 2 scripts running that moves the trigger I think the trigger is moving back and forth between those 2 positions. I would place one trigger for each unit. Share this post Link to post Share on other sites
5133p39 16 Posted February 7, 2005 Quote[/b] ]Im not sure about the triggers but I think they can only be at one place at a time like soldiers and vehicles. If you have 2 scripts running that moves the trigger I think the trigger is moving back and forth between those 2 positions. I would place one trigger for each unit. Yes, but that's the Question i have: how many triggers will be created? Every player must load the mission - and there is the trigger, so i thought there will be as many triggers as players. And if the script for moving the trigger is running only on player's machines... you get the point. But now i think this is a nonsense. :-) So, you are probably right. Share this post Link to post Share on other sites
[aps]gnat 28 Posted February 7, 2005 2) A wise sage once stated that the "publicvariable" command should have been named "broadcastPublicVariable" as you will need to send out the variable each time it changes if you want it updated on all machines. Oops ... thats news ! ...... now I'm gunna have to check some of my scripts Share this post Link to post Share on other sites
killswitch 19 Posted February 7, 2005 Quote[/b] ]Im not sure about the triggers but I think they can only be at one place at a time like soldiers and vehicles. If you have 2 scripts running that moves the trigger I think the trigger is moving back and forth between those 2 positions. I would place one trigger for each unit.Yes, but that's the Question i have: how many triggers will be created?If you place N triggers in the mission, there will be N triggers created, regardless of the number of players. Quote[/b] ]Every player must load the mission - and there is the trigger, so i thought there will be as many triggers as players. And if the script for moving the trigger is running only on player's machines... you get the point. But now i think this is a nonsense. :-) So, you are probably right. Moving triggers around is fine, but as InqWiper said, don't move the same trigger around on more than one machine, since they will "fight" over where it's located. Actually, that might not be true, since, IIRC, setPos only has an effect if issued on the machine where the object to be moved is local (There it is again - the local/remote bit).That means the only place where the moving around of triggers will actually do anything is on the server, to which the triggers are local. Share this post Link to post Share on other sites
5133p39 16 Posted February 8, 2005 Quote[/b] ]That means the only place where the moving around of triggers will actually do anything is on the server, to which the triggers are local. ...i don't think this is true. I have moved the triger in script running on client computer and it worked fine. Same as when i moved it in script running on server. (I was running two players MP game, one instance of OFP hosted the game while playing as 1st player, the other instance was only client playing as 2nd player - everything worked fine for both players) Share this post Link to post Share on other sites
bn880 5 Posted February 8, 2005 Yes, setpos on objects and triggers is actually global. On camcreated things it is not, perhaps killswitch was thinking of camcreated "emptydetectors", in which case it abloslutely is local. Share this post Link to post Share on other sites
killswitch 19 Posted February 9, 2005 Yes, setpos on objects and triggers is actually global. On camcreated things it is not, perhaps killswitch was thinking of camcreated "emptydetectors", in which case it abloslutely is local. Ah...good old OFP. Every day a new oddity in store. I stand corrected on how setPos behaves. (And I wasn't hinking about camCreated things, which are indeed local to the machine where they were created). Share this post Link to post Share on other sites
General Barron 0 Posted February 9, 2005 Thanks very much for the explaination guys. I'm still trying to learn about MP scripting/editing, and this definately helps. Share this post Link to post Share on other sites