Jump to content
Sign in to follow this  
Rommel

2 Q's in MP Scripting

Recommended Posts

I was wondering how to make the setmarkerpos command be visible to the client, whenever I setpos it to somewhere, it stays in the start spot on client, any idea why?

(only 1 Question, I figured out the other. pistols.gif

Share this post


Link to post
Share on other sites

The question is: how did you activate your setmarkerpos.

The command basically should be executed global, but it

appears to happen that the activation of the command

was local only (e.g: an custom action).

Please tell us how you approach to your setmarkerpos and

you should get proper help. smile_o.gif

~S~ CD

Share this post


Link to post
Share on other sites

It stays on the same spot because the setmarkerpos command was not executed on the client, only on the server or another client. If it's a trigger, chances are that network lag caused the client not to see that the conditions were true until they were already false again. You should only use server side triggers for important stuff and then transmit the information to clients.

Here's a simple example for a server side trigger:

1. Make a game logic named server, declare variableC=0 on it's init line or the init.sqs or anywhere you want to

2. Trigger condition: local server AND conditionA AND conditionB (this will only activate on the server, because game logic 'server' is only local to it)

3. Trigger onactivation: variableC=1; publicVariable "variableC";

4. Now the clients see that variableC is 1 and can execute a local trigger or a local script accordingly. Note that there is no error checking on publicvariable command so packet loss can cause the changed value not to be seen on all clients, you might want to do it a few times in a delayed loop or have some means of detecting that a variable was not transmitted.

The same idea works for a single client (instead of server) changing some variables and transmitting them to others.

So, to move a trigger you could make two variables markerposX and markerposY, then publicvariable those values to others when they change and they move the marker accordingly with a client side script. Or if it's something like a unit position, just make every client run a looping script that updates the position every second or so.

Share this post


Link to post
Share on other sites

Thanks metal heart I already had everything but the "publicVariable", I never thought it was needed whistle.gif

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  

×