Ammo Crates Fix

Ok, what I ended up doing is setting my own variable on it like this....
Code:
_ammoBox setVariable ["KrixKeep",true,true];
And then find this line in your server pbo inside server_cleanup.fsm....
Code:
"{" \n
"    _keep = _x getVariable [""permaLoot"",false];" \n
"    _nearby = {isPlayer _x} count (_x nearEntities [[""CAManBase""], 250]);" \n
"" \n
and change it too.....
Code:
"{" \n
"    _keep = _x getVariable [""permaLoot"",false];" \n
"    _krixKeep = _x getVariable [""KrixKeep"",false];" \n
"    _nearby = {isPlayer _x} count (_x nearEntities [[""CAManBase""], 250]);" \n
"" \n
find this line....
Code:
"    if ( (!_keep) && (_nearby==0) && (_age > 60) ) then {" \n
change it too....
Code:
"    if ( (!_keep) && (_nearby==0) && (_age > 60) && (!_krixKeep) ) then {" \n
This should work just fine for any ammo box. Enjoy! :)
 
at which part of the server_cleanup code do you put:

_ammoBox setVariable ["KrixKeep",true,true];
 
You make _ammoBox equal your created object....

You need to make an .sqf run on just the server from your mission file to create the box...

The .sqf would look like this....
Code:
if (!isServer) exitWith {};
 
_boxPos = [4223.48,8392.66,0];
_ammoBoxModel = "USVehicleBox_EP1";
 
_ammoBox = createVehicle [_ammoBoxModel, _boxPos, [], 0, "CAN_COLLIDE"];
_ammoBox setDir 0.0;
_ammoBox setPos _boxPos;
 
_ammoBox setVariable ["KrixKeep",true,true];


This code is ran from your mission pbo most likely inside your init.sqf not from your server pbo... :)
 
You make _ammoBox equal your created object....

You need to make an .sqf run on just the server from your mission file to create the box...

The .sqf would look like this....
Code:
if (!isServer) exitWith {};
 
_boxPos = [4223.48,8392.66,0];
_ammoBoxModel = "USVehicleBox_EP1";
 
_ammoBox = createVehicle [_ammoBoxModel, _boxPos, [], 0, "CAN_COLLIDE"];
_ammoBox setDir 0.0;
_ammoBox setPos _boxPos;
 
_ammoBox setVariable ["KrixKeep",true,true];


This code is ran from your mission pbo most likely inside your init.sqf not from your server pbo... :)


how would you change its content, EDIT: does not work
 
how would you change its content, EDIT: does not work

It does work. I am currently using it. Where did you put the code in the code block above?

To change stuff inside you first clear it....
Code:
clearMagazineCargoGlobal _ammoBox;
clearWeaponCargoGlobal _ammoBox;

Then you add what you want....
Code:
_ammoBox addWeaponCargoGlobal ["M16A2", 5]; // What you want and how many you want.
_ammoBox addMagazineCargoGlobal ["30Rnd_556x45_Stanag", 50]; // Same here as above but with ammo.

What errors are you getting in your RPT?
 
do i ma
It does work. I am currently using it. Where did you put the code in the code block above?

To change stuff inside you first clear it....
Code:
clearMagazineCargoGlobal _ammoBox;
clearWeaponCargoGlobal _ammoBox;

Then you add what you want....
Code:
_ammoBox addWeaponCargoGlobal ["M16A2", 5]; // What you want and how many you want.
_ammoBox addMagazineCargoGlobal ["30Rnd_556x45_Stanag", 50]; // Same here as above but with ammo.

What errors are you getting in your RPT?

first do i make and sqf or paste it right in the init.sqf also shouldn't it be inside the brackets of the if statement to work?
 
Alright i got it working and i changed a bit of your code:

i put the code in the if

if (!isDedicated) then {

Then at the end INSIDE THE BRACKETS

i posted this

Code:
//box attributes
    _boxPos = [8108,9149,0];
    _ammoBoxModel = "USBasicAmmunitionBox";
 
    //Spawning the box
    _ammoBox = createVehicle [_ammoBoxModel, _boxPos, [], 0, "CAN_COLLIDE"];
    _ammoBox setDir 0.0;
    _ammoBox setPos _boxPos;
 
    //clear and add items
    clearMagazineCargoGlobal _ammoBox;
    clearWeaponCargoGlobal _ammoBox;
    _ammoBox addWeaponCargoGlobal ["M16A2", 1]; // What you want and how many you want.
    _ammoBox addMagazineCargoGlobal ["30Rnd_556x45_Stanag", 2]; // Same here as above but with ammo.
 
    //set variable
    _ammoBox setVariable ["KrixKeep",true,true];

then i did the same thing you did with the server.fsm

but i had to allow your keep variable in battleye as well soo

Code:
12.07.2013 21:25:47: GhostPhantom (184.158.59.75:3291) 141f03c043662bac888d873c31d39115 - #0 [COLOR=#ff0000]"krixkeep"[/COLOR] = true 3:0 USBasicAmmunitionBox

so i add this to the set variable line 1

Code:
!="krixkeep"

and it works!

problem is that it only spawns one box so now i will be building a Hidden_Chests.sqf that includes up to 10 boxes help would be appreciated! I can get the boxes working but i can't figure out how to spawn things randomly
 
What i have so far

Code:
//Ammo box spawn script by ghostphantom172
//Currently working on 1.7.7.1
//---------------------The CODE---------------------
//Box Models
    _ammoBoxModel1 = "USBasicAmmunitionBox";
    _ammoBoxModel2 = "GuerillaCacheBox";
 
//Box chances and types choice
    _boxtype = [["_ammoBoxmodel1"], ["_ammoBoxModel2"]]; //can not be changed
    _boxchance = [0.05, 0.05]; //50 50 chance
    _boxspawn = [_boxtype,_boxchance]
   
//-------Box 1 Information example--------   
//Box 1 attributes
    //box attributes
    _boxPos1 = [8108,9149,0]; //Change postion of ammo box one
 
//Ammo box 1 spawning
    //Spawning the box
    _ammoBox1 = createVehicle [_boxspawn, _boxPos1, [], 0, "CAN_COLLIDE"];
    _ammoBox1 setDir 0.0;
    _ammoBox1 setPos _boxPos1;
 
//Box model Contents
    //clear items
    clearMagazineCargoGlobal _boxspawn;
    clearWeaponCargoGlobal _boxspawn;
    //add items
    _boxspawn addWeaponCargoGlobal ["M16A2", 1]; // What you want and how many you want.
    _boxspawn addMagazineCargoGlobal ["30Rnd_556x45_Stanag", 2]; // Same here as above but with ammo.
   
//set variable
    _ammoBox1 setVariable ["KrixKeep",true,true]; //set If you want it to keep it or not
 
do i ma

first do i make and sqf or paste it right in the init.sqf also shouldn't it be inside the brackets of the if statement to work?

Yes, you would make a new .sqf for spawning the boxes and then inside your init.sqf you would execute the file. You want it only executed server side though not on each client.

I was trying not to hi-jack this thread is why I kept it brief. :p
 
hey,

maybe one of you guys can help me with my problem.

if i comment this line out:
Code:
      "//Check for Ammobox" \n
      " {" \n
      "    if(!(_x isKindOf ""WeaponHolder"")) then {" \n
      "        diag_log (""CLEANUP: DELETING AN AMMOBOX "" + (typeOf _x));" \n
      "        deleteVehicle _x;" \n
      "    };" \n
      " } forEach allMissionObjects ""ReammoBox"";" \n
      "*/" \n
      "" \n
The Vehicles wont get any Damage Update in the Database. So after a restart the Vehicles are still there when destroyed.

I´m thankfull for any help

Greez
 
Back
Top