Jump to content
Sign in to follow this  
crushenator

Script works for me but not other players?

Recommended Posts

I've got a script attached to a helicopter to send it away with an addaction however it only works for me. With other players in the server it seems to do everything in the script (for example if I put sidechat) except the actual heli move part. Any ideas?

This raises a further more broad question. Are their major scripting considerations for making coop missions instead of single player missions?

Thanks!

private ["_heli", "_caller", "_id", "_heligroup"];

_heli = _this select 0;

_caller = _this select 1;

_id = _this select 2;

_heligroup = group (assigneddriver _heli);

_heli removeAction _id;

_heligroup move getpos land2;

Share this post


Link to post
Share on other sites

This raises a further more broad question. Are their major scripting considerations for making coop missions instead of single player missions?

Have to make sure scripts get executed across all clients. I suggest you read up/search the forums about JIP (Join In Progress).

Share this post


Link to post
Share on other sites

Thanks mate. is JIP the problem I'm having with the first portion of the question?

_heligroup move getpos land2; just doesn't seem to work for the other player I was testing with!

Share this post


Link to post
Share on other sites

It's in a sqf script that is attached to an addaction which is in the init of a helicopter. Spoiler of the original post shows the whole script.

Edited by crushenator

Share this post


Link to post
Share on other sites

hmm, well your triggering the action from the heli, so it should work for more than just 1 person. but im not too experienced with multiplayer compatible scripts so im just speculating here.

i think the move command is your problem:

"Group or unit must be local to have global effect for this command."

and i think locality means being run on one computer, or it being local on that machine (im not sure which)

heres a link to multiplayer compatability that might help you better than me deciphering it.

http://community.bistudio.com/wiki/Locality_in_Multiplayer

it might be possible that your mate isnt a group leader that it wasnt working.

Share this post


Link to post
Share on other sites

The problem is probably this:

The move command requires the object to move to be local.

Addaction is local, meaning you add the action to the chopper. However, that does not mean the script is executed "at" the chopper. It is executed by the one who uses the action. So the script is only run on your machine if you are the one using the action.

AI units, unless controlled by a player, are local to the server. The reason it works for you is probably cause you are hosting a listen server?

The problem is you need to tell the machine controlling the chopper (actually the pilot or group) that you want it to move. Or alternatively tell everyone which is simpler and will work in this case.

To tell the others that you want to chopper to move you can use a trigger.

In your addAction-script you do something like this instead:

MoveTheChopperNow = true;
publicVariable "MoveTheChopperNow";

The first command sets the variable to true the other tells everybody else what the value of MoveTheChopperNow is now.

Then you make a trigger:

Condition: MoveTheChopperNow
On act: 0 = execVM "moveChopper.sqf";

This trigger will activate when MoveTheChopperNow is true (when you use the action).

In moveChopper.sqf you put the script that tells the chopper to move.

----------

Instead of using the assignedDriver just use driver. So what he isn't assigned? He still the one piloting the chopper.

Edited by Muzzleflash

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  

×