OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: trooper543 on 22 Oct 2008, 14:13:40
-
Hi there all
I did a search of the forums and found no joy
What i am looking for is a script that will allow the players in MP to have the ability to drag or carry an ammo box
if there is someone out there that is willing to share or help me out with this then it will be greatly appreciated
Many thanx in advance
-
check mapfact skillz addon :good:
-
ok first:
-In init field of ammo box: this addAction ["Drag", "crate_ac.sqf", [0]]
===========================
crate_ac.sqf
_case = ((_this select 3) select 0);
switch (_case) do
{
case 0:
{
crate_dropped = false;
_crate = _this select 0;
_crate removeAction (_this select 2);
_user = _this select 1;
_user addAction ["Drop Crate", "crate_ac.sqf", [1]];
while {!crate_dropped} do
{
_pos = _user modelToWorld [0,4,0];
_crate setPos (_pos);
_crate setDir (getDir _user);
Sleep 0.5;
};
_crate setPos [(getPos _crate select 0), (getPos _crate select 1), (getPos _crate select 2)];
_crate addAction ["Drag", "crate_ac.sqf", [0]];
};
case 1:
{
_user = _this select 1;
_user removeAction (_this select 2);
crate_dropped = true;
};
};
===========================
This is untested, but should work.
ALSO
This will work just fine in MP, though there is more I could do if you want to make it work for Join in Progress players and players currently in the map as far as the actions 'state' would be at.
-
@ Da Chevs
Many thanks for this mate it is most appreciated !!
If you dont mind it, i would be very grateful if you could add in the Join Progress etc that would be most appreciated
Many Many thanks in advance
Just testing out the script
@ DaChevs
Man this really works a treat !!
Would it be possible to have the ammo crate slightly closer ?
Is there a way that the Drag can be limited to a type of soldier class?
It is okay of you cant get it there, but this would be much appreciated if you could add the JIP stuff as well
Again many thanks for this
Again many thanks in advance, certainly gonna make MP games more intresting
-
There isn't really a JIP problem with it as it is, but a more general MP one (though fixing the MP problem would need to take into account JIP). It is just that while you are dragging it, everyone else will still see the "drag" action on it and thus be able to start dragging it at the same time (= real mess ;P).
You might want to use this to prevent corpses hugging crates indefinitely:
while { !crate_dropped and (alive _user)} do
-
@ Spooner
Thanks for that mate, but i am no scripter when it comes to sqf where would i insert your bit of the script into chevs ?
many thanks
-
Exactly as Spooner stated as this is what I was mentioning/meant.
Anyways:
*EDIT* Hmmm...went in for a test with this, and recieved no errors, but also no action :/
Any ideas Spooner?
In init field of crate:
nil = [this] execVM "crate_watch.sqf";
crate_watch.sqf
if (isServer) exitWith {};
DCV_allow_drag = true;
DCV_allow_drop = false;
DCV_disable_drag_action = 0;
DCV_allow_drop_action = 0;
_crate = _this select 0;
while {alive _crate} do
{
if (DCV_allow_drag) then
{
if (DCV_disable_drag_action == 0) then
{
player removeAction DCV_allow_drop_option;
DCV_allow_drop_action = 0;
publicVariable "DCV_allow_drop_action";
DCV_allow_drag_option = _crate addAction ["Drag", "crate_ac.sqf", [0]];
DCV_disable_drag_action = 1;
publicVariable "DCV_disable_drag_action";
};
};
if (DCV_allow_drop) then
{
_crate removeAction DCV_allow_drag_option;
if (DCV_allow_drop_action == 0) then
{
DCV_allow_drop_option = player addAction ["Drop", "crate_ac.sqf", [1]];
DCV_allow_drop_action = 1;
publicVariable "DCV_allow_drop_action";
DCV_disable_drag_action = 0;
publicVariable "DCV_disable_drag_action";
};
};
Sleep 1;
};
======================================
crate_ac.sqf
_case = ((_this select 3) select 0);
switch (_case) do
{
case 0:
{
crate_dropped = false;
_crate = _this select 0;
DCV_allow_drag = false;
publicVariable "DCV_allow_drag";
DCV_allow_drop = true;
publicVariable "DCV_allow_drop";
while {!crate_dropped} do
{
_pos = _user modelToWorld [0,4,0];
_crate setPos (_pos);
_crate setDir (getDir _user);
Sleep 0.5;
};
_crate setPos [(getPos _crate select 0), (getPos _crate select 1), (getPos _crate select 2)];
DCV_allow_drag = true;
publicVariable "DCV_allow_drag";
};
case 1:
{
_user = _this select 1;
crate_dropped = true;
DCV_allow_drop = false;
publicVariable "DCV_allow_drop";
};
};