Jump to content
Sign in to follow this  
BomboBombom

Function script problems

Recommended Posts

//RESIDENTIAL loot spawn function.
//fn_lootSpawnRESIDENTIAL
private [_house,_spots,_chance];
_house=_this select 0;
_spots=_this select 1;
_chance=_this select 2;
_count=0;
_wph=[];
_guns=[];
_rchance=0;
_cpos=[];
_veh=;

while (_count <= _spots) do {
_cpos=_house buildingPos _count;
_veh=(_cpos nearObjects ["WeaponHolder",1]);
if (!isNil _veh) then { deleteVehicle _veh };
if ((random 100) <= _chance) then exitWith{};
_wph="WeaponHolder" createvehicle _cpos;
_rchance=random 100;
_gunADD=[_rchance] call RESIDENTIAL_GUNS;
_wph addWeaponCargo [_gunADD select 0,1];
_wph addAmmoCargo [_gunAdd select 1,3];
_count=_count + 1;
sleep 0.01;
};

I keep editing this script but keep getting told that I am missing a ; in it.

I've looked through it and can't see where.

Could this be related to the other functions executed? If so, I'll post those too.

Sorry, wrong section. I didn't see.

Edited by BomboBombom

Share this post


Link to post
Share on other sites
Sorry, wrong section. I didn't see.

Moved it for you. ;) In such cases, you may use the "Report post" function with a request to move your thread.

BTT, this seems odd to me:


_veh=;

You don't assign any value to it which is, AFAIR, not valid. You can initialize it by giving it a empty string:

_veh="";

Share this post


Link to post
Share on other sites

Thanks for both. I'm completely confused. Spent over 20 hours on scripting. (Not this alone, been making bridge floater script and so forth. The bridge script never started working which also confuses the hell out of me. Can't see errors due to like 5 errors stacked on each other ;p).

fn_lootSpawnResidential - Highly modded due to problems persisting.

//RESIDENTIAL loot spawn function.
//fn_lootSpawnRESIDENTIAL
private ["_house","_spots","_chance"];
_house=_this select 0;
_spots=_this select 1;
_chance=_this select 2;
_count=0;
_wph=[];
_guns=[];
_rchance=0;
_cpos=[];
_veh="";
hint "Started residential spawn";
while {_count < _spots} do {
_cpos=_house buildingPos _count;
_veh=_cpos nearObjects ["WeaponHolder",1];
if (format["%1",_veh select 0] != "<null>") then { deleteVehicle _veh; };
if (random 100 < _chance) exitWith{};
_wpn="WeaponHolder" createVehicle _cpos;
_wpn setPosATL _cpos;
_rchance=random 100;
_gunADD=_rchance call RESIDENTIAL_GUNS;
_wpn addWeaponCargo [_gunADD select 0,1];
_wpn addMagazineCargo [_gunADD select 1,3];
hint format["A weapon was added at %1",mapGridPosition _wpn];
_count=_count+1;
};

RESIDENTIAL_GUNS - This function will be tweaked. Update 10/10/2012

//RESIDENTIAL GUNS LIST
private["_chance"];
_chance = _this select 0;
_ret="";

while { _ret=="" } do {
//This chance script isn't great.
//But...
if (_chance < 40) exitWith{ _ret = [["M1014","8Rnd_B_Beneli_74Slug"],["LeeEnfield","10x_303"]] call BIS_fnc_selectRandom;
};

if (_chance < 50) exitWith{ _ret = [["Colt1911","7Rnd_45ACP_1911"],["revolver_EP1","6Rnd_45ACP"]] call BIS_fnc_selectRandom; 
};

if (_chance < 60) exitWith{ _ret = ["Makarov","8Rnd_9x18_Makarov"]; 
};
};

_ret

FN_Building_typeNloot - Lists buildings and classes them with "Types" as well as lists the amount of avail spawn positions inside.

//FN_BUILDING_TYPENLOOT
private ["_building"];
_building=typeOf _this select 0;

switch (_building) do {
//RESIDENTIALS
case ("Land_HouseV_1I4"): {
 _ret = [3,"RES",40];
};
case ("Land_kulna"): { 
 _ret = [2,"RES",40];
};
case ("Land_hut06"): { 
 _ret = [2,"RES",40];
};
case ("Land_Hlidac_budka"): { 
 _ret = [3,"RES",40];
};
case ("Land_HouseV2_02_Interier"): { 
 _ret = [8,"RES",40];
};
case ("Land_A_Pub_01"): { 
 _ret = [20,"RES",40];
};
case ("Land_Shed_wooden"): { 
 _ret = [2,"RES",40];
};
case ("Land_HouseBlock_A1_1"): { 
 _ret = [2,"RES",40];
};
case ("Land_HouseV_1I1"): { 
 _ret = [1,"RES",40];
};
case ("Land_A_MunicipalOffice"): { 
 _ret = [14,"RES",40];
};
case ("Land_ruin_01"): { 
 _ret = [4,"RES",40];
};
case ("Land_HouseV2_04_interier"): { 
 _ret = [7,"RES",40];
};
case ("Land_HouseV2_01A"): { 
 _ret = [2,"RES",40];
};
case ("Land_psi_bouda"): { 
 _ret = [1,"RES",40];
};
case ("Land_KBud"): { 
 _ret = [1,"RES",40];
};
case ("Land_A_Castle_Bergfrit"): { 
 _ret = [12,"RES",40];
};
case ("Land_A_Castle_Stairs_A"): { 
 _ret = [3,"RES",40];
};
case ("Land_A_Castle_Gate"): { 
 _ret = [5,"RES",40];
};
case ("Land_sara_domek_zluty"): { 
 _ret = [9,"RES",40];
};
//OFFICE
case ("Land_HouseB_Tenement"): { 
 _ret = [5,"OFF",40];
};
case ("Land_Panelak"): { 
 _ret = [13,"OFF",40];
};
case ("Land_Panelak2"): { 
 _ret = [12,"OFF",40];
};
case ("Land_rail_station_big"): { 
 _ret = [9,"OFF",40];
};
case ("Land_A_Office01"): { 
 _ret = [31,"OFF",40];
};
case ("Land_A_Office02"): { 
 _ret = [2,"OFF",40];
}; 
//INDUSTRIAL
case ("Land_Ind_Workshop01_01"): { 
 _ret = [3,"IND",30];
}; 
case ("Land_Ind_Garage01"): { 
 _ret = [4,"IND",30];
}; 
case ("Land_Ind_Workshop01_02"): { 
 _ret = [3,"IND",30];
}; 
case ("Land_Ind_Workshop01_04"): { 
 _ret = [7,"IND",30];
}; 
case ("Land_Ind_Workshop01_L"): { 
 _ret = [7,"IND",30];
}; 
case ("Land_Hangar_2"): { 
 _ret = [7,"IND",30];
}; 
case ("Land_A_FuelStation_Build"): { 
 _ret = [4,"IND",30];
}; 
case ("Land_Shed_Ind02"): { 
 _ret = [5,"IND",30];
}; 
case ("Land_Misc_PowerStation"): { 
 _ret = [2,"IND",30];
}; 
case ("Land_Shed_W01"): { 
 _ret = [1,"IND",30];
}; 
case ("Land_Tovarna2"): { 
 _ret = [23,"IND",30];
}; 
case ("Land_Ind_Vysypka"): { 
 _ret = [9,"IND",30];
}; 
case ("Land_A_BuildingWIP"): { 
 _ret = [29,"IND",30];
}; 
case ("Land_A_TVTower_Base"): { 
 _ret = [3,"IND",30];
}; 
case ("Land_Misc_Cargo1Ao"): { 
 _ret = [3,"IND",30];
}; 
case ("Land_Misc_Cargo1Bo"): { 
 _ret = [3,"IND",30];
}; 
case ("Land_Nav_Boathouse"): { 
 _ret = [9,"IND",30];
}; 
case ("Land_wagon_box"): { 
 _ret = [3,"IND",30];
}; 
case ("Land_Rail_House_01"): { 
 _ret = [3,"IND",30];
}; 
//FARM
case ("Land_stodola_old_open"): { 
 _ret = [12,FRM",30];
}; 
case ("and_Farm_Cowshed_a"): { 
 _ret = [7,"FRM",30];
}; 
case ("Land_stodola_open"): { 
 _ret = [4,"FRM",30];
}; 
case ("Land_Barn_W_01"): { 
 _ret = [6,"FRM",30];
}; 
case ("Land_Barn_W_02"): { 
 _ret = [6,"FRM",30];
}; 
//SUPERMARKET
case ("Land_Rail_House_01"): { 
 _ret = [24,"SPM",30];
}; 
case ("Land_Rail_House_01"): { 
 _ret = [23,"SPM",30];
}; 
//HOSPITAL
case ("Land_A_Hospital"): {
_ret = [12,"HOS",90];
};
case ("USMC_WarfareBFieldhHospital"): {
_ret = [5,"HOS",40];
};
//MILITARY
case ("Land_a_stationhouse"): {
_ret = [10,"MIL",30];
};
case ("Land_Mil_ControlTower"): {
_ret = [6,"MIL",40];
};
case ("Land_SS_hangar"): {
_ret = [3,"MIL",40];
};
case ("Land_Mil_House"): {
_ret = [3,"MIL",40];
};
case ("Land_Misc_deerstand"): {
_ret = [2,"MIL",50];
};
case ("Camp"): {
_ret = [2,"MIL",40];
};
case ("CampEast"): {
_ret = [2,"MIL",40];
};
case ("CampEast_EP1"): {
_ret = [3,"MIL",40];
};
//BARRACKS
case ("Land_Mil_Barracks_i"): {
_ret = [12,"BRK",40];
};
//CHURCH
case ("Land_Church_01"): {
_ret = [1,"CHC",40];
};
case ("Land_Church_03"): {
_ret = [12,"CHC",40];
};
default {
_ret = [0,"NIL",0];
};
};
_ret

fn_MakeLoot - This isn't fully working due to lack of functions, cutting it down for testing.

//FN_MAKELOOT
private ["_building"];
_building = _this select 0;
_type = "";

_type = _building call fn_Building_typeNloot;
if ((_type select 1) == "NIL") exitWith{};

//Place loot according to building.
switch (_type select 1) do {
//RESIDENTIALS
case ("RES"): {
 [_building,_type select 0,_type select 2] call fn_lootSpawnRESIDENTIAL;
};
////*OFFICE
// case ("OFF"): {
//  [_building,_type select 0,_type select 2] call fn_lootSpawnOFFICE; 
// };
////*INDUSTRIAL
// case ("IND"): {
//  [_building,_type select 0,_type select 2] call fn_lootSpawnINDUSTRIAL; 
// };
////*FARM
// case ("FRM"): {
//  [_building,_type select 0,_type select 2] call fn_lootSpawnFARM; 
// };
////*HOSPITAL
// case ("HOS"): {
//  [_building,_type select 0,_type select 2] call fn_lootSpawnOFFICE; 
// };
////*MILITARY
// case ("MIL"): {
//  [_building,_type select 0,_type select 2] call fn_lootSpawnMILITARY; 
// };
////*BARRACK
// case ("BRK"): {
//  [_building,_type select 0,_type select 2] call fn_lootSpawnBARRACKS; 
// };
////*CHURCH
// case ("CHC"): {
//  [_building,_type select 0,_type select 2] call fn_lootSpawnCHURCH; 
// };
//ELSE
default {};
};

Trigger covering the area you want spawn in with a 10 min repeat timer

if (format ["%1", building buildingPos 1] == "[0,0,0]" ) exitWith{}; building call fn_makeloot;

<- No clue how to make the trigger select the building. This in a trigger doesn't select self?

Edited by BomboBombom

Share this post


Link to post
Share on other sites

how to select all objects inside a none-round trigger space? All examples I find use nearestObject-functions, meaning it has to be a circle space because it uses radius. This will not suffice! ;p

Share this post


Link to post
Share on other sites

You can use thislist and conditions or the BIS_fnc_inTrigger to check if some object is inside a trigger. Or just look at the map in the editor, write down the building ID numbers and throw them in an array for exactly which buildings you want to use.

Share this post


Link to post
Share on other sites

Thanks kylania. I've tested BIS_fnc_inTrigger, but it didn't work. Had to use a inMarker function from here (Thanks: twirly)

Right now I'm finding out that you can not call functions inside of other functions :| So I am putting the functions together into one. D:

[argumentArray] call function; won't work inside another function, but;

[argumentArray] execVM "function.sqf";

,does. ~saddest face ever seen~

This will drop performance a lot.

Updating code on page soon. Rewriting some stuff first.

Share this post


Link to post
Share on other sites

There shouldn't be a problem calling other functions as long as they run in the same enviroment.

Share this post


Link to post
Share on other sites

If this is in a predefined function, your problem relies in the command "sleep". Predefined functions cannot use sleep.

Share this post


Link to post
Share on other sites
If this is in a predefined function, your problem relies in the command "sleep". Predefined functions cannot use sleep.

Sure they can, just spawn them instead of call. Depends on how fast you need something done.

Share this post


Link to post
Share on other sites

So, I must use sleep functions or the code wont work?

code reports no errors ingame, yet it doesn't execute more than half of the code ... >,>

The only part of this code I get executed is hint "Executing makeloot function";

The rest doesn't even bother running. Why I don't know.

FN_MAKELOOT

//FN_MAKELOOT
private ["_building"];
_building = _this;
_type=[];
_data="";
//Yeah those are revers :p

hint "Executing makeloot function";

if !(_building getVariable "Lootable") exitWith{};
if !(format["%1",_building getVariable "Lootable"] == "<null>") then {
if !(_building getVariable "Lootable") exitWith{};
if (_buidling getVariable "Lootable") then {
_type = _building getVariable "Data";
};
} else {
hint "Else!";
//Set: Not Lootable
if (format["%1",_building buildingPos 0]=="[0,0,0]") exitWith{_building setVariable ["Lootable",false];};
//Get building data
_data=typeOf _building;
switch (_data) do {
 //RESIDENTIALS
 case ("Land_HouseV_1I4"): {
  _type = [3,"RES",40];
 };
 case ("Land_kulna"): { 
  _type = [2,"RES",40];
 };
 case ("Land_hut06"): { 
  _type = [2,"RES",40];
 };
 case ("Land_Hlidac_budka"): { 
  _type = [3,"RES",40];
 };
 case ("Land_HouseV2_02_Interier"): { 
  _type = [8,"RES",40];
 };
 case ("Land_A_Pub_01"): { 
  _type = [20,"RES",40];
 };
 case ("Land_Shed_wooden"): { 
  _type = [2,"RES",40];
 };
 case ("Land_HouseBlock_A1_1"): { 
  _type = [2,"RES",40];
 };
 case ("Land_HouseV_1I1"): { 
  _type = [1,"RES",40];
 };
 case ("Land_A_MunicipalOffice"): { 
  _type = [14,"RES",40];
 };
 case ("Land_ruin_01"): { 
  _type = [4,"RES",40];
 };
 case ("Land_HouseV2_04_interier"): { 
  _type = [7,"RES",40];
 };
 case ("Land_HouseV2_01A"): { 
  _type = [2,"RES",40];
 };
 case ("Land_psi_bouda"): { 
  _type = [1,"RES",40];
 };
 case ("Land_KBud"): { 
  _type = [1,"RES",40];
 };
 case ("Land_A_Castle_Bergfrit"): { 
  _type = [12,"RES",40];
 };
 case ("Land_A_Castle_Stairs_A"): { 
  _type = [3,"RES",40];
 };
 case ("Land_A_Castle_Gate"): { 
  _type = [5,"RES",40];
 };
 case ("Land_sara_domek_zluty"): { 
  _type = [9,"RES",40];
 };
//OFFICE
 case ("Land_HouseB_Tenement"): { 
  _type = [5,"OFF",40];
 };
 case ("Land_Panelak"): { 
  _type = [13,"OFF",40];
 };
 case ("Land_Panelak2"): { 
  _type = [12,"OFF",40];
 };
 case ("Land_rail_station_big"): { 
  _type = [9,"OFF",40];
 };
 case ("Land_A_Office01"): { 
  _type = [31,"OFF",40];
 };
 case ("Land_A_Office02"): { 
  _type = [2,"OFF",40];
 }; 
//INDUSTRIAL
 case ("Land_Ind_Workshop01_01"): { 
  _type = [3,"IND",30];
 }; 
 case ("Land_Ind_Garage01"): { 
  _type = [4,"IND",30];
 }; 
 case ("Land_Ind_Workshop01_02"): { 
  _type = [3,"IND",30];
 }; 
 case ("Land_Ind_Workshop01_04"): { 
  _type = [7,"IND",30];
 }; 
 case ("Land_Ind_Workshop01_L"): { 
  _type = [7,"IND",30];
 }; 
 case ("Land_Hangar_2"): { 
  _type = [7,"IND",30];
 }; 
 case ("Land_A_FuelStation_Build"): { 
  _type = [4,"IND",30];
 }; 
 case ("Land_Shed_Ind02"): { 
  _type = [5,"IND",30];
 }; 
 case ("Land_Misc_PowerStation"): { 
  _type = [2,"IND",30];
 }; 
 case ("Land_Shed_W01"): { 
  _type = [1,"IND",30];
 }; 
 case ("Land_Tovarna2"): { 
  _type = [23,"IND",30];
 }; 
 case ("Land_Ind_Vysypka"): { 
  _type = [9,"IND",30];
 }; 
 case ("Land_A_BuildingWIP"): { 
  _type = [29,"IND",30];
 }; 
 case ("Land_A_TVTower_Base"): { 
  _type = [3,"IND",30];
 }; 
 case ("Land_Misc_Cargo1Ao"): { 
  _type = [3,"IND",30];
 }; 
 case ("Land_Misc_Cargo1Bo"): { 
  _type = [3,"IND",30];
 }; 
 case ("Land_Nav_Boathouse"): { 
  _type = [9,"IND",30];
 }; 
 case ("Land_wagon_box"): { 
  _type = [3,"IND",30];
 }; 
 case ("Land_Rail_House_01"): { 
 _type = [3,"IND",30];
 }; 
//FARM
 case ("Land_stodola_old_open"): { 
  _type = [12,FRM",30];
 }; 
 case ("and_Farm_Cowshed_a"): { 
  _type = [7,"FRM",30];
 }; 
 case ("Land_stodola_open"): { 
  _type = [4,"FRM",30];
 }; 
 case ("Land_Barn_W_01"): { 
  _type = [6,"FRM",30];
 }; 
 case ("Land_Barn_W_02"): { 
  _type = [6,"FRM",30];
 }; 
//SUPERMARKET
 case ("Land_Rail_House_01"): { 
  _type = [24,"SPM",30];
 }; 
 case ("Land_Rail_House_01"): { 
  _type = [23,"SPM",30];
 }; 
//HOSPITAL
 case ("Land_A_Hospital"): {
 _type = [12,"HOS",90];
 };
 case ("USMC_WarfareBFieldhHospital"): {
 _type = [5,"HOS",40];
 };
//MILITARY
 case ("Land_a_stationhouse"): {
 _type = [10,"MIL",30];
 };
 case ("Land_Mil_ControlTower"): {
 _type = [6,"MIL",40];
 };
 case ("Land_SS_hangar"): {
 _type = [3,"MIL",40];
 };
 case ("Land_Mil_House"): {
 _type = [3,"MIL",40];
 };
 case ("Land_Misc_deerstand"): {
 _type = [2,"MIL",50];
 };
 case ("Camp"): {
 _type = [2,"MIL",40];
 };
 case ("CampEast"): {
 _type = [2,"MIL",40];
 };
 case ("CampEast_EP1"): {
 _type = [3,"MIL",40];
 };
//BARRACKS
 case ("Land_Mil_Barracks_i"): {
 _type = [12,"BRK",40];
 };
//CHURCH
 case ("Land_Church_01"): {
 _type = [1,"CHC",40];
 };
 case ("Land_Church_03"): {
 _type = [12,"CHC",40];
 };
 default {
 _type = [0,"NIL",0];
 };
};
//Set: Lootable
_building setVariable ["Lootable",true];
_building setVariable ["Data",_type];
};

hint "Switch function run";
switch (_type select 1) do {
//RESIDENTIALS
case ("RES"): {
 hint "Executing residential gun spawn function.";
 [_building,_type select 0,_type select 2] execVM "FN\fn_lootSpawnRESIDENTIAL.sqf";
};
////*OFFICE
// case ("OFF"): {
//  [_building,_type select 0,_type select 2] execVM "FN\fn_lootSpawnOFFICE.sqf"; 
// };
////*INDUSTRIAL
// case ("IND"): {
//  [_building,_type select 0,_type select 2] execVM "FN\fn_lootSpawnINDUSTRIAL.sqf"; 
// };
////*FARM
// case ("FRM"): {
//  [_building,_type select 0,_type select 2] execVM "FN\fn_lootSpawnFARM.sqf"; 
// };
////*HOSPITAL
// case ("HOS"): {
//  [_building,_type select 0,_type select 2] execVM "FN\fn_lootSpawnOFFICE.sqf"; 
// };
////*MILITARY
// case ("MIL"): {
//  [_building,_type select 0,_type select 2] execVM "FN\fn_lootSpawnMILITARY.sqf"; 
// };
////*BARRACK
// case ("BRK"): {
//  [_building,_type select 0,_type select 2] execVM "FN\fn_lootSpawnBARRACKS.sqf"; 
// };
////*CHURCH
// case ("CHC"): {
//  [_building,_type select 0,_type select 2] execVM "FN\fn_lootSpawnCHURCH.sqf"; 
// };
default {};
};

hint format["Lootable: %1%2Loot Spots: %3%2Type array data:%2%4",_building getVariable "Lootable","\n",_building GetVariable "Data" select 0,format["%1",_building GetVariable "Data"]];

FN\fn_lootSpawnRESIDENTIAL.sqf

//RESIDENTIAL loot spawn function.
//fn_lootSpawnRESIDENTIAL
private ["_house","_spots","_chance"];
_house=_this select 0;
_spots=_this select 1;
_chance=_this select 2;
_count=0;
_wph="";
_rchance=0;
_cpos=[];
_veh="";
_gunADD=[];

//Putguns
while {_count < _spots} do {
_cpos=_house buildingPos _count;
_veh=(_cpos nearObjects ["WeaponHolder",1]) select 0;
if (format["%1",_veh] != "<null>") then { deleteVehicle _veh};
if ((random 100) < _chance) exitWith{};
_wph="WeaponHolder" createvehicle _cpos;
_rchance=random 100;

//GUNS
while { format["%1",_gunADD]=="[]" } do {
 if (_rchance < 40) exitWith{ _gunADD = [["M1014","8Rnd_B_Beneli_74Slug"],["LeeEnfield","10x_303"]] call BIS_fnc_selectRandom;
 }; 
 if (_rchance < 50) exitWith{ _gunADD = [["Colt1911","7Rnd_45ACP_1911"],["revolver_EP1","6Rnd_45ACP"]] call BIS_fnc_selectRandom; 
 };
 if (_rchance < 80) exitWith{ _gunADD = ["Makarov","8Rnd_9x18_Makarov"]; 
 };
};

_wph addWeaponCargo [_gunADD select 0,1];
_wph addMagazineCargo [_gunAdd select 1,3];
_count=_count + 1;
};

Error fixes.

Edited by BomboBombom

Share this post


Link to post
Share on other sites
Sure they can, just spawn them instead of call. Depends on how fast you need something done.

Sure they can inside of spawn but if you use call then it won't work :P. He may be using call because he needs to wait for that func to finish to run the rest of his script.

Share this post


Link to post
Share on other sites

I'm tweaking script a lot. May rewrite it :| Found a few errrors that I have fixed. These errors were not announced by showscripterror prefix.

Share this post


Link to post
Share on other sites

Trigger (reacts in trigger area and uses marker to make sure objects are not outside of spawn area):

objects=[];oo=thistrigger nearObjects ["building",triggerarea thistrigger select 0]; { if !(format["%1",_x buildingPos 0]=="[0,0,0]") then {objects=objects+[_x]}; }forEach oo; {if (["MAKELOOT",getPos _x] call fnc_InMarker) then { [_x] execVM "FN\fn_MakeLoot.sqf"; }; }forEach objects; t=count objects;hint format["Total Objects%1%2","\n",t];

//FN_MAKELOOT
private["_house"];
_house=_this select 0;
_type=[];
_data="";
//hint format["%1%2","\n",_house];
_data=typeOf _house;
if !(format["%1",_house getVariable "Lootable"] == "<null>") then {
if !(_house getVariable "Lootable"==1) exitWith{};
hint "2 Lootable";
_type=_house getVariable "Data";
} ELSE {
if (format["%1",_house buildingPos 0]=="[0,0,0]") exitWith{_house setVariable ["Lootable",0];};
//Set: Lootable
_house setVariable ["Lootable",1];
_house setVariable ["Data",[_type select 0,_type select 1,_type select 2]];
hint "3 Balls!";
switch (_data) do {
//RESIDENTIALS
case "Land_HouseV_1I4":
{
_type = [3,"RES",40];
};
case "Land_kulna":
{ 
_type = [2,"RES",40];
};
case "Land_hut06":
{ 
_type = [2,"RES",40];
};
case "Land_Hlidac_budka":
{ 
_type = [3,"RES",40];
};
case "Land_HouseV2_02_Interier":
{ 
_type = [8,"RES",40];
};
case "Land_A_Pub_01":
{ 
_type = [20,"RES",40];
};
case "Land_Shed_wooden":
{ 
_type = [2,"RES",40];
};
case "Land_HouseBlock_A1_1":
{ 
_type = [2,"RES",40];
};
case "Land_HouseV_1I1":
{ 
_type = [1,"RES",40];
};
case "Land_A_MunicipalOffice":
{ 
_type = [14,"RES",40];
};
case "Land_ruin_01":
{ 
_type = [4,"RES",40];
};
case "Land_HouseV2_04_interier":
{ 
_type = [7,"RES",40];
};
case "Land_HouseV2_01A":
{ 
_type = [2,"RES",40];
};
case "Land_psi_bouda":
{ 
_type = [1,"RES",40];
};
case "Land_KBud":
{ 
_type = [1,"RES",40];
};
case "Land_A_Castle_Bergfrit":
{ 
_type = [12,"RES",40];
};
case "Land_A_Castle_Stairs_A":
{ 
_type = [3,"RES",40];
};
case "Land_A_Castle_Gate":
{ 
_type = [5,"RES",40];
};
case "Land_sara_domek_zluty":
{ 
_type = [9,"RES",40];
};
//OFFICE
case "Land_HouseB_Tenement":
{ 
_type = [5,"OFF",40];
};
case "Land_Panelak":
{ 
_type = [13,"OFF",40];
};
case "Land_Panelak2":
{ 
_type = [12,"OFF",40];
};
case "Land_rail_station_big":
{ 
_type = [9,"OFF",40];
};
case "Land_A_Office01":
{ 
_type = [31,"OFF",40];
};
case "Land_A_Office02":
{ 
_type = [2,"OFF",40];
}; 
//INDUSTRIAL
case "Land_Ind_Workshop01_01":
{ 
_type = [3,"IND",30];
}; 
case "Land_Ind_Garage01":
{ 
_type = [4,"IND",30];
}; 
case "Land_Ind_Workshop01_02":
{ 
_type = [3,"IND",30];
}; 
case "Land_Ind_Workshop01_04":
{ 
_type = [7,"IND",30];
}; 
case "Land_Ind_Workshop01_L":
{ 
_type = [7,"IND",30];
}; 
case "Land_Hangar_2":
{ 
_type = [7,"IND",30];
}; 
case "Land_A_FuelStation_Build":
{ 
_type = [4,"IND",30];
}; 
case "Land_Shed_Ind02":
{ 
_type = [5,"IND",30];
}; 
case "Land_Misc_PowerStation":
{ 
_type = [2,"IND",30];
}; 
case "Land_Shed_W01":
{ 
_type = [1,"IND",30];
}; 
case "Land_Tovarna2":
{ 
_type = [23,"IND",30];
}; 
case "Land_Ind_Vysypka":
{ 
_type = [9,"IND",30];
}; 
case "Land_A_houseWIP":
{ 
_type = [29,"IND",30];
}; 
case "Land_A_TVTower_Base":
{ 
_type = [3,"IND",30];
}; 
case "Land_Misc_Cargo1Ao":
{ 
_type = [3,"IND",30];
}; 
case "Land_Misc_Cargo1Bo":
{ 
_type = [3,"IND",30];
}; 
case "Land_Nav_Boathouse":
{ 
_type = [9,"IND",30];
}; 
case "Land_wagon_box":
{ 
_type = [3,"IND",30];
}; 
case "Land_Rail_House_01":
{ 
_type = [3,"IND",30];
}; 
//FARM
case "Land_stodola_old_open":
{ 
_type = [12,FRM",30];
}; 
case "and_Farm_Cowshed_a":
{ 
_type = [7,"FRM",30];
}; 
case "Land_stodola_open":
{ 
_type = [4,"FRM",30];
}; 
case "Land_Barn_W_01":
{ 
_type = [6,"FRM",30];
}; 
case "Land_Barn_W_02":
{ 
_type = [6,"FRM",30];
}; 
//SUPERMARKET
case "Land_Rail_House_01":
{ 
_type = [24,"SPM",30];
}; 
case "Land_Rail_House_01":
{ 
_type = [23,"SPM",30];
}; 
//HOSPITAL
case "Land_A_Hospital":
{ 
_type = [12,"HOS",90];
};
case "USMC_WarfareBFieldhHospital":
{ 
_type = [5,"HOS",40];
};
//MILITARY
case "Land_a_stationhouse":
{ 
_type = [10,"MIL",30];
};
case "Land_Mil_ControlTower":
{ 
_type = [6,"MIL",40];
};
case "Land_SS_hangar":
{ 
_type = [3,"MIL",40];
};
case "Land_Mil_House":
{ 
_type = [3,"MIL",40];
};
case "Land_Misc_deerstand":
{ 
_type = [2,"MIL",50];
};
case "Camp":
{ 
_type = [2,"MIL",40];
};
case "CampEast":
{ 
_type = [2,"MIL",40];
};
case "CampEast_EP1":
{ 
_type = [3,"MIL",40];
};
//BARRACKS
case "Land_Mil_Barracks_i":
{ 
_type = [12,"BRK",40];
};
//CHURCH
case "Land_Church_01":
{ 
_type = [1,"CHC",40];
};
case "Land_Church_03":
{ 
_type = [12,"CHC",40];
};
default
{
_type = [0,"NIL",0];
};
};

};


hint format["%1",_type];
switch (_type select 1) do {
//RESIDENTIALS
case "RES": 
{ 
 hint "Executing residential gun spawn function.";
 [_house,_type select 0,_type select 2] execVM "FN\fn_lootSpawnRESIDENTIAL.sqf";
};
////*OFFICE
// case "OFF": { 
//  [_house,_type select 0,_type select 2] execVM "FN\fn_lootSpawnOFFICE.sqf"; 
// };
////*INDUSTRIAL
// case "IND": { 
//  [_house,_type select 0,_type select 2] execVM "FN\fn_lootSpawnINDUSTRIAL.sqf"; 
// };
////*FARM
// case "FRM": { 
//  [_house,_type select 0,_type select 2] execVM "FN\fn_lootSpawnFARM.sqf"; 
// };
////*HOSPITAL
// case "HOS": { 
//  [_house,_type select 0,_type select 2] execVM "FN\fn_lootSpawnOFFICE.sqf"; 
// };
////*MILITARY
// case "MIL": { 
//  [_house,_type select 0,_type select 2] execVM "FN\fn_lootSpawnMILITARY.sqf"; 
// };
////*BARRACK
// case "BRK": { 
//  [_house,_type select 0,_type select 2] execVM "FN\fn_lootSpawnBARRACKS.sqf"; 
// };
////*CHURCH
// case "CHC": { 
//  [_house,_type select 0,_type select 2] execVM "FN\fn_lootSpawnCHURCH.sqf"; 
// };
default {};
};

Good night. Starting to pass out, this still doesn't seem to go much further. I've done tons of testing on individual parts of the code and worked out how to use various functions in the script, but together they refuse to work. Like when I pick a building out of an array the script things it is still an array when trying to call the object. etc etc. :|

Do not understand why functions no longer run at all pretty much. I assume my func init-file contains errors ;p

~gone for today~

Share this post


Link to post
Share on other sites

1. None of the BIS_fnc_# seem to work for me. I've tried executing several scripts different examples for overlay effect text and attempted using one to detect if objects were inside of a trigger area.

2. It seems switches can NOT be executed inside of a condition tree. Trying to do so will NOT return any error message from -showScriptError, thus hard to identify.

3. Code ... well doesn't work well at all. Switch isn't working at all. My function returns null or any even if it is given correct input data.

4. Cut wrist :p

I am quite a bit frustrated. Over 20 hours of trying to repair code that returned no errors.

Script progress:

1 * Select all buildings within an radius. Works.

2 * Filter out buildings with buildpos 0 as "[0,0,0]" Works.

3 * Check what buildings are inside of "loot" marker. Works.

4 * setVariable "Lootable" to 1 to all buildings that are. Works.

5 * Get number of loot positions from switch function. Not working

Script plan:

Every 10 minutes script goes through all buildings that have been marked as lootable after initiating script phrase. Each spot found has a chance to have loot depending on the building type, each weapon spawn has a chance set to it too.

40% chance to spawn a weapon at spot A.

80% chance to spawn pistol in spot A,

60% chance to spawn shotgun in spot A,

40% chance to spawn automatic rifle in spot A.

Weapon holders are used, these get removed every 10 minutes and new ones are created. Will change this to clear their cargo instead, but for now I only need stuff to work. -_-;

Cheers.

* Located error after industrial spawn list. Missing a ", no script error prompt about it. :|

Works now, but can't see any more. So must afk for a bit :p

In either case, there are new errors but they are not too horrible.

Error example 1 : Guns are in floor in some buildings, and not in others. <.<

Edited by BomboBombom
An issue spotted.

Share this post


Link to post
Share on other sites

Just a quick check regardin BIS_fnc_#:

You do have a function module on your map, right?

Share this post


Link to post
Share on other sites

* Located error after industrial spawn list. Missing a ", no script error prompt about it. :|

Try Squint

Share this post


Link to post
Share on other sites

BlackMamb : Thought BIS functions were in there by default. So, this would explain this problem. lol. Oh the head pains, the head pains!

Shuko: Long ago loaded it up. Thought either something was wrong or I couldn't stand the interface. The reason I don't remember. It shall replace notepad. Notepad++ plugin is not working on Win7 64.

Note: Heard of some method to put item spawns by using objects that can fall for about half a second, delete them and use their relative positions for positions. Also, I'm rewriting the entire positioning method and using setVariable as well as getVariable to get spawn points. Wish it was possible to write text files that I could then use as preprocessfiles instead of having to init all buildings, or building types.

Share this post


Link to post
Share on other sites

I'm starting to grow one hell of a headache. :p

So.. it started working but I do not know why it started working. It worked for a while.. it stopped working again.. I do not know why it stopped working again.

I have a function called, inside of the function it can create the output, but outside of the function it can't.

//FN_MAKELOOT
private["_house"];
_house=_this select 0;
_type=[];
_lootData="";
_data=typeOf _house;

//Mega scary exploding town. START
//sleep ((random 30) + (random 30) + (random 30) + (random 30) + (random 30) + (random 30) + (random  30) + 10);
//b="Bo_GBU12_LGB" createVehicle (_house buildingPos (random 1));
//sleep 0.1;
//deleteVehicle b;
//Mega scary eploding town. END

if !(format["%1",_house getVariable "Lootable"] == "<null>") then {
_type=_house getVariable "Data";
} ELSE {
//Set: Lootable
_type=[_data] call fn_getLootData;
};

if !(format["%1",_type]=="any") then { hint format["OUTPUT WORKED! %1",_type]; };
//Not <_<

if (format["%1",_type]=="any") exitWith{};

switch (_type select 1) do {
//RESIDENTIALS
case "RES": 
{ 
 null=[_house,_type select 0,_type select 2] execVM "FN\fn_lootSpawnRESIDENTIAL.sqf";
};
////*OFFICE
// case "OFF": { 
//  [_house,_type select 0,_type select 2] execVM "FN\fn_lootSpawnOFFICE.sqf"; 
// };
////*INDUSTRIAL
// case "IND": { 
//  [_house,_type select 0,_type select 2] execVM "FN\fn_lootSpawnINDUSTRIAL.sqf"; 
// };
////*FARM
// case "FRM": { 
//  [_house,_type select 0,_type select 2] execVM "FN\fn_lootSpawnFARM.sqf"; 
// };
////*HOSPITAL
// case "HOS": { 
//  [_house,_type select 0,_type select 2] execVM "FN\fn_lootSpawnOFFICE.sqf"; 
// };
////*MILITARY
// case "MIL": { 
//  [_house,_type select 0,_type select 2] execVM "FN\fn_lootSpawnMILITARY.sqf"; 
// };
////*BARRACK
// case "BRK": { 
//  [_house,_type select 0,_type select 2] execVM "FN\fn_lootSpawnBARRACKS.sqf"; 
// };
////*CHURCH
// case "CHC": { 
//  [_house,_type select 0,_type select 2] execVM "FN\fn_lootSpawnCHURCH.sqf"; 
// };
default {};
};

//fn_getLootData
private["_input"];
_input=_this select 0;
//_output="";

//RESIDENTIALS
if (_input=="Land_HouseV_1I4") then {_output=[3,"RES",40];};
if (_input=="Land_kulna") then {_output=[2,"RES",40];};
if (_input=="Land_hut06") then {_output=[2,"RES",40];};
if (_input=="Land_Hlidac_budka") then {_output=[3,"RES",40];};
if (_input=="Land_HouseV2_02_Interier") then {_output=[8,"RES",40];};
if (_input=="Land_A_Pub_01") then {_output=[20,"RES",40];};
if (_input=="Land_Shed_wooden") then {_output=[2,"RES",40];};
if (_input=="Land_HouseBlock_A1_1") then {_output=[2,"RES",40];};
if (_input=="Land_HouseV_1I1") then {_output=[1,"RES",40];};
if (_input=="Land_A_MunicipalOffice") then {_output=[14,"RES",40];};
if (_input=="Land_ruin_01") then {_output=[4,"RES",40];};
if (_input=="Land_HouseV2_04_interier") then {_output=[7,"RES",40];};
if (_input=="Land_HouseV2_01A") then {_output=[2,"RES",40];};
if (_input=="Land_psi_bouda") then {_output=[1,"RES",40];};
if (_input=="Land_KBud") then {_output=[1,"RES",40];};
if (_input=="Land_A_Castle_Bergfrit") then {_output=[12,"RES",40];};
if (_input=="Land_A_Castle_Stairs_A") then {_output=[3,"RES",40];};
if (_input=="Land_A_Castle_Gate") then {_output=[5,"RES",40];};
if (_input=="Land_sara_domek_zluty") then {_output=[9,"RES",40];};
//Churches, residential.
if (_input=="Land_Church_01") then {_output=[1,"RES",40];};
if (_input=="Land_Church_03") then {_output=[12,"RES",40];};
//OFFICE
if (_input=="Land_HouseB_Tenement") then {_output=[5,"OFF",40];};
if (_input=="Land_Panelak") then {_output=[13,"OFF",40];};
if (_input=="Land_Panelak2") then {_output=[12,"OFF",40];};
if (_input=="Land_rail_station_big") then {_output=[9,"OFF",40];};
if (_input=="Land_A_Office01") then {_output=[31,"OFF",40];};
if (_input=="Land_A_Office02") then {_output=[2,"OFF",40];}; 
//INDUSTRIAL
if (_input=="Land_Ind_Workshop01_01") then {_output=[3,"IND",30];}; 
if (_input=="Land_Ind_Garage01") then {_output=[4,"IND",30];}; 
if (_input=="Land_Ind_Workshop01_02") then {_output=[3,"IND",30];}; 
if (_input=="Land_Ind_Workshop01_04") then {_output=[7,"IND",30];}; 
if (_input=="Land_Ind_Workshop01_L") then {_output=[7,"IND",30];}; 
if (_input=="Land_Hangar_2") then {_output=[7,"IND",30];}; 
if (_input=="Land_A_FuelStation_Build") then {_output=[4,"IND",30];}; 
if (_input=="Land_Shed_Ind02") then {_output=[5,"IND",30];}; 
if (_input=="Land_Misc_PowerStation") then {_output=[2,"IND",30];}; 
if (_input=="Land_Shed_W01") then {_output=[1,"IND",30];}; 
if (_input=="Land_Tovarna2") then {_output=[23,"IND",30];}; 
if (_input=="Land_Ind_Vysypka") then {_output=[9,"IND",30];}; 
if (_input=="Land_A_houseWIP") then {_output=[29,"IND",30];}; 
if (_input=="Land_A_TVTower_Base") then {_output=[3,"IND",30];}; 
if (_input=="Land_Misc_Cargo1Ao") then {_output=[3,"IND",30];}; 
if (_input=="Land_Misc_Cargo1Bo") then {_output=[3,"IND",30];}; 
if (_input=="Land_Nav_Boathouse") then {_output=[9,"IND",30];}; 
if (_input=="Land_wagon_box") then {_output=[3,"IND",30];}; 
if (_input=="Land_Rail_House_01") then {_output=[3,"IND",30];}; 
//FARM
if (_input=="Land_stodola_old_open") then {_output=[12,"FRM",30];}; 
if (_input=="Land_Farm_Cowshed_a") then {_output=[7,"FRM",30];}; 
if (_input=="Land_stodola_open") then {_output=[4,"FRM",30];}; 
if (_input=="Land_Barn_W_01") then {_output=[6,"FRM",30];}; 
if (_input=="Land_Barn_W_02") then {_output=[6,"FRM",30];}; 
//SUPERMARKET
if (_input=="Land_Rail_House_01") then {_output=[24,"SPM",30];}; 
if (_input=="Land_Rail_House_01") then {_output=[23,"SPM",30];}; 
//HOSPITAL
if (_input=="Land_A_Hospital") then {_output=[12,"HOS",90];};
if (_input=="USMC_WarfareBFieldhHospital") then {_output=[5,"HOS",40];};
//MILITARY
if (_input=="Land_Mil_Guardhouse") then {_output=[2,"MIL",30];};
if (_input=="Land_a_stationhouse") then {_output=[10,"MIL",30];};
if (_input=="Land_Mil_ControlTower") then {_output=[6,"MIL",40];};
if (_input=="Land_SS_hangar") then {_output=[3,"MIL",40];};
if (_input=="Land_Mil_House") then {_output=[3,"MIL",40];};
if (_input=="Land_Misc_deerstand") then {_output=[2,"MIL",50];};
if (_input=="Camp") then {_output=[2,"MIL",40];};
if (_input=="CampEast") then {_output=[2,"MIL",40];};
if (_input=="CampEast_EP1") then {_output=[3,"MIL",40];};
//BARRACK
if (_input=="Land_Mil_Barracks_i") then {_output=[12,"BRK",40];};
if (format["%1",_input]=="any") then {_output=[0,"NIL",0];};
//hint format["IN FUNCTION %1",_output];

_output

//RESIDENTIAL loot spawn function.
//fn_lootSpawnRESIDENTIAL
private ["_resident","_spots","_chance"];
_resident=_this select 0;
_spots=_this select 1;
_chance=_this select 2;
_count=0;
_wph="";
_rchance=0;
_cpos=[];
_veh="";
_gunADD=[];
_rnd=0;
_npos=[];

//Putguns
while {_count < _spots} do {
_cpos=_resident buildingPos _count;
_rchance=random 100;
sleep 0.01;
_veh=([_cpos select 0,_cpos select 1,(_cpos select 2)-0.6] nearObjects ["WeaponHolder",1]) select 0;
//hint format["%1",_veh];
if (format["%1",_veh] != "<null>") then { 
clearMagazineCargo _veh;
clearWeaponCargo _veh;
_wph=_veh;
} else {
_wph="WeaponHolder" createVehicle _cpos;
_wph setPosATL [_cpos select 0,_cpos select 1,(_cpos select 2)-0.6];
};

if ((random 100) < _chance) then {
hint "Fail to make one gun!";
} else {
//GUNS
while { format["%1",_gunADD select 0]=="<null>" } do {
 if (_rchance < 25) exitWith{ _gunADD = [["M1014","8Rnd_B_Beneli_74Slug"],["LeeEnfield","10x_303"]];
 _rnd=(count _gunADD)-1;_gunADD=_gunADD select (random _rnd);
 }; 
 if (_rchance < 45) exitWith{ _gunADD = [["Colt1911","7Rnd_45ACP_1911"],["revolver_EP1","6Rnd_45ACP"]];
 _rnd=(count _gunADD)-1;_gunADD=_gunADD select (random _rnd);
 };
 if (_rchance < 60) exitWith{ _gunADD = ["Makarov","8Rnd_9x18_Makarov"]; 
 };
 _rchance=random 100;
};

if (format["%1",_gunADD select 0]=="<null>") exitWith{};
//hint format["GUNS %1 , %2",_rnd,_gunADD select 0];
_wph addWeaponCargoGlobal [_gunADD select 0,1];
_wph addMagazineCargoGlobal [_gunAdd select 1,(random 2)+3];
sleep 0.01;
};
_wph="";
_veh="";
_gunADD=[];
_count=_count + 1;
};

Squint would have saved me quite a few hours if I had it earlier. Wish it tested functions etc without having to start arma up ;p Spent about 12 hours today so far on this script.

- Can not call functions in functions?

- Why do functions not return the generated output sometimes?

- Does all ["_private"] values have to be unique?

- I need to regenerate my functionality with a loooooong break.

Have a good one! :-)

Share this post


Link to post
Share on other sites
Shuko: Long ago loaded it up. Thought either something was wrong or I couldn't stand the interface. The reason I don't remember. It shall replace notepad. Notepad++ plugin is not working on Win7 64.

I code in Notepad++ and just debug/paste the stuff into Squint for a quick check. This plugin works in W7 64.

Share this post


Link to post
Share on other sites
I code in Notepad++ and just debug/paste the stuff into Squint for a quick check. This plugin works in W7 64.

I just tried this with the new npp that came out yesterday and it's not really working. I'm getting context popus and it looks like everything is working, but I'm not getting any code highlight colors, even though under Style Config it's all there.

Share this post


Link to post
Share on other sites

Hmm.. I'm using 1.31 version of the plugin in unicode 5.6.8 version of Notepad++. Maybe it's old enough. :)

Share this post


Link to post
Share on other sites

a call inside of a call can not return a value? I'm asking because inside of the called call, the value output is working but outside it isn't returning anything.

 _type=[_data] call fn_getLootData;

I call it as this. It calls getLootData.

//fn_getLootData
private["_input","_output"];
_input=_this select 0;
_output=[];

//RESIDENTIALS
if (_input=="Land_HouseV_1I4") then {_output=[3,"RES",40];};
if (_input=="Land_kulna") then {_output=[2,"RES",40];};
if (_input=="Land_hut06") then {_output=[2,"RES",40];};
if (_input=="Land_Hlidac_budka") then {_output=[3,"RES",40];};
if (_input=="Land_HouseV2_02_Interier") then {_output=[8,"RES",40];};
if (_input=="Land_A_Pub_01") then {_output=[20,"RES",40];};
if (_input=="Land_Shed_wooden") then {_output=[2,"RES",40];};
if (_input=="Land_HouseBlock_A1_1") then {_output=[2,"RES",40];};
if (_input=="Land_HouseV_1I1") then {_output=[1,"RES",40];};
if (_input=="Land_A_MunicipalOffice") then {_output=[14,"RES",40];};
if (_input=="Land_ruin_01") then {_output=[4,"RES",40];};
if (_input=="Land_HouseV2_04_interier") then {_output=[7,"RES",40];};
if (_input=="Land_HouseV2_01A") then {_output=[2,"RES",40];};
if (_input=="Land_psi_bouda") then {_output=[1,"RES",40];};
if (_input=="Land_KBud") then {_output=[1,"RES",40];};
if (_input=="Land_A_Castle_Bergfrit") then {_output=[12,"RES",40];};
if (_input=="Land_A_Castle_Stairs_A") then {_output=[3,"RES",40];};
if (_input=="Land_A_Castle_Gate") then {_output=[5,"RES",40];};
if (_input=="Land_sara_domek_zluty") then {_output=[9,"RES",40];};
//Churches, residential.
if (_input=="Land_Church_01") then {_output=[1,"RES",40];};
if (_input=="Land_Church_03") then {_output=[12,"RES",40];};
//OFFICE
if (_input=="Land_HouseB_Tenement") then {_output=[5,"OFF",40];};
if (_input=="Land_Panelak") then {_output=[13,"OFF",40];};
if (_input=="Land_Panelak2") then {_output=[12,"OFF",40];};
if (_input=="Land_rail_station_big") then {_output=[9,"OFF",40];};
if (_input=="Land_A_Office01") then {_output=[31,"OFF",40];};
if (_input=="Land_A_Office02") then {_output=[2,"OFF",40];}; 
//INDUSTRIAL
if (_input=="Land_Ind_Workshop01_01") then {_output=[3,"IND",30];}; 
if (_input=="Land_Ind_Garage01") then {_output=[4,"IND",30];}; 
if (_input=="Land_Ind_Workshop01_02") then {_output=[3,"IND",30];}; 
if (_input=="Land_Ind_Workshop01_04") then {_output=[7,"IND",30];}; 
if (_input=="Land_Ind_Workshop01_L") then {_output=[7,"IND",30];}; 
if (_input=="Land_Hangar_2") then {_output=[7,"IND",30];}; 
if (_input=="Land_A_FuelStation_Build") then {_output=[4,"IND",30];}; 
if (_input=="Land_Shed_Ind02") then {_output=[5,"IND",30];}; 
if (_input=="Land_Misc_PowerStation") then {_output=[2,"IND",30];}; 
if (_input=="Land_Shed_W01") then {_output=[1,"IND",30];}; 
if (_input=="Land_Tovarna2") then {_output=[23,"IND",30];}; 
if (_input=="Land_Ind_Vysypka") then {_output=[9,"IND",30];}; 
if (_input=="Land_A_houseWIP") then {_output=[29,"IND",30];}; 
if (_input=="Land_A_TVTower_Base") then {_output=[3,"IND",30];}; 
if (_input=="Land_Misc_Cargo1Ao") then {_output=[3,"IND",30];}; 
if (_input=="Land_Misc_Cargo1Bo") then {_output=[3,"IND",30];}; 
if (_input=="Land_Nav_Boathouse") then {_output=[9,"IND",30];}; 
if (_input=="Land_wagon_box") then {_output=[3,"IND",30];}; 
if (_input=="Land_Rail_House_01") then {_output=[3,"IND",30];}; 
//FARM
if (_input=="Land_stodola_old_open") then {_output=[12,"FRM",30];}; 
if (_input=="Land_Farm_Cowshed_a") then {_output=[7,"FRM",30];}; 
if (_input=="Land_stodola_open") then {_output=[4,"FRM",30];}; 
if (_input=="Land_Barn_W_01") then {_output=[6,"FRM",30];}; 
if (_input=="Land_Barn_W_02") then {_output=[6,"FRM",30];}; 
//SUPERMARKET
if (_input=="Land_Rail_House_01") then {_output=[24,"SPM",30];}; 
if (_input=="Land_Rail_House_01") then {_output=[23,"SPM",30];}; 
//HOSPITAL
if (_input=="Land_A_Hospital") then {_output=[12,"HOS",90];};
if (_input=="USMC_WarfareBFieldhHospital") then {_output=[5,"HOS",40];};
//MILITARY
if (_input=="Land_Mil_Guardhouse") then {_output=[2,"MIL",30];};
if (_input=="Land_a_stationhouse") then {_output=[10,"MIL",30];};
if (_input=="Land_Mil_ControlTower") then {_output=[6,"MIL",40];};
if (_input=="Land_SS_hangar") then {_output=[3,"MIL",40];};
if (_input=="Land_Mil_House") then {_output=[3,"MIL",40];};
if (_input=="Land_Misc_deerstand") then {_output=[2,"MIL",50];};
if (_input=="Camp") then {_output=[2,"MIL",40];};
if (_input=="CampEast") then {_output=[2,"MIL",40];};
if (_input=="CampEast_EP1") then {_output=[3,"MIL",40];};
//BARRACK
if (_input=="Land_Mil_Barracks_i") then {_output=[12,"BRK",40];};
if (format["%1",_input]=="any") then {_output=[0,"NIL",0];};
_output

Share this post


Link to post
Share on other sites

That call should work.... but you can also try changing the code to this....

At the top...

//fn_getLootData
private["_input","_output"];
_input=_this select 0;
[color="#FF0000"]_output=[0,"NIL",0];[/color]

...and then delete this line at the bottom which may be working but looks a bit suspect to me.

 //BARRACK
if (_input=="Land_Mil_Barracks_i") then {_output=[12,"BRK",40];};
[color="#FF0000"][s] if (format["%1",_input]=="any") then {_output=[0,"NIL",0];};[/s][/color]
_output

That way if none of the if comparisons are true... _output will remain set to [0,"NIL",0]

---------- Post added at 12:11 PM ---------- Previous post was at 12:01 PM ----------

I forgot to add that a function can call another function...no problems.

Edited by twirly
Clarity

Share this post


Link to post
Share on other sites

the if(format["%1",_input]=="any") then (_output=[0,"NIL",0];}; is for all buildings I do not have listed, so it is sort of an "else" oh wait... I see my problem there. It should be ["%1",_output]=="any" ,, ~facepalm~ Oh lord, the little things I miss. Thanks :p

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×