Hello Ladies and Gentlemen. Firstly, you can find all the files I've modified here (It is a direct download for the ZIP file.) Any other files from Exile (Client or Server side) I have not touched!
Alternatively: https://github.com/CarbonDPG/DPGaming What I'm trying to do:
I'm attempting to implement an old style of Base Raiding from ArmA 2, except slightly modified. The way it worked was you (or anyone) could remove a plot pole and then replace it. Everything would remain the same. Items would still be tied to the new pole. I'm doing something similar in ArmA 3 Exile, in that I'm sending an UPDATE request to the DB. My exile.ini file was modified to include the appropriate update request. During the Googling I've done to see if this already exists, I only saw one mention in an obscure thread where someone had written something similar for 1 server specifically.
I'm able to utilize two existing SQL functions "updateTerritoryModerators" and "updateTerritoryBuildRights" to automatically assign those values as well. I haven't gotten to this point yet, because I can't even change "owner_uid". The goal of course being the removal of any other rights on the flag. I've chosen to do this because anything else to my knowledge would require a complete rework of how the DB is setup. (Each construction object has a FK "territory_id" to which it belongs.) My method (would in theory) mean all objects would remain, which is the entire goal while allowing players to steal a pole. All this works manually, I might add. In other words, I can go to MySQL and manually say "UPDATE territory SET owner_uid = xxxxxxxxxxxxxxx WHERE id = y;". But I haven't the time for that BS.
extDB2 operates differently then straight SQL code; but I think I've gotten it. (I haven't received any errors from the SQL specifically... as of yet.) I say that, but obviously I've been doing *something* wrong, otherwise I wouldn't be here seeking assistance! The Problem:
I'm unable to correctly stop the stealing of a flag if the stealer has already met their max flag limit. Provided they ARE able to steal this flag, the call to UPDATE the correct (owner_uid) columns fails. Here's what I've tried.
My initial step was to use the forEach counter utilized in Exile_Client's call on getNumberOfTerritories.sqf (Found in @Exile\addons\exile_client\code\ExileClient_util_territory_getNumberOfTerritories.sqf). This was for the check to see if they can even steal it. That was just straight copy-pasted into the server side "stolenFlagRequest" file. (My completed non-functional file can be found on Github is called "ExileServer_system_territory_network_flagStolenRequest - ObjCount.sqf".) It failed to correctly detect that I had reached my max limit, and also failed to send the UPDATE request to my database. I should've seen a change in the owner_uid column. I did not. The file was named correctly during testing (I changed it after to distinguish the two files for this post.).
Second try was using the DB Call to count the number of territories owner_uid = ? has.
SQL Code:
SELECT count(id) FROM territory WHERE owner_uid = 76561198175104201;
That also failed to function correctly, and did not throw the appropriate error "Too many bases owned!". It also failed to change the DB Entries, given that it wasn't changed from the previous iteration. That file, called "ExileServer_system_territory_network_flagStolenRequest.sqf" on github is also included. The DB call in exile.ini is simply called "getNumTerritoryIDs". If I recall correctly (and understood during my research), count(id) should automatically return the number of territory ID's belonging to the owner_uid.
*Also, is it even legal in SQF to make two or more calls to various other functions? In other words, can I do the following?
format ["updateTerritoryOwner:%1:%2", _myUid, _databaseID] call ExileServer_system_database_query_fireAndForget;
format ["updateTerritoryBuildRights:%1:%2", _myUid, _databaseID] call ExileServer_system_database_query_fireAndForget;
format ["updateTerritoryModerators:%1:%2", _myUid, _databaseID] call ExileServer_system_database_query_fireAndForget;
I could be going about this in an entirely wrong fashion. This is my first attempt at trying to mod a game. Feel free to call me a giant dumbass if I've missed something stupidly obvious, I won't be offended. If you have questions that I haven't explained well, or haven't touched base on, please do NOT hesitate to ask me!!
I appreciate any input you guys may have.
Cheers,
Michael