Sandbird
-
Posts
1045 -
Joined
-
Last visited
-
Days Won
16
Content Type
Profiles
Forums
Articles
Posts posted by Sandbird
-
-
Step 8 means this:
In your compiles.sqf you'll find this line:
player_selectSlot= compile preprocessFileLineNumbers "z\addons\dayz_code\compile\ui_selectSlot.sqf";
That means that player_selectSlot will be loaded from the map files, (particularly the dayz_code.pbo). Inside it in folder compile is the sqf you want.
Extract that file from the .pbo and place it somewhere in your MPMission files.....like \MPMission\dayz_11.chernarus (or whatever your mpmission file is called)\custom
and then change that line in your compiles.sqf to
player_selectSlot= compile preprocessFileLineNumbers "custom\ui_selectSlot.sqf";
so the mission file searches for that file in your mppmission and not dayz_code.pbo anymore.
Then open that file and do the additions
-
Cause that part of code was working fine, lol....but its easy...you can do it with arma2net like this :
_keyvg = format["SELECT COUNT(*) FROM `object_data` WHERE `Instance` = '%1'", dayZ_instance]; _data2 = _keyvg call myserver_hiveReadWriteLarge; _response = _data2 select 0 select 0; _count = parseNumber(_response); now _count has the number of all the objects.
This will bring ALL the objects from the database...the way i like it, cause i ran all the 'cleanup' sqls before the server starts...so all this:
AND `ObjectUID` <> 0 AND `CharacterID` <> 0 AND `Datestamp` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL "+lexical_cast<string>(_cleanupPlacedDays)+" DAY) AND ( (`Inventory` IS NULL) OR (`Inventory` = '[]') )
is irrelevant to me :)
-
Thats really nice hambeast, didnt think of that before. I guess when you are in the fever of writing something you bypass some security concerns :P
Well my db user cant drop things, only insert and update and the occasional delete...but not drop. Thats another way to go...Make a new db user for your arma2net user, that can only do these 3 things, select, update, delete and nothing more
-
I am doing a whole bunch of stuff in my system_monitor.sqf.
I'll give you the important stuff cause you dont have my custom scripts and it will only confuse you, if i send my whole file.
After if (isServer && isNil "sm_done") then { i have:
serverVehicleCounter = []; _hiveResponse = []; for "_i" from 1 to 5 do { diag_log "HIVE: trying to get objects"; _key = format["CHILD:302:%1:", dayZ_instance]; _hiveResponse = _key call server_hiveReadWrite; if ((((isnil "_hiveResponse") || {(typeName _hiveResponse != "ARRAY")}) || {((typeName (_hiveResponse select 1)) != "SCALAR")})) then { if ((_hiveResponse select 1) == "Instance already initialized") then { _superkey = profileNamespace getVariable "SUPERKEY"; _shutdown = format["CHILD:400:%1:", _superkey]; _res = _shutdown call server_hiveReadWrite; diag_log ("HIVE: attempt to kill.. HiveExt response:"+str(_res)); } else { diag_log ("HIVE: connection problem... HiveExt response:"+str(_hiveResponse)); }; _hiveResponse = ["",0]; } else { diag_log ("HIVE: found "+str(_hiveResponse select 1)+" objects" ); _i = 99; // break }; }; _BuildingQueue = []; _objectQueue = [];
so far so good....now we'll ask how many objects are in the db and start "selecting" them
if ((_hiveResponse select 0) == "ObjectStreamStart") then { // save superkey profileNamespace setVariable ["SUPERKEY",(_hiveResponse select 2)]; _hiveLoaded = true; diag_log ("HIVE: Commence Object Streaming..."); _key = format["CHILD:302:%1:", dayZ_instance]; // Yes i use the default one here to just get how many objects are in the db (total number) _objectCount = _hiveResponse select 1; _bQty = 0; _vQty = 0; for "_i" from 0 to (_objectCount) do { if (_i != _objectCount) then { _keyvg = format["SELECT `ObjectID`, `ObjectUID`, `Classname`, `CharacterID`, `Worldspace`, `Inventory`, `Hitpoints`, `Fuel`, `Damage` FROM object_data WHERE `Instance`='%1' AND `Classname` IS NOT NULL LIMIT %2,1",dayZ_instance, _i]; //sleep .001; // This sleep helped sometimes, when for some reason some objects were skipped....probably cause the .dll isnt that fast ?!? _data2 = _keyvg call myserver_hiveReadWriteLarge; _response = _data2 select 0 select 0; if ((_response select 2) isKindOf "ModularItems" || ((_response select 2) in dayz_allowedObjects)) then { _BuildingQueue set [_bQty,_response]; _bQty = _bQty + 1; } else { _objectQueue set [_vQty,_response]; _vQty = _vQty + 1; }; }; //sleep 0.001; }; diag_log ("HIVE: got " + str(_bQty) + " Epoch Objects and " + str(_vQty) + " Vehicles"); };
Notice my _keyvg and bellow the call myserver_hiveReadWriteLarge;
its a function that i added in server_functions.sqf...i'll add it at the end of this post.
The above code selects 1 by 1 every object from the object_data table...and check if its modular + if its in the dayz_allowedObjects....cause some buildings are not Modular....so it puts them with the vehicles...Meaning some vehicles might spawn first and then some buildings on top of them....making them fall through on server restart.
After then we got:
// # NOW SPAWN OBJECTS # _totalvehicles = 0; { _idKey = _x select 0; _vUID = _x select 1; _type = _x select 2; _ownerID = _x select 3; _worldspace = call compile (_x select 4); _inventory = call compile (_x select 5); _hitPoints = call compile (_x select 6); _fuel = call compile (_x select 7); _damage = call compile (_x select 8);
The above call compiles and selections are a bit different from the default ones....this will make sure you grab them correctly, to be used further down with the proper values.
_vUID is basically the ObjectUID....I use it further down with:
_object setVariable ["ObjectUID", _vUID, true];
right after the creation of the 'vehicle'. So its basically:
_object = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"]; _object setVariable ["lastUpdate",time]; _object setVariable ["ObjectID", _idKey, true]; _object setVariable ["ObjectUID", _vUID, true];
And thats it....This will stream all the objects from the db.
Now what was that call myserver_hiveReadWriteLarge ?
Open your server_functions.sqf and above server_hiveWrite add this:
myserver_hiveReadWriteLarge = { private["_mykey","_qres","_mydata"]; _mykey = _this; _mydata = format["Arma2NETMySQLCommand ['dayz_epoch',""%1""]",_mykey]; //dayz_epoch is your db name (dont forget your db user/pass in Database.txt) SQL_RESULT = "Arma2Net.Unmanaged" callExtension _mydata; _qres = call compile SQL_RESULT; _qres };
This is the custom hiveReadWriteLarge function.
Not that it matters, but i have converted all the rest hive functions as well.
myserver_hiveWrite = { private["_mykey","_mydata"]; _mykey = _this; _mydata = format["Arma2NETMySQLCommand ['dayz_epoch',""%1""]",_mykey]; SQL_RESULT = "Arma2Net.Unmanaged" callExtension _mydata; }; myserver_hiveRead = { private["_mykey","_qres","_mydata"]; _mykey = _this; _mydata = format["Arma2NETMySQLCommand ['dayz_epoch',""%1""]",_mykey]; SQL_RESULT = "Arma2Net.Unmanaged" callExtension _mydata; _qres = call compile format ["%1",SQL_RESULT]; _qres = _qres select 0; _qres }; myserver_hiveReadWrite = { private["_mykey","_qres","_mydata"]; _mykey = _this; _mydata = format["Arma2NETMySQLCommand ['dayz_epoch',""%1""]",_mykey]; SQL_RESULT = "Arma2Net.Unmanaged" callExtension _mydata; _qres = call compile format ["%1",SQL_RESULT]; _qres }; myserver_hiveReadWriteLarge = { private["_mykey","_qres","_mydata"]; _mykey = _this; _mydata = format["Arma2NETMySQLCommand ['dayz_epoch',""%1""]",_mykey]; SQL_RESULT = "Arma2Net.Unmanaged" callExtension _mydata; _qres = call compile SQL_RESULT; _qres };
So this is one way of making a call to the db. We have the _key with the SQL and then call the function to get back results.
The other way is the one i showed on the 1st post, which is this:
"Arma2Net.Unmanaged" callExtension format["Arma2NETMySQLCommand ['dayz_tavi','INSERT INTO object_data (ObjectUID, Instance, Classname, CharacterID, Worldspace, Inventory, Hitpoints, Fuel, Damage, Datestamp) VALUES ('%1','%2','%3','%4',''%5'','%6','%7','%8','%9',CURRENT_TIMESTAMP)']",_uid,dayZ_instance,_class,_characterID,_worldspace,_inventory,_array,_fuel,_damage];
I use this usually to insert or update stuff, when i dont have anything to return.
-
yup. Almost nothing is done by the hiveext.dll anymore. I use Arma2Net for everything :
- Bring all the objects from the db when the server starts
- Update character and Objects in the database in system_monitor.sqf
- Create vehicles in db from traders
- Use it in tons of custom scripts i wrote (Custom Plotpole information about when you last maintained it, Custom friendlist, Custom coin system....and many other little tweaks)
Most of this stuff was done with Arma2Net cause i need to store the playerUID in CharacterID slot like it was before the Steam update. Sure i could create a fake playerUID to fit in the cell but i wanted to do it properly...for when epoch team releases a .dll that has bigint(24) instead of int(11) for characterID.
Its not that hard to setup or use. For example....in dayz_server/compiles/server_swapObject.sqf
It used to be:
_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0 , _characterID, _worldspace, [], [], 0,_uid]; diag_log ("HIVE: WRITE: "+ str(_key)); _key call server_hiveWrite;
And based on this page here: https://github.com/vbawol/DayZhiveEpoch/blob/13003e840f6ac55cef37bfc26b525a32676aabd2/Hive/Source/HiveLib/DataSource/SqlObjDataSource.cpp
where it says bool SqlObjDataSource::createObject, we recreate the SQL with arma2net
"Arma2Net.Unmanaged" callExtension format["Arma2NETMySQLCommand ['dayz_epoch','INSERT INTO object_data (ObjectUID, Instance, Classname, CharacterID, Worldspace, Inventory, Hitpoints, Fuel, Damage, Datestamp) VALUES ('%1','%2','%3','%4',''%5'','%6','%7','%8','%9',CURRENT_TIMESTAMP)']",_uid,dayZ_instance,_class,_characterID,_worldspace,_inventory,_array,_fuel,_damage];
only in this case...i use the arma2net dll....which means i can store the big playerUID inside the characterID cell in db.
I havent tried extDB yet. I am pretty happy with Arma2Net. It has a couple of hiccups now and then....like there are some weird cases where the server wont load it on a scheduled restart, so basically nothing spawns on the map. But that happened twice in 30 days. 240 restarts in a month and 2 fails....thats fine for me :)
Overall i'd say go for it. You can get the files from the signature bellow...the 3d.live.mission uses the same files...All you have to do is edit the Databases.txt.
-
yeah, works fine for me :) I had just forgot to add an extra value to a function bellow...I fixed the first post...its fine now.
-
I still dont get the tweaks i have to do on the client files so that the HC takes over zombie and loot spawn.
For example, i have to load 2 compiles.sqf, one goes for normal players and one for HC.
But....On the player's compiles.sqf setting the zombie_generate and wild_spawnZombies to "" still makes the client produce zombies.
Which files on the client side have to be nerfed so i can let the HC do its job ?
Right now both (me and the HC) make zombies...If i dc the HC some of the zombies around me disappear but no all.
-
Do it like this:
_isalb = cursorTarget isKindOf "AH6J_EP1_DZE"; _mgQTY = {_x == "2000Rnd_762x51_M134"} count magazines player; if (_mgQTY == 2 and _isalb) then { if (s_player_litl < 0) then { s_player_litl = player addAction ["add M134 ammo x2","custom\littlebird.sqf",cursorTarget, 0, false, true, "",""]; }; } else { player removeAction s_player_litl; s_player_litl = -1; };
Dont forget to add : s_player_litl = -1; in your variables.sqf
And also "_isalb","_mgQTY" at the top of your fn_selfactions.sqf inside the private declaration
-
you could try modifying my code to convert to int64 instead of 32 and see if that helps. If you have visual studio, I'd set a breakpoint along those lines and see where it is throwing the exception, exactly.
Yeah, i figured its something to do with that....nah dont have VS...had it but cant be bothered really to compile it for that....i'll be reconverting my db back to normal when the normal hivext gets released...i'll use it then :)
-
Well this is how i do it.
Lets say you create a ListBox and you want to populate it with some data.
For example:
{ _name = format["Potato %1", x]; _index = _ListBox lbAdd _name; _ListBox lbSetData [_index, x]; }; } forEach _arrayID;
lets say i have an array with Ids,
I populate the _ListBox which is basically a RscListBox with row like Potato 1, Potato 2 etc.
Then i set a hidden value to each row with lbSetData...which sets the index of the row, and then the hidden value....in this case the ID from the array.
So when a player selects row Potato 3 for example, i know he selected 3.
Now to retrieve the data selected ?
There are 2 ways...
One on your button (the OK button i mean) you can do :
onButtonClick = "call okPressedFunction;";
And in that script (you can do it like compiles.sqf does it...make a files and call compile it with name okPressedFunction) to this:
_dialog = findDisplay YourCustomDialogueName; _ListBox = _dialog displayCtrl YourCustomListBoxClassHere; _index = lbCurSel _ListBox; _playerSelection = _ListBox lbData _index; _ddata = call compile _playerSelection; //this might not be necessary if its not an array....like in our case its just a number _selectedID = _ddata select 0; //here is the selection
The other way is in your .hpp file on your buttonclick to grab the selection from the listbox and send it to a script like this:
onMouseButtonClick = "[(lbCurSel 1806)] call okPressedFunction;";
where 1806 is the idc of the listbox
.The you just do _this select 0 in your okPressedFunction script (or _this select 1...not sure) to grab the index from the Listboxedit: crap .... lol
-
Yeah i am using my own custom CharacterID, not plotforlife.
I rewrote all functions about object_data and use Arma2Net cause the hiveext.dll doesnt use a bigint for CharacterID.
Also i made ObjectUID cell unique, for some other reasons :P
-
you could removealleventhandlers on the objects and insert your own but you can't override the cfgvehicles unless you distribute your own custom pbo files.
edit: what are you trying to accomplish? if you just want to change eventhandlers, you can override those easy enough.
I am trying to overwrite the RQ-11 eventhandlers so it loads my scripts instead of its own.
Right now its creating markers on the make with createmarker instead of createmarkerlocal.. I wanna changes them, but the vehicle calls its init.sqf from within the class...i thought by overwriting the class i could do it.
-
If the HC logs out, the zombies would disappear.
Thats what i figured, so the zombies spawning are not done by the HC.
I followed the instructions to the letter....and zombies spawn....but not from the HC then.
Shouldnt i disable something in the files so the HC spawns his ?
-
I dont get it how the bot handles zombies. Dont i have to tweak the server first ?
I mean the client logs in, i can even tp to it and i added it in infistar config, so no more kicks from BE......but.....the zombies are still handled by the server.
I have like 20 zombies around me...i close the HC client, and the zombies are still there. How is it handling the zombies, without me disabling stuff on the server 1st ? How could i know if its working or not?
-Thanks
-
I guess i have to dig in and fix this (as well).
6 wheel vehicles, vehicle hitpoints, traders spawning vehicles on top of each other, wrong objects streaming..........whats one more bug..... :angry: :angry:
-
But the random teleport ? Thats just wrong :/
-
Ultraedit, Ultracompare to compare old with new
-
I am getting some weird bugs from people changing clothes in 1051. Sometimes they get teleported in a trader city, sometimes they change clothes and everything is fine, but they disconnect and when they reconnect they are miles away, or their inventories get wiped.
I am using the epoch files for changing clothes, i just overwritten them to include a global variable when they change clothes (the money they are carrying on them).
I am using the old 1.0.4.2 version file, so they have to drop their backpack first, and of course the latest infistar AH.
Anyone knows whats causing this ? I cant reproduce the bug on the test server, running it alone...
-
Is there a way i can overwrite some functions that get set in class CfgVehicles ?
Particularly vehicles that have an EventHandler in them, like:
class EventHandlers { init = "_this execVM (""custom\init.sqf"")"; };
I want to write my own functions and addactions
Like instead of 'Get In' to replace it with another function.
-
I am trying this and get:
Something is wrong with your DB connection string... System.OverflowException: Value was either too large or too small for an Int32. at System.Convert.ToInt32(UInt64 value) at System.UInt64.System.IConvertible.ToInt32(IFormatProvider provider) at System.Convert.ToInt32(Object value) at dze_inventory_parser.Program.Main(String[] args)
all my msql details are fine though.
Tried this on my pc and the real server...same error
-
The HC is getting kicked for script restriction #0 although i have 5 "I_AM_A_BAD_HC_IN_WRONG_SLOT" in scripts.txt
It seems that although the HC joins the civilian slot and enters the game...for some reason
if !( playerside == civilian ) then {...
server doesnt recognize it as a civilian and kicks it ?!
(of course, i've added the item2 in mission.sqm and incremented the class at top)
EDIT: Nevermind..i am an idiot...I have an entry with the HC's UID in my character_data table..cause i am testing it from my pc...and it was loading my character.
Its not getting kicked anymore once i deleted the entry.
-
UPDATE (2-11-2014)
I noticed that since the latest arma beta patch, there are some RPT log errors cause the new beta patch is really strict with global variables.
Please check the 1st post of this thread and do STEP 11.
I will update the files with the recent update....No need to replace them...just do step 11
-
Sorry I meant I want to be able to use both.
Add the extra:
["ItemWaterbottleBoiled","Wash zombie guts","execVM 'Scripts\walkamongstthedead\usebottle.sqf';","true"],
in your config.sqf (for ui clicks)....pay attention to the < , > in the end...If its the last array...then it doesnt need a comma.
Then use this usebottle.sqf:
private ["_txt","_dis","_sfx","_Qty","_Qty2"]; if (dayz_combat == 1) exitWith { _txt = "You need to hide and get out of combat first."; cutText [_txt, "PLAIN DOWN"]; }; if (isNil "hasGutsOnHim") then {hasGutsOnHim = false;}; if (!hasGutsOnHim) exitWith { _txt = "You are not covered in zombie guts."; cutText [_txt, "PLAIN DOWN"]; }; _Qty = {_x == "ItemWaterbottle"} count magazines player; _Qty2 = {_x == "ItemWaterbottleBoiled"} count magazines player; if ((_Qty >= 1) || (_Qty2 >= 1)) then { // If we're not swimming, let's start the animation to have the player squat if (!dayz_isSwimming) then { player playActionNow "PutDown"; }; switch (true) do { case ("ItemWaterbottle" in magazines player): { player removeMagazines "ItemWaterbottle"; for "_x" from 1 to _Qty do { sleep 1; _dis = 5; _sfx = "fillwater"; [player,_sfx,0,false,_dis] call dayz_zombieSpeak; [player,_dis,true,(getPosATL player)] spawn player_alertZombies; player addMagazine "ItemWaterbottleUnfilled"; }; sand_washed = true; hasGutsOnHim = false; // Success on cleaning - Inform the player if (_Qty > 1) then { cutText [format["You used %1 water bottles to clean yourself from the zombie parts.",_Qty], "PLAIN DOWN"]; } else { cutText [format["You used your water bottle to clean yourself from the zombie parts."], "PLAIN DOWN"]; }; }; case ("ItemWaterbottleBoiled" in magazines player): { player removeMagazines "ItemWaterbottleBoiled"; for "_x" from 1 to _Qty2 do { sleep 1; _dis = 5; _sfx = "fillwater"; [player,_sfx,0,false,_dis] call dayz_zombieSpeak; [player,_dis,true,(getPosATL player)] spawn player_alertZombies; player addMagazine "ItemWaterbottleUnfilled"; }; sand_washed = true; hasGutsOnHim = false; // Success on cleaning - Inform the player if (_Qty > 1) then { cutText [format["You used %1 water bottles to clean yourself from the zombie parts.",_Qty], "PLAIN DOWN"]; } else { cutText [format["You used your water bottle to clean yourself from the zombie parts."], "PLAIN DOWN"]; }; }; default { cutText [format["You have no full water bottles to clean yourself from the zombie parts."], "PLAIN DOWN"]; }; }; }else { cutText [format["You have no full water bottles to clean yourself from the zombie parts."], "PLAIN DOWN"]; };
-
Thank you Sandbird! Just had to change the custom to Scripts and it worked perfectly. One last thing, I would like players to be able to use ItemWaterbottleBoiled to wash off the guts. I added it to my Extra_Rc.hpp and it calls from the bottle, but still looks for ItemWaterbottle...
Open custom\walkamongstthedead\usebottle.sqf and change all occurrences of
ItemWaterbottle to ItemWaterbottleBoiled
[Release] Walk Amongst The Dead - (Hide from zombies like "The Walking Dead")
in A2: Epoch Mods (1.0.5.1)
Posted
yeah, the latest update i meant