Jump to content
Sign in to follow this  
Rommel

Markers not changing pos in MP

Recommended Posts

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

#loop

~1

M1 = {heli1} setmarkerpos getpos heli1

M2 = {hummer1} setmarkerpos getpos car1

M3 = {hummer2} setmarkerpos getpos car2

M4 = {Respawn_West} setmarkerpos getpos Field_Aid

publicvariable "M1"

publicvariable "M2"

publicvariable "M3"

publicvariable "M4"

goto "loop"

Does anyone know why it might not work? sad_o.gif

Share this post


Link to post
Share on other sites

I don't have the slightes idea what you're doing there with variables M1-M4. smile_o.gif

Just move the markers local on every client.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

#loop

~1

"heli1" setmarkerpos getpos heli1

"hummer1" setmarkerpos getpos car1

"hummer2" setmarkerpos getpos car2

"Respawn_West" setmarkerpos getpos Field_Aid

goto "loop"

Share this post


Link to post
Share on other sites

It was an attempt at making it work on the server, it was originally like that, but after mucking around with the execution of the script I made it each individual executes it rather then the group, (individually [this] exec did it, rather than _x for each units group etc) and it worked. huh.gifthumbs-up.gif

Share this post


Link to post
Share on other sites

I think you have the script running multiple times. Just exec the script from init.sqs ([] exec "script.sqs";) and it will run on each client and the server.

The array that is passed to the script is just an array of variables, not a way of running commands on specific client.

Share this post


Link to post
Share on other sites

Tried that tounge2.gif

Doesnt work, the only thing that works is making each individual execute it. whistle.gif

Share this post


Link to post
Share on other sites

Init.sqs is run on everyone so a script executed there gets executed by all. If it doesn't work then you're doing it wrong.

init.sqs goes into mission directory

to exec a script without parameters:

[] exec "scriptname.sqs";

Share this post


Link to post
Share on other sites

Metal Heart is right. You don't fully understand the scripting language and mp enviroment. Just because you've got it work in someway by trial and error it doesn't mean you've found the right way.

1. M1 = {heli1} setmarkerpos getpos heli1

This line will give you an error message in game. OFP variables can't store a direct command line. You would need a tricky combination of string varibale/format for this.

And to make a script execute on the server only you have to place a gamelogic on map, name it server and make the first line of the script if (! local server) then {exit}

2. this exec "script.sqs" is run on every connected PC. When you add this for 12 group members the script is running 12 times on every PC.

3. There's no difference in adding this exec "script.sqs" to all soldiers of a group or a single {_x exec "script.sqs"} foreach units group this if done correctly.

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  

×