OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Sniperwolf572 on 03 Jan 2006, 00:28:41
-
OK I have the following script:
_Injured=_This Select 0
_DragBy=Player
TEN_RESCUER = _DragBy
TEN_RESCUEE = _Injured
publicvariable "TEN_RESCUER"
publicvariable "TEN_RESCUEE"
~0.1
_dragvehicle = "TEN_DragVeh" createVehicle getPos _Injured
TEN_MAGICVEHICLE = _dragvehicle
publicvariable "TEN_MAGICVEHICLE"
~0.2
_Injured assignAsCargo _dragvehicle
_Injured moveInCargo _dragvehicle
_DragBy assignAsDriver _dragvehicle
_DragBy moveInDriver _dragvehicle
#check
? count crew vehicle _dragvehicle == 1 : goto "eject"
~1
? count crew vehicle _dragvehicle >= 2 : goto "check"
#eject
_Injured action ["eject", vehicle _Injured]
_DragBy action ["eject", vehicle _DragBy]
deleteVehicle _dragvehicle
exit
Works flawlessly in SP, its a dragging script that I want to implement in Safety's USMC Pack (Will be open source to anyone who wants to incorporate it into their infantry packs).
Problem is that I'm not experienced in MP scripting, altough I read all available tutorials on OFPEC about MP scripting, it's just not working.
Someone please assist on what am I doing wrong.
-
i think the problem is that the loop is exiting before the player has entered the vehicle
insert a time-delay above the #check loop
or use:
@(vehicle player != player)
to setup a condition where the script carries-on when the player is no longer wihtout a vehicle
......
......
_inj_original_veh = vehicle _injured <<<<<<< find original vehicles
_drag_original_veh = vehicle _dragby
~0.2
_Injured assignAsCargo _dragvehicle
_Injured moveInCargo _dragvehicle
_DragBy assignAsDriver _dragvehicle
_DragBy moveInDriver _dragvehicle
@(player vehicle != _drag_original_veh) && (_dragby vehicle != _inj_original_veh) << check when moved
#check
~1 <<<<<<< time delay inserted before checks
? count crew vehicle _dragvehicle == 1 : goto "eject"
? count crew vehicle _dragvehicle >= 2 : goto "check"
.......
......
give it a go anyway and see how you get on
i'm not sure what you're trying to do with your publicvariable commands - everything you want to achieve can be done by sending commands clientside i think - publicvariables need to be sent to update arrays and sync sidechat, hint messages, for example.
-
Actually, I just ran into publicVariable command and just placed it there, I tought it might help (shows how much I know about MP scripting :P ).
Anyhow, I will try the solution and post the results, trying to find MP server to test this on.
BTW A question, if one player hosts and other is client, will I get same results on both PC's as if I had a dedicated server and both players were clients?
If so, it would make the MP testing process much easier.
-
testing on 2 comps is a good way to do it - the hosting comp is the server
setup a few bodies and you and your friend should be able to drag them if you have initialised the scripts on each machine.
If he cant see you inside the drag vehi or he doesnt have the option to drag then yo know somethings wrong. I have a hunch it will work though.
read SNYPIRS ofpec guide to MP for sure
http://www.ofpec.com/editors/browse.php?category=1_4
-
Doesnt work:
Player 1 server
Player 2 client
Situation 1 - Player1 drags Player2:
Drag vehicle created, Player 1 jumps in Player 2 remains stationary, Player1 is ejected because vehicle only contains him
Situation 2 - Player2 drags Player1:
Clicking "Drag" option, nothing happens
Situation 3 - Player1 drags AI:
Works fine for Player1, Player2 can see Player1 dragging AI
Situation 4 - Player2 drags AI:
Impossible, same result as situation 2
-
Just saw the pic of your anim on ofp.info (awesome job mate, :thumbsup:) and then remembered this thread... If your problem is not solved, through what device do you add the action to the units ? Init line, init .sqs, something else ?
Check my answer here (http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi?s=52f8f7aaf96ad680d63a92b8def80bfd;act=ST;f=54;t=49960;st=30;r=1;&#entry829572).