Register

DonkeyPunch Community Gaming

GAME ON!!! -sTanG

News:

Be careful when people that are loud get quiet.....

icomrade

October 28, 2016, 11:31:33 AM
Bravo Bunny Posts: 2 Humanity: +2/-0
I rewrote the eXpochSearchNDestroy.sqf to be more efficient and network friendly. use it as you wish.

Note BIS_fnc_createSimpleObject accepts only ASL positions.

Edit: I haven't actually tested it but fn_postInit.sqf may execute twice if using a headless client since the check is (!hasInterface || isServer), not (!hasInterface && isServer), but isServer by itself will probably work just as well.

Code: [Select]
/*
myBuildings = [
   ["Land_HouseV_1L2","Land_d_HouseV_1L2",0],
   ["Land_HouseV_1T","Land_d_HouseV_1T",0],
   ["Land_HouseV_2I","Land_d_HouseV_2I",0],
   ["Land_HouseV_2L","Land_d_HouseV_2L",0],
   ["Land_HouseV_2T1","Land_d_HouseV_2T1",0],
   ["Land_houseV_2T2","Land_d_HouseV_2T2",0],
   ["Land_HouseV_3I1","Land_d_HouseV_3I1",0],
   ["Land_HouseV_3I2","Land_d_HouseV_3I2",0],
   ["Land_HouseV_3I3","Land_d_HouseV_3I3",0],
   ["Land_HouseV_3I4","Land_d_HouseV_3I4",0]
             ];
*/

//the replace and replacement arrays must have matching indices for every map building and its corresponding replacement building
_replaceBuildings = ["Land_HouseV_1L2","Land_HouseV_1T","Land_HouseV_2I","Land_HouseV_2L","Land_houseV_2T1","Land_houseV_2T2","Land_HouseV_3I1","Land_HouseV_3I2","Land_HouseV_3I3","Land_HouseV_3I4"];
_replacementBuildings = ["Land_d_HouseV_1L2","Land_d_HouseV_1T","Land_d_HouseV_2I","Land_d_HouseV_2L","Land_d_HouseV_2T1","Land_d_HouseV_2T2","Land_d_HouseV_3I1","Land_d_HouseV_3I2","Land_d_HouseV_3I3","Land_d_HouseV_3I4"];
_log_array = [];
{
_index = (_replaceBuildings find (typeof _x));
if (_index >= 0) then {
_ReplacementBuilding = _replacementBuildings select _index;
hideObjectGlobal  _x;
_myReplacement = [_ReplacementBuilding, (getPosASL _x), (getdir _x)] call BIS_fnc_createSimpleObject;
_myReplacement enableSimulationGlobal false;
} else {
if ((_log_array find (typeof _x)) < 0) then {_log_array set [(count _log_array), (typeof _x)];};
};
} forEach nearestObjects [markerpos "center", _replaceBuildings, 20000];
if (count _log_array > 0) then {
diag_log format["ERROR REPLACING BUILDINGS (probably due to case sensitivity): %1", _log_array];
};
« Last Edit: October 31, 2016, 06:47:50 AM by DirtySanchez »



  • Humanitarian
  • Posts: 932
  • Humanity: +1337/-420

Re: [Suggestion] use CreateSimpleObject

DirtySanchez Reply 1 October 28, 2016, 11:57:12 AM

Hey @icomrade

Thanks for submitting your work.

I decided to look a little bit further into this and will probably not use createSimpleObject.
Reason #1:
Quote
Unsupported features include PhysX, damage, AI pathfinding (causes walking through walls), and built in lights.

This was quoted from the BIKI:
https://community.bistudio.com/wiki/createSimpleObject

After seeing this info, would you still use createsimpleobject for your buildings? which will replace hundreds of buildings on chernarus?
« Last Edit: October 29, 2016, 05:49:32 PM by DirtySanchez »
Website: http://DonkeyPunch.INFO  |  Discord: https://discord.me/eXpoch  |  TeamSpeak: ts3.donkeypunch.info


 
1337-420