Jump to content

Linker Split

Member
  • Content Count

    902
  • Joined

  • Last visited

  • Medals

Community Reputation

0 Neutral

5 Followers

About Linker Split

  • Rank
    First Sergeant

core_pfieldgroups_3

  • Interests
    -Operation Flashpoint<br>-PC<br>-Waterpolo (I play it & I love it!)<br>-playing dayZ :)
  • Occupation
    Poker Tournament director

Recent Profile Visitors

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

  1. Linker Split

    Move to nearest Shore

    I assume _this select 0 is the chopper right? If so, you need to change the first line of you script: _chop = (_this select 0); _xpos = (getPosASL _chop select 0); _ypos = (getPosASL _chop select 1); if (surfaceIsWater [_xPos, _yPos]) then { YOUR CODE HERE };
  2. Linker Split

    Problem with spawn command

    Ok, I got it working. I modifed the function to be like this: EPfn_saveInventory = { private["_obj","_items","_arrItems","_count","_i"]; _obj = _this select 0; _items = []; _arrItems = items _obj; _count = count _arrItems; if (_count == 0) then { _items =[]; diag_log "NO OBJECTS INTO THE ARRITEMS"; } else { diag_log "THERE ARE OBJECTS INTO THE ARRITEMS"; for "_i" from 0 to (_count -1) do { _item = (_arrItems select _i); _type = typeOf _item; _Dam = damage _item; _qty = quantity _item; _newArr = [_type,_Dam,_qty]; _items set [_i,_newArr]; }; diag_log format["EPfn_saveInventory ITEMS ARE %1",_items]; }; _items }; And it's called with this line: _items = [_obj] call EPfn_saveInventory; . Now what I don't get is why is it saving string like this? [[color="#FF0000"]""[/color]Headtorch_Grey[color="#FF0000"]""[/color],0.428685,0],[[color="#FF0000"]""[/color]Crafting_MetalWire[color="#FF0000"]""[/color],0.536768,0]
  3. Hi guys! I'm creating a script that should save objects and their properties into an array dinamically (looping every 5 seconds) that must be used into another script. Basically, arguments are: _obj = a tent; _items = an empty array to be filled with objects; _arrItems: all the items the tent is already carrying; _nmbr = a number used to save and pick the correct tent from a function (which is out of interest here); _numToCheck = as above; _uniID = as above. The following two function are compiled within the init.sqf. I've made a function EPfn_saveInventory which must loop and check for new objects inside the tent: EPfn_saveInventory = { private["_obj","_items","_arrItems","_count","_i"]; _obj = _this select 0; _items = _this select 1; _arrItems = items _obj; _count = count _arrItems; _i = 0; if (_count == 0) exitWith {diag_log "NO OBJECTS INTO THE ARRITEMS"}; while {_i < _count} do { //private["_i"]; diag_log format["EPfn_saveInventory COUNT IS %1, _I is %2, ITEMS ARE %3",_count,_i,_arrItems]; _item = (_arrItems select _i); _type = typeOf _item; _Dam = damage _item; _qty = quantity _item; _newArr = [_type ,_Dam,_qty]; _items set [_i,_newArr]; sleep 1; _i = _i+1; }; diag_log format["EPfn_saveInventory ITEMS ARE %1",_items]; }; Passed arguments _obj, _items are from a function that (get looped by another script) which is EPfn_saveTentData. This function get looped because it must sve all the data of the tents. EPfn_saveTentData = { private ["_obj","_nmbr","_numToCheck","_uniID"]; _obj = _this select 0; _nmbr = _this select 1; _numToCheck = _this select 2; _uniID = _this select 3; _dam = damage _obj; _dir = direction _obj; _items = []; [b][color="#FF0000"][_obj,_items] spawn EPfn_saveInventory;[/color][/b] _type = typeOf _obj; _xPos = (getPosASL _obj) select 0; _yPos = (getPosASL _obj) select 1; _zPos = (getPosASL _obj) select 2; _globo = _obj getVariable ["globalID",[]]; _stringToPass = format["%1,%2,%3,%4,%5,%6,%7,%8,%9,%10",_uniID,_type,_nmbr,_numToCheck,_xPos,_yPos,_zPos,_dir,_dam,_items]; profileNameSpace setVariable [format["TENTOBJ%1",_nmbr],_stringToPass]; saveProfileNameSpace; }; All the data of the tents are saved (position, damage, type, ID etc.) but I can't get the objects that a player puts inside the tent. Indeed, the _stringToPass (which get saved like this: [TentMedium_Pitched,16,31,4708,10091.2,338.881,0,0,[]] in the profileNameSpace) has an empty [] at the end while there should be something like ["M16A2",0,0]. It doesn't see what is passed via EPfn_saveInventory (which instead gives me the correct data, I checked via diag_log). What am I doing wrong? #EDIT I show you the RPT: First line of EPfn_saveInventory is executed (correct) Second line of EPfn_saveInventory is executed (correct) which means that the code inside is correct Third line of EPfn_saveTentData is executed but not correct: _items is still empty [] Fourth line of EPfn_saveTentData is executed but not correct, cause last object of the big array should contain ["Consumable_Chemlight_Blue",0.769509,0]
  4. Hello guys, I'm having a problem with a function which should return me an array of objects with they damage, but it's not working properly. The function I've written is: EPfn_saveInventory = { private["_array"]; _array = [] + _this; { if ((typeName _x) == "ARRAY") then { _item = _x select _forEachIndex; _type = typeOf _item; _dam = damage _item; _newArr = [_type,_dam]; _x set [_forEachIndex,_newArr]; } else { diag_log "THIS IS NOT AN ARRAY"; }; }forEach _array; _array }; It's called like this: _items = _items call EPfn_saveInventory; Where _items is an ARRAY of object a player got in his inventory. So I should fill the array of a tent with the objects that I put inside it. I must say that the line where the function is called, is a loop too.
  5. thank you guys worked like a charm :)
  6. Guys, I did this: in the init.sqf I wrote down ChernogorskPOS = call compile preProcessFileLineNumbers (DZ_DIR_P + "ChernogorskPOS.sqf"); ChernogorskDIR = call compile preProcessFileLineNumbers (DZ_DIR_P + "ChernogorskDIR.sqf"); Then in a script (car.sqf) called from init.sqf, I wrote: _content1 = (call ChernogorskPOS select 4); _content2 = (call ChernogorskDIR select 21); diag_log format["GLOBALSPAWNINGSYSTEM: CONTENT IS %1, %2",_content1,_content2]; It returns me any, any even if I change to _content1 = (ChernogorskPOS select 4); _content2 = (ChernogorskDIR select 21); why? any suggestions? BTW the mission gets loaded correctly btw #EDIT btw, the sqf the variables are attached to are like this: [ [numbers,numbers,numbers]; [numbers,numbers,numbers]; [numbers,numbers,numbers]; [numbers,numbers,numbers]; [numbers,numbers,numbers]; [numbers,numbers,numbers]; [numbers,numbers,numbers]; ];
  7. Because it's not a single array, and an array contains about 200 position arrays inside, without considering the directional arrays saved, along with other info... it's a global spawn system for cars that goes with the persistent database :D I'm a bit inexperienced when coming to MP scripting (about declaring public variables, about trying to take rid of Hackers etc...)
  8. Ok Guys so basically the name of the variable should be declared into the init.sqf to be automatically public, and then in the sqf there should be only the array. Ok testing!
  9. Guys assuming my public Variable is ChernogorskPOS, once in another script should I call the content of this variable like this? _content1 = ChernogorskPOS select 0;
  10. Ok. So 'm removing the underscore. Should I make it public with publicVariableServer/client also? This file basically is used to spawn cars in random points selected from the array #EDIT also, I'm adding in the init.sqf this line: [] execVM "globalPos.sqf" is it right? Or should I compile it?
  11. Hello again, I've created a script called GlobalPos.sqf in which there are all the positions I need in array format like this: _GlobalPOS = [ [3232,455,21], [576,65,80], [1232,1425,33], [4232,5455,90], [11232,8455,67] ]; Now If I want to call this array from another script, should I add something to GlobalPos.sqf?
  12. If I understand it right, you are trying to spawn a player in an MP environment with given id, UID and name, but you don't know how to do this?
  13. Linker Split

    Export text via script to a .txt file

    it looks like this: EP_fn_saveData = { private ["_car","_nmbr"]; diag_log "EP_fn_saveData.sqf is about to be executed"; _car = _this select 0; _nmbr = _this select 1; //Start saving position if (_nmbr == 1) exitWith { _xPos1 = ((getPosASL _car) select 0); // X COORDINATES _yPos1 = ((getPosASL _car) select 1); // Y COORDINATES _zPos1 = ((getPosASL _car) select 2); // HEIGHT COORDINATES _typeOf = typeOf _car; _d = direction _car // SAVING ALL VARIABLES profileNameSpace setVariable [format["xPos%1",_nmbr],_xPos1]; profileNameSpace setVariable [format["yPos%1",_nmbr],_yPos1]; profileNameSpace setVariable [format["zPos%1",_nmbr],_zPos1]; profileNameSpace setVariable [format["typeCar%1",_nmbr],_typeOf]; profileNameSpace setVariable [format["dirCar%1",_nmbr],_d]; saveProfileNameSpace; diag_log "EP_fn_saveData.sqf has finished executing"; }; }; ----------------------------------------------------- SOLVED: changed the code to: ----------------------------------------------------- EP_fn_saveData = { private ["_car","_nmbr"]; diag_log "EP_fn_saveData.sqf start loading"; _car = _this select 0; _nmbr = _this select 1; _typeOf = typeOf _car; _d = direction _car; profileNameSpace setVariable [format["xPos%1",_nmbr],((getPosASL _car) select 0)]; profileNameSpace setVariable [format["yPos%1",_nmbr],((getPosASL _car) select 1)]; profileNameSpace setVariable [format["zPos%1",_nmbr],((getPosASL _car) select 2)]; profileNameSpace setVariable [format["typeCar%1",_nmbr],_typeOf]; profileNameSpace setVariable [format["dirCar%1",_nmbr],_d]; saveProfileNameSpace; diag_log "EP_fn_saveData.sqf has finished executing"; };
  14. Linker Split

    Export text via script to a .txt file

    in my mission init.sqf there's: call compile preprocessFileLineNumbers "DBSave\EP_fn_saveData.sqf"; //========CAR.SQF LOAD==========\\ [] execVM (DIR_S + "Car.sqf"); EP_fn_saveData.sqf is the function with the data inside of corse, while car.sqf is the script for spawning cars. Inside this script, there's a check for the type of car, then the line [_vehicle1,_nmr] spawn EP_fn_saveData; where _vehicle1 is the create vehicle, and _nmr has been defined equal to 1 (other cars got 2, 3, 4...etc). diag_log works till this line
  15. Linker Split

    Export text via script to a .txt file

    A friend of mine is creating a little program that reads the info from the .vars file, writes them into the SQL. After that, when server restarts, it takes the data from the SQL and writes them down into a SQF that will be used to check for variables :D
×