Jump to content

Zeraw

Member
  • Content Count

    10
  • Joined

  • Last visited

  • Medals

Community Reputation

0 Neutral

About Zeraw

  • Rank
    Private

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. That's slick! Never had tu use params before. So, if I get it the returned value of the command you call before params are assigned to the variables you declared after it? That's the script with the driver removed: [ getMarkerPos "HALOstart_3", random 360, selectRandom[ "CUP_B_RHIB2Turret_USMC", "B_G_Boat_Transport_01_F" ], side player ] call BIS_fnc_spawnVehicle params[ "_boat", "_crew", "_boatGroup" ]; {deleteVehicle _x} forEach crew (_boat); player moveInDriver _boat; { _x assignAsCargo _boat; _x moveInAny _boat; }forEach ( units group player - [ player ] );
  2. @Larrow sounds about right when I fiddled with boatBase = _boatframe1 select 0; It returned with an error "dividing by zero" as for an empty array. thanks a lot!
  3. Ok thanks! I'll try that and get back to you!
  4. Hey Guys! I'm struggling with a "variable not define" error for the variable boatBase : _BoatType = ["CUP_B_RHIB2Turret_USMC","B_G_Boat_Transport_01_F"] call BIS_fnc_selectRandom; _chance1 = round (random 360); _boatframe1 = [getMarkerPos "Boatstart_3", _chance1, _BoatType] call BIS_fnc_spawnVehicle; boatBase = _boatframe1 select 0; player moveInDriver boatBase; { _x assignAsCargo (boatBase); _x moveInAny (boatBase);} foreach units group player; wierd thing is that I just copy passed it from another script I wrote and this one is working fine: _HstPos = getMarkerPos "HALOstart_2"; _planeType = ["B_T_VTOL_01_infantry_F","RHS_C130J"] call BIS_fnc_selectRandom; _rndowiz = round (random 360); planeTeam = creategroup WEST; _planeprep = [getMarkerPos "HALOstart_2", _rndowiz, _planeType, planeTeam] call BIS_fnc_spawnVehicle; planeBase = _planeprep select 0; {if (!isNull (unitBackpack _x) && (backpack _x) != "b_parachute") then { private ["_pack","_class","_magazines","_weapons","_items","_helmet"]; _pack = unitBackpack _x; _class = typeOf _pack; _magazines = getMagazineCargo _pack; _weapons = getWeaponCargo _pack; _items = getItemCargo _pack; _helmet = headgear _x; removeBackpack _x; //remove the backpack _x addBackpack "b_parachute"; //add the parachute [_x,_class,_magazines,_weapons,_items,_helmet] spawn { private ["_x","_class","_magazines","_weapons","_items","_helmet"]; _x = _this select 0; _class = _this select 1; _magazines = _this select 2; _weapons = _this select 3; _items = _this select 4; _helmet = _this select 5; private "_packHolder"; _packHolder = createVehicle ["groundWeaponHolder", [0,0,0], [], 0, "can_collide"]; _packHolder addBackpackCargoGlobal [_class, 1]; waitUntil {animationState _x == "HaloFreeFall_non"}; _packHolder attachTo [_x,[-0.12,-0.02,-.74],"pelvis"]; _packHolder setVectorDirAndUp [[0,-1,-0.05],[0,0,-1]]; waitUntil {animationState _x == "para_pilot"}; _packHolder attachTo [vehicle _x,[-0.07,0.67,-0.13],"pelvis"]; _packHolder setVectorDirAndUp [[0,-0.2,-1],[0,1,0]]; waitUntil isTouchingGround _x; detach _packHolder; deleteVehicle _packHolder; _x addBackpack _class; clearAllItemsFromBackpack _x; if (_helmet != "" && _helmet != "H_CrewHelmetplane_B") then {(unitBackpack _x) addItemCargoGlobal [_helmet, 1]}; //(not complete) do a check to see if there is available space for "_i" from 0 to (count (_magazines select 0) - 1) do { (unitBackpack _x) addMagazineCargoGlobal [(_magazines select 0) select _i,(_magazines select 1) select _i]; //return the magazines }; for "_i" from 0 to (count (_weapons select 0) - 1) do { (unitBackpack _x) addWeaponCargoGlobal [(_weapons select 0) select _i,(_weapons select 1) select _i]; //return the weapons }; for "_i" from 0 to (count (_items select 0) - 1) do { (unitBackpack _x) addItemCargoGlobal [(_items select 0) select _i,(_items select 1) select _i]; //return the items }; }; } else { if ((backpack _x) != "b_parachute") then {_x addBackpack "B_parachute"}; //add the parachute if unit has no backpack }} forEach units group player ; {if (headgear _x != "H_CrewHelmetplane_B") then {_x addHeadgear "H_CrewHelmetplane_B"}} foreach units group player; player moveInCargo planebase; { _x assignAsCargo (planeBase); _x moveIncargo (planeBase);} foreach units group player; planebase flyinHeight 3000; _HLPos = getMarkerPos "HALOdir_2"; _wp1 = planeTeam addWaypoint [( _HLPos), 0]; //Drop here [planeTeam, 2] setWaypointBehaviour "Aware"; _wp1 setWaypointType "MOVE"; _wp1 setWaypointSpeed "NORMAL"; _wp1 setWaypointCombatMode "red"; _wp1 setwaypointstatements ["true", "{deleteVehicle _x} forEach (crew vehicle this) + [vehicle this]; deleteGroup group this"]; {waitUntil {isTouchingGround _x && alive _x}; _x setDamage 0} forEach units group player; I refered myself to a couple of posts and the Community Wiki but still fail to see a solution... Thanks for the help!
  5. Thank you very much! That's more than I was expecting! Made It work thanks again! I'm updating the thread If someone needs it. Thanks again guys!
  6. I'm going to write that right now, thanks! Dumb question first though... What would be "_i"? because I understand that _x select 0 and _x select 1 is selecting the position in the array and storing it in _x but i don't understand "_i"....
  7. Hey man! Thanks for your reply Ok I'll try Mr H. solution again maybe I F**** up somewhere else. Your snippet would only remove one of each item and I would like to have a certain number of each items to be removed.
  8. Hey! sorry for the late reply. @Mr H. Tried that and it's still telling me that it is expecting a string not an array @killzone_kid The 1st number represents the quantity of items the second the number of "bullets" in the item as interactive items in Ravage are treated as magazines. I tried without the second number as I want the Items to be brought back at full capacity but it didn't work either. I'm getting stuck here because I would like different quantities of several different Items to be in the player inventory in order to trigger the script and I'm trying to put them in an array to be able to use it as a template for other tasks that would have the same goal but with different items.
  9. Thanks for the reply! I spent hours on your website, a lot of very intersting stuff! Would you mind giving me a bit more of a push? These are my first scripts in .sqf. Ths is what I've tried.... not working... {if (_x in magazines player) then { player removeMagazine _x; } else { if (_x in (backpackItems player)) then { player removeItemFromBackpack _x; } else { if (_x in (vestItems player)) then { player removeItemFromVest _x; } else { if (_x in (uniformItems player)) then { player removeItemFromUniform _x; } else { if (_x1 in weapons player) then { player removeWeaponGlobal _x; } else { player removeItem _x; }; }; }; }; };} foreach [["FirstAidKit",5],["rvg_antiRad",5,6],["rvg_money",1000,1],["rvg_canisterFuel",1,20],["rvg_toolkit",1,3],["rvg_purificationTablets",5,6]];
  10. Hey Guys! I would need your help regarding a piece of script that I'm trying to write. I try to simulate the player returning several items to an AI in order to complete a task. The intended behavior of this script is: _Check for a specific numbers of Items in the player's inventory ex.: 5 x firstAidkit, 1 x ToolBox, 5 x AntiRad etc, etc... _Remove the items that have been requested to complete the task _Set the task RECOVER ITEM to SUCCEEDED _Remove the "Give Item" action (quest_22) _Save the game _Add an Item to giftbox2 This is what I came out with : _questitems1 = [["FirstAidKit",5],["rvg_antiRad",5,6],["rvg_money",1000,1],["rvg_canisterFuel",1,20],["rvg_toolkit",1,3],["rvg_purificationTablets",5,6]]; if (_questitems1 in magazines player) then { player removeMagazine _questitems1; } else { if (_questitems1 in (backpackItems player)) then { player removeItemFromBackpack _questitems1; } else { if (_questitems1 in (vestItems player)) then { player removeItemFromVest _questitems1; } else { if (_questitems1 in (uniformItems player)) then { player removeItemFromUniform _questitems1; } else { if (_questitems1 in weapons player) then { player removeWeaponGlobal _questitems1; } else { player removeItem _questitems1; }; }; }; }; }; ["RECOVER ITEM", "SUCCEEDED",true] spawn BIS_fnc_taskSetState; quest2 removeAction quest_22; sleep 3; saveGame; quest2 addAction ["Talk to Theo",{cutText ["<t size='2'>Thanks for blablabla.</t>","PLAIN", -1, true, true],nil,1,true, true,"","true",3,false}]; giftbox2 addItemCargo ["Item_B_UavTerminal", 1]; I'm missing something in my nested statements as I tried to get it work with a unique item at first and it doesn't work. I'm not sure about the use of multi-dimensional array here but I don't see/know other ways to set differrent item with different quantities under one array. Some of the relevant pages I've checked out so far: https://community.bistudio.com/wiki/Array#Multi-dimensional_arrays https://community.bistudio.com/wiki/Control_Structures https://forums.bohemia.net/forums/topic/145490-check-player-for-a-item/ http://killzonekid.com/arma-scripting-tutorials-arrays-part-1/ I've been looking at it for too long now so I could use a fresh pair of eyes. Thank you. UPDATE: The solution to my problem. { if ((_x select 0) in magazines player) then {for "_i" from 1 to (_x select 1) do { player removeMagazine (_x select 0)}; } else { if ((_x select 0) in items player) then {for "_i" from 1 to (_x select 1) do { player removeItem (_x select 0)}; } else { if ((_x select 0) in backpackItems player) then { for "_i" from 1 to (_x select 1) do { player removeItemFromBackpack (_x select 0)}; } else { if ((_x select 0) in vestItems player) then { for "_i" from 1 to (_x select 1) do { player removeItemFromVest (_x select 0)}; } else { if ((_x select 0) in uniformItems player) then {for "_i" from 1 to (_x select 1) do { player removeItemFromUniform (_x select 0)}; } else { if ((_x select 0) in weapons player) then {for "_i" from 1 to (_x select 1) do { player removeWeaponGlobal (_x select 0)}; }; }; }; }; }; }; }foreach [["FirstAidKit",5],["rvg_antiRad",5],["rvg_money",1000],["rvg_canisterFuel",1],["rvg_toolkit",1],["rvg_purificationTablets",5]]; Enjoy!
×