Home   Help Search Login Register  

Author Topic: MP Ammo Box supply  (Read 1662 times)

0 Members and 1 Guest are viewing this topic.

Offline trooper543

  • Members
  • *
MP Ammo Box supply
« 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


Offline kju

  • Members
  • *
    • PvPScene - The ArmA II multiplayer community
Re: MP Ammo Box supply
« Reply #1 on: 23 Oct 2008, 21:22:09 »
check mapfact skillz addon  :good:

Offline ModestNovice

  • Members
  • *
Re: MP Ammo Box supply
« Reply #2 on: 24 Oct 2008, 07:53:30 »
ok first:

-In init field of ammo box:
Code: [Select]
this addAction ["Drag", "crate_ac.sqf", [0]]
===========================
crate_ac.sqf
Code: [Select]
_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.

« Last Edit: 24 Oct 2008, 07:55:34 by DaChevs »
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline trooper543

  • Members
  • *
Re: MP Ammo Box supply
« Reply #3 on: 24 Oct 2008, 13:28:47 »
@ 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
« Last Edit: 24 Oct 2008, 18:42:30 by bedges »

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: MP Ammo Box supply
« Reply #4 on: 24 Oct 2008, 22:14:41 »
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:
Code: [Select]
while { !crate_dropped and (alive _user)} do
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline trooper543

  • Members
  • *
Re: MP Ammo Box supply
« Reply #5 on: 24 Oct 2008, 22:43:25 »
@ 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


Offline ModestNovice

  • Members
  • *
Re: MP Ammo Box supply
« Reply #6 on: 25 Oct 2008, 00:48:30 »
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:
Code: [Select]
nil = [this] execVM "crate_watch.sqf";

crate_watch.sqf
Code: [Select]
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
Code: [Select]
_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";
};
};









« Last Edit: 25 Oct 2008, 00:57:08 by DaChevs »
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley