Forum Jump :

Author Message


Posts: 23
Rank:


Level: Member

Country: us
Location:
Occupation:
Age: 21
In-game name:

 
#1 Posted at 2015-08-20 02:50        
     
Hello, I am not the best when it come to scripting however can someone help me make the MP friendly??

First spawn a vehicle and name it "fr" and put bellow in the init line
gl = fr addAction ["Grap Ladder", "ladder.sqf"];

Ladder.sqf (Spawns the Ladder and attaches it to player)
if (side player == resistance) then {
Ladder = createVehicle ["Land_ladder_half", getPos player, [], 20, "CAN_COLLIDE"]; 
nObject = getPos player nearestObject "Land_ladder_half"; 
nObject  attachTo [player, [.5, 1, 1] ];
dlaction = player addAction ["Detach Ladder", "dLadder.sqf"];
fr removeAction gl;[code]
fra = fr addAction ["Put Away Ladder", "pLadder.sqf"];
};
[/code]

dLadder.sqf (detaches ladder from player)
if (side player == resistance) then {
detach Ladder;
player removeAction dlaction;
fr removeAction fra;
La = Ladder addAction ["Carry Ladder", "cLadder.sqf"];
};


cLadder.sqf (carrys the ladder)
if (side player == resistance) then {
Ladder removeAction la;
Ladder attachTo [player, [.5, 1, 1] ];
dlaction = player addAction ["Detach Ladder", "dLadder.sqf"];
fra = fr addAction ["Put Away Ladder", "pLadder.sqf"];
};

pLadder.sqf (puts away ladder aka delete)
if (side player == resistance) then {
fr removeAction fra;
deleteVehicle Ladder;
player removeAction dlaction;
gl = fr addAction ["Grap Ladder", "ladder.sqf"];
};

This post was edited by DaThrillerKiller (2015-08-20 03:17, ago)


Author Message


Posts: 59
Rank:


Level: Member

Country: ca
Location: Quebec
Occupation:
Age:
In-game name:

 
#2 Posted at 2015-08-20 13:36        
     
There is probably a better way of writing all this...
Also, I am not on a gaming PC, so I cannot test this right now.
The following should be MP compatible. However, the way you are referring to Ladder is global. This means that only one ladder may exist. That's fine if you only have one player in your mission. But if you have two players or more, and each execute this action, they will all be referring to the same ladder. It won't work out.
You would have to execute all actions within the same script.

INIT LINE
gl = fr addAction ["Grap Ladder", "ladder.sqf",nil,0,false,true,"","side _this == Independent"];

Ladder.sqf
private ["_player"];
_player = _this select 1;
Ladder = createVehicle ["Land_ladder_half", getPos _player, [], 20, "CAN_COLLIDE"]; 
nObject = getPos _player nearestObject "Land_ladder_half"; 
nObject  attachTo [_player, [.5, 1, 1] ];
dlaction = _player addAction ["Detach Ladder", "dLadder.sqf",nil,0,false,true,"","side _this == Independent"];
fr removeAction gl;
fra = fr addAction ["Put Away Ladder", "pLadder.sqf",nil,0,false,true,"","side _this == Independent"];

dLadder.sqf
private ["_player"];
_player = _this select 1;
detach Ladder;
_player removeAction dlaction;
fr removeAction fra;
La = Ladder addAction ["Carry Ladder", "cLadder.sqf",nil,0,false,true,"","side _this == Independent"];

cLadder.sqf
private ["_player"];
_player = _this select 1;
Ladder removeAction la;
Ladder attachTo [_player, [.5, 1, 1] ];
dlaction = _player addAction ["Detach Ladder", "dLadder.sqf",nil,0,false,true,"","side _this == Independent"];
fra = fr addAction ["Put Away Ladder", "pLadder.sqf",nil,0,false,true,"","side _this == Independent"];

pLadder.sqf
private ["_player"];
_player = _this select 1;
fr removeAction fra;
deleteVehicle Ladder;
_player removeAction dlaction;
gl = fr addAction ["Grap Ladder", "ladder.sqf",nil,0,false,true,"","side _this == Independent"];

This post was edited by Pwner Actual (2015-08-20 14:32, ago)


Advertisement


Author Message


Posts: 23
Rank:


Level: Member

Country: us
Location:
Occupation:
Age: 21
In-game name:

 
#3 Posted at 2015-08-20 21:42        
     
Thanks for the feed back. I will see if it work and use it for now

Things i was trying to fix.
    abilty to have more then one ladder
    instead of using "fr" maybe add the action by class name (so all of the same vehicles have the action)aka Fire Engine

Added 9 minutes later:

Yeah you probably could simplify it and make it all one file but im don't have the best knowledge with function and things like that

This post was edited by DaThrillerKiller (2015-08-20 21:52, ago)