odyseus 19 Posted July 1, 2013 Hello guys, A good friend of my and of the community (F2k Sel) help transform my idea into an script. He made an SP version that works great! :D Now I would like to request you guyses help to transform it into a MP version. here it goes pack_box.sqf /////////////////////////////////////////// // S M A L L B O X P A C K U P // /////////////////////////////////////////// //----------- M A I N B O X ------------------- _big_box = _this select 0; _big_box setvariable ["box_state",true,true]; detach _big_box; deletevehicle (nearestobject [_big_box,"land_pallet_f"]);// delete old pallet _big_box setVectorUp [0,0,1]; sleep 0.1; _big_box setposatl [getposatl _big_box select 0,getposatl _big_box select 1,0]; //_big_box setVectorUP (surfaceNormal [(getPosATL _big_box) select 0,(getPosATL _big_box) select 1]); //Hint str (_big_box getvariable "box_state"); //--------- S M A L L B O X E S ---------------- _small_boxes = _big_box getvariable "small_boxes"; _temp = _small_boxes; { _x hideobject true; if (!alive _x) then { _small_boxes = _small_boxes - [_x]; deletevehicle _x; }; } foreach _temp; _big_box setvariable ["small_boxes",_small_boxes,true]; setup_unpack_box.sqf //////////////////////////////////////// // B I G B O X S E T U P // //////////////////////////////////////// // // nul=[this,true/false,optional false] execvm "setup_unpack_box.sqf" // this = large box // true = pack at start of mission // true weapons/items removed from big box. // //----------- M A I N B O X ------------------- _big_box = _this select 0; _state = _this select 1; _empty = _this select 2; if (isnil ("_empty")) then {_empty = true;}; if (_empty) then { clearMagazineCargo _big_box;// remove magazines clearWeaponCargo _big_box; // remove weapons clearitemCargo _big_box; // remove items }; _big_box setvariable ["box_state",_state,true]; _big_box addaction ["Unpack","big_box\unpack_box.sqf",0,0,true,true,""," _target getvariable 'box_state' and player distance _target < 3"]; _big_box addaction ["Pack_up ","big_box\Pack_box.sqf",0,0,true,true,""," !(_target getvariable 'box_state') and player distance _target < 3"]; //--------- S M A L L B O X E S ---------------- _small_boxes = nearestobjects [_big_box,["thingx"],5]-[_big_box];// find ammo boxes within meters and pack them _big_box setvariable ["small_boxes",_small_boxes,true]; if (_state) then { { _x hideobject true;} foreach _small_boxes; }; // hint str _small_boxes; unpack_box.sqf ////////////////////////////////////////// // S M A L L B O X U N P A C K // ////////////////////////////////////////// //----------- M A I N B O X ------------------- _big_box = _this select 0; _big_box setvariable ["box_state",false,true]; _place = createVehicle ["land_pallet_f",getpos _big_box,[], 0, "can_collide"];// fixed point _place setdir getdir _big_box; _place hideobject true; _big_box attachto [_place,[0,0,0.08]]; _big_box setVectorUp [0,0,-1]; // Hint str (_big_box getvariable "box_state"); sleep 0.1; //--------- S M A L L B O X E S ---------------- _small_boxes = _big_box getvariable "small_boxes"; { _place = createVehicle ["land_pallet_F",getpos _big_box,[], 0, "none"]; _place hideobject true; _x setpos getpos _place; //_x setpos [getpos _big_box select 0,getpos _big_box select 1,0.1]; deletevehicle _place; _x hideobject false; } foreach _small_boxes; Thank you! :D Share this post Link to post Share on other sites
Larrow 2155 Posted July 1, 2013 OMG had a flash back to the early 90's then, all that ;) Share this post Link to post Share on other sites
odyseus 19 Posted July 1, 2013 omg had a flash back to the early 90's then, all that big box, little box ;) :d lol Share this post Link to post Share on other sites
odyseus 19 Posted July 1, 2013 any MP guru here that can help a brother out!? Thx :icon_hug: Share this post Link to post Share on other sites
kylania 546 Posted July 1, 2013 Looks like it might work, the main concern would be the addActions. You'd wanna use BIS_fnc_MP or something like CBA to add that to the box for all the players. Share this post Link to post Share on other sites
odyseus 19 Posted July 1, 2013 Do not laught please. But do you mean like this ? just by calling the script like that do you think it may work? :p "setup_unpack_box.sqf","BIS_fnc_execVM",true,true] spawn BIS_fnc_MP; Share this post Link to post Share on other sites
kylania 546 Posted July 1, 2013 No, I meant the addAction lines inside the script itself. addAction is "local" meaning if one person runs the command, others won't see it. So everyone would need to run that part of the script. I think you can use BIS_fnc_MP for that, but haven't tested it out yet. :) Share this post Link to post Share on other sites
odyseus 19 Posted July 2, 2013 hey kylania i have try it and was not successful.:( Share this post Link to post Share on other sites
f2k sel 145 Posted July 3, 2013 From what I've read addaction needs to be broadcast as we know it's local, one way was to use setvehicleinit but they changed that so I don't know how in SP it can be tested anymore. maybe call re still works _null=[nil, player, "per", rADDACTION, "Add damage", "damage.sqf", [], 1, true, true, "", ""]] call RE; thing Hideobject true; would be _nic = [nil, thing, "per", rHideObject, true] call RE; but I'm not sure about setvectorup nothing mentioned allowdamage This command only works locally and must be run on all machines to have global affect. would that be Call re again? setpos seems to be global again createvehicle server side only (not sure how) attachto needs to run on just one client (not sure how) deletevehicle no mention of locality I know remember why I gave up MP scripting in OFP Share this post Link to post Share on other sites
odyseus 19 Posted July 4, 2013 I guess that mean no one! :( Maybe a example or something! :D Share this post Link to post Share on other sites