fn_Refillbox.sqf

  • Offline GSN_Pager
  • Fresh Spawn
  • *
  • Posts: 19
  • If it is broken, tell me once not over and over.

fn_Refillbox.sqf

« posted: Nov 08, 2013, 03:11 PM »
This is the big problem I'm having that it won't spawn what I want in the box it just spawns the crate as a default crate with default items and weapons in it. I have tried both the old script and your new script. To get the LRR .408 (srifle_LRR_SOS_F) you need to use the NATO Special Weapons Crate (Box_NATO_WpsSpecial_F) but it still spawns default stuff and default amounts not what I want in it. Guess my question is: Can it be made to spawn only the stuff and amount of stuff (Ammo, Weapons, and Items) I want in it and not all the stuff I don't like scopes and grenades ect ect?
  • Offline AgentRev
  • Developer
  • Veteran
  • ******
  • Posts: 2652

Re: fn_Refillbox.sqf

« Reply #1 posted: Nov 08, 2013, 06:25 PM »
Could explain first how are you trying to spawn your crate? Perhaps show us your code?
  • Offline GSN_Pager
  • Fresh Spawn
  • *
  • Posts: 19
  • If it is broken, tell me once not over and over.

Re: fn_refillbox.sqf

« Reply #2 posted: Nov 09, 2013, 12:59 AM »
From all the Missions.sqf

//   @file Version: 1.0
//   @file Name: mission_AirWreck.sqf
//   @file Author: [404] Deadbeat, [404] Costlyy
//   @file Created: 08/12/2012 15:19
//   @file Args:

if (!isServer) exitwith {};
#include "sideMissionDefines.sqf";

private ["_result", "_missionMarkerName", "_missionType", "_startTime", "_returnData", "_randomPos", "_randomIndex", "_vehicleClass", "_box", "_box2", "_vehicle", "_picture", "_vehicleName", "_hint", "_currTime", "_playerPresent", "_unitsAlive"];

//Mission Initialization.
_result = 0;
_missionMarkerName = "AirWreck_Marker";
_missionType = "Aircraft Wreck";
_startTime = floor(time);

diag_log format["WASTELAND SERVER - Side Mission Started: %1",_missionType];

//Get Mission Location
_returnData = call createMissionLocation;
_randomPos = _returnData select 0;
_randomIndex = _returnData select 1;

diag_log format["WASTELAND SERVER - Side Mission Waiting to run: %1",_missionType];
[sideMissionDelayTime] call createWaitCondition;
diag_log format["WASTELAND SERVER - Side Mission Resumed: %1",_missionType];

[_missionMarkerName,_randomPos,_missionType] call createClientMarker;

//Vehicle Class, Posistion, Fuel, Ammo, Damage
_vehicle = ["O_Heli_Light_02_unarmed_F",[(_randomPos select 0) + 50, (_randomPos select 1) + 50,0],0,0,1,"NONE"] call createMissionVehicle;

_box = createVehicle ["Box_NATO_WpsLaunch_F",[(_randomPos select 0), (_randomPos select 1),0],[], 0, "NONE"];
[_box,"mission_USLaunchers"] call fn_refillbox;
_box allowDamage false;
_box setVariable ["R3F_LOG_disabled", true, true];

_box2 = createVehicle ["Box_IND_WpsSpecial_F",[(_randomPos select 0), (_randomPos select 1) - 10,0],[], 0, "NONE"];
[_box2,"mission_Main_A3snipers"] call fn_refillbox;
_box2 allowDamage false;
_box2 setVariable ["R3F_LOG_disabled", true, true];


_picture = getText (configFile >> "cfgVehicles" >> typeOf _vehicle >> "picture");
_vehicleName = getText (configFile >> "cfgVehicles" >> typeOf _vehicle >> "displayName");
_hint = parseText format ["<t align='center' color='%4' shadow='2' size='1.75'>Side Objective</t><br/><t align='center' color='%4'>------------------------------</t><br/><t align='center' color='%5' size='1.25'>%1</t><br/><t align='center'><img size='5' image='%2'/></t><br/><t align='center' color='%5'>A helicopter has come down under enemy fire!</t>", _missionType, _picture, _vehicleName, sideMissionColor, subTextColor];
[_hint] call hintBroadcast;

_CivGrpM = createGroup civilian;
[_CivGrpM,_randomPos] spawn createLargeGroup;

diag_log format["WASTELAND SERVER - Side Mission Waiting to be Finished: %1",_missionType];
_startTime = floor(time);

waitUntil
{
    sleep 1;
   _playerPresent = false;
   _currTime = floor(time);
    if(_currTime - _startTime >= sideMissionTimeout) then {_result = 1;};
    {if((isPlayer _x) AND (_x distance _box <= missionRadiusTrigger)) then {_playerPresent = true};}forEach playableUnits;
    _unitsAlive = ({alive _x} count units _CivGrpM);
    (_result == 1) OR ((_playerPresent) AND (_unitsAlive < 1)) OR ((damage _box) == 1)
};

_box setVariable ["R3F_LOG_disabled", false, true];
_box2 setVariable ["R3F_LOG_disabled", false, true];

if(_result == 1) then
{
   //Mission Failed.
    if (!isNil "_box") then { deleteVehicle _box };
    if (!isNil "_box2") then { deleteVehicle _box2 };
    if (!isNil "_vehicle") then { deleteVehicle _vehicle };
    { deleteVehicle _x }forEach units _CivGrpM;
    deleteGroup _CivGrpM;
    _hint = parseText format ["<t align='center' color='%4' shadow='2' size='1.75'>Objective Failed</t><br/><t align='center' color='%4'>------------------------------</t><br/><t align='center' color='%5' size='1.25'>%1</t><br/><t align='center'><img size='5' image='%2'/></t><br/><t align='center' color='%5'>Objective failed, better luck next time.</t>", _missionType, _picture, _vehicleName, failMissionColor, subTextColor];
   [_hint] call hintBroadcast;
    diag_log format["WASTELAND SERVER - Side Mission Failed: %1",_missionType];
} else {
   //Mission Complete.
    deleteVehicle _vehicle;
    deleteGroup _CivGrpM;
    _hint = parseText format ["<t align='center' color='%4' shadow='2' size='1.75'>Objective Complete</t><br/><t align='center' color='%4'>------------------------------</t><br/><t align='center' color='%5' size='1.25'>%1</t><br/><t align='center'><img size='5' image='%2'/></t><br/><t align='center' color='%5'>The airwreck supplies have been collected, well done.</t>", _missionType, _picture, _vehicleName, successMissionColor, subTextColor];
   [_hint] call hintBroadcast;
    diag_log format["WASTELAND SERVER - Side Mission Success: %1",_missionType];
};

//Reset Mission Spot.
MissionSpawnMarkers select _randomIndex set[1, false];
[_missionMarkerName] call deleteClientMarker;

That's from the mission_AirWreck.sqf the only thing I have changed-Tried is switching to a different crate.

My fn_refillbox.sqf NEW and OLD are attached to this Post.
  • Offline AgentRev
  • Developer
  • Veteran
  • ******
  • Posts: 2652

Re: fn_Refillbox.sqf

« Reply #3 posted: Nov 10, 2013, 10:56 PM »
At first glance, I can say that your "new" fn_refillbox.sqf is missing this at the end:

Code: [Select]
} forEach _boxItems;
You might want to add -showScriptErrors to your game's launch options.
  • Offline GSN_Pager
  • Fresh Spawn
  • *
  • Posts: 19
  • If it is broken, tell me once not over and over.

Re: fn_Refillbox.sqf

« Reply #4 posted: Nov 13, 2013, 12:48 AM »
Sorry it took so long been kinda busy. here is what you asked for.
  • Offline AgentRev
  • Developer
  • Veteran
  • ******
  • Posts: 2652

Re: fn_Refillbox.sqf

« Reply #5 posted: Nov 14, 2013, 03:11 AM »
I didn't ask for your logs, I suggested you to add the showScriptErrors option in the game launch parameters, so you can see when errors happen directly in-game.