Jump to content

7erra

Member
  • Content Count

    753
  • Joined

  • Last visited

  • Medals

Everything posted by 7erra

  1. Oh no. I think I know where that problem comes from. Will fix asap.
  2. 7erra

    Generic error in bis_fnc

    Yeah the example on the BIKI is wrong. The function has to be spawned: [1, "WHITE", 5, 1] spawn BIS_fnc_fadeEffect; I am going to correct it.
  3. 7erra

    Show Map Ingame

    Hmmm. Setting the commit time to 4 will take 4 seconds to even reach the position. It would probably be better to commit in one second and sleep for four.
  4. Not sure what you mean by that but if you want to execute a script (function) here's how to do it: You can make a function library just like in a description.ext. Here is an example from one of my mods: config.cpp (Full mod: https://github.com/7erra/VASS-Virtual-Arsenal-Shop-System/tree/VASS-3den-Mod) class CfgPatches { class TER_VASS { author="Terra"; name="Virtual Arsenal Shop System - 3den Editing"; url=""; requiredAddons[]={3den, A3_Ui_F}; requiredVersion=0.1; units[]={}; weapons[]={}; }; }; class CfgFunctions { class TER { class VASS { class vasscargo {file = "\VASS_3den\gui\scripts\fn_vasscargo.sqf";}; }; }; }; The file is located inside of the VASS_3den.pbo. Now I can call TER_fnc_vasscargo from anywhere inside of the game. Btw I use Mikero's Tools to pack my pbos because it works way better than with the A3 Tools one.
  5. 7erra

    Show Map Ingame

    How are you executing the code? Is suspension allowed?
  6. The addShop function is a local one so placing it in the init.sqf should be fine to guarantee JIP compability. For dynamically adding a shop you should remoteExec the function like this: [_seller,_sellerText] remoteExec ["TER_fnc_addShop",[0, -2] select isDedicated]; This way the action will only be added to players. If the server is a dedicated one and not a hosted one then the action is not added on the server (because it can't access it either way). Only execute this code from one instance, eg the server, because remoteExececing from the init.sqf is unneccessary network trafic and might lead to some problems when a new player joins. The addShopCargo function can be either local or global (and JIP compatible). The fourth parameter defines its behaviour. By default the cargo is shared across the network. I have to admit that I wasnt able to test the MP compability but I tried to put my theoretical knowledge to use.
  7. Errrr... Spot the difference: That's right: One works the other doesn't. (???) Here is the working one: disableserialization; //--- Using idcs to indentify your controls is fine when using the createDialog command but using displayCtrl is safer and in some cases the only option _display = findDisplay 3663;// Can also be replaced with the onLoad eventhandler as the first parameter is the display _listbox = _display displayCtrl 1500; //--- Add items to the listbox _recipeArray = ["Food Materials", "Raw Materials"]; // array of items in list { _listbox lbAdd _x; } forEach _recipeArray; //--- Add an eventhandler to the listbox that executes code when the user selects an entry _listbox ctrladdeventhandler ["LBSelChanged",{ params ["_listbox","_index"]; _ctrlPicture = (ctrlParent _listbox) displayCtrl 1200; _picture = ["images\1.paa","images\2.paa"] param [_index, ""]; _ctrlPicture ctrlSetText _picture; }];
  8. https://ace3mod.com/wiki/framework/arsenal-framework.html#21-adding-ace-arsenal-to-a-box _box addAction ["ACE Arsenal", { params ["_target", "_caller", "_actionId", "_arguments"]; [_target, _caller] call ace_arsenal_fnc_openBox; }];
  9. UI eventhandlers are your friend! disableserialization; //--- Using idcs to indentify your controls is fine when using the createDialog command but using displayCtrl is safer and in some cases the only option _display = findDisplay 3663;// Can also be replaced with the onLoad eventhandler as the first parameter is the display _listbox = _display displayCtrl 1500; //--- Add items to the listbox _recipeArray = ["Food Materials", "Raw Materials"]; // array of items in list { _listbox lbAdd _x; } forEach _recipeArray; //--- Add an eventhandler to the listbox that executes code when the user selects an entry _listbox ctrlAddEventHandler ["LBSelChanged", { //--- This is a completely independent script so any variables from the main scope are not avaiable here params ["_listbox","_index"];// Arguments that were passed from the event _ctrlPicture = ctrlParent _listbox displayCtrl 1200;// ctrlParent returns the display (can also be replaced with finddisplay IDD) _picture = ["images\1.paa","images\2.paa"] param [_index, ""]; // Same as select but prevents loading of a file that doesn't exist _ctrlPicture ctrlSetText _picture; }];
  10. Sounds familiar. I remember changing the picture's file and the texture ingame staying the same too. I never knew the reason (maybe because the mission is cached?). Might work though I doubt it. For some reason arma needs to have the file's name changed before loading another picture. Just letting you know that you are not the only one. Afaik the problem has been around for a long time now.
  11. At the moment nowhere. Hard to explain why not but I have a fix for that ready. There are also other items which cant be added but I included them in the next update. Still polishing another feature before release so stay tuned ^^
  12. Yup just the way I would have done it 😉
  13. That's because the addRating command needs the _killer to be local (welcome to hell aka MP scripting!). The better way to handle things is to put this script into the initServer.sqf: addMissionEventHandler ["EntityKilled",{ params ["_killedUnit","_killer","_triggerMan"]; if (side group _killedUnit isEqualTo east) then { [_killer, 500] remoteExec ["addRating",_killer]; }; }]; The eventhandler executes the code in the brackets on the server only. The remoteExec command executes the addRating command on the _killer's computer (where he is also local). On another note: If I am correct then the side of the _killedUnit will always be civillian because he is dead. A better way to get the side of a deceased unit is to get the side of it's group.
  14. Okay so here is how to operate a scripted database with the BI functions: /* Declaration of the databse First of all there has to be an array which fits the database format. This format is the following: [ "#CLASS_0", [ "#SUBCLASS_0_0", [ "&VALUE_0_0_0", 0, "&VALUE_0_0_1", 1, "&VALUE_0_0_3", "anything" ], "#SUBCLASS_0_1", [ "&VALUE_0_1_0", 0, "&VALUE_0_1_1", 1, "&VALUE_0_1_2", "anything" ] ], "#CLASS_1", [ // anything ] ] */ //--- EXAMPLE: // _db uses the uid to save stats to a database _db = ["#PLAYERS",["#1234",["&NAME","Terra","&MONEY",100,"&RANK","COLONEL"]]]; // The money stat can be accessed with _pathMoney = ["players","1234","money"]; // The class ("#") and value ("&") symbol are ignored and the search is case insensitive //--- Get money // The database _db is accessed at the given path. The value that fits the variable is returned. _money = [_db, _pathMoney] call BIS_fnc_dbValueReturn; //--- Set new money // Passing an array to the function modifies the array. If the class(es) is(/are) non existent, it(/they) are created. [_db, _pathMoney, _money +100] call BIS_fnc_dbValueSet; _db // returns new database So basically when there is a "path" parameter it is comparable to a config entry. Instead of using the >> operator you simply change it to an array: // Config: getNumber ("players" >> "1234" >> "money"); // DB: [_db, ["players", "1234", "money"]] call BIS_fnc_dbValueReturn; I wonder why these functions were forgotten even though they can be used to create a pretty neat database?
  15. Does anyone have experience with the database functions of arma? How can I use them to make a database? I was not able to figure out what the arrray, that the database is, is supposed to look like. BIS_fnc_dbSymbolClass BIS_fnc_dbSymbolValue BIS_fnc_dbisClass BIS_fnc_dbisValue BIS_fnc_dbClassId BIS_fnc_dbClassSet BIS_fnc_dbClassCheck BIS_fnc_dbClassIndex BIS_fnc_dbClassRemove BIS_fnc_dbClassReturn BIS_fnc_dbClassList BIS_fnc_dbValueId BIS_fnc_dbValueSet BIS_fnc_dbValueCheck BIS_fnc_dbValueIndex BIS_fnc_dbValueRemove BIS_fnc_dbValueReturn BIS_fnc_dbValueList BIS_fnc_dbImportConfig BIS_fnc_dbImportXML BIS_fnc_dbConfigPath BIS_fnc_dbPrint Directory: a3\functions_f\database Seems to have been introduced with TKOH.
  16. Yeah the (very rare) documentation states that the database is only a scripted one. This means that during mission runtime there is a global array which gets accessed and modified. This array could be saved to profilenamespace at the end of the mission or when appropriate. My current approach is the BIS_fnc_addToPairs functions and the related functions. But having such a functions library at hand seems quite intriguing once I've figured out how to do it 🤔. Will keep this updated.
  17. Okay so here is the format of the database: [// Imported with BIS_fnc_dbImportXML (db.xml) "#XML",[], // ??? "#PLAYERS",// Class [ "#TERRA", // SubClass0 [ "&MONEY","100","&RANK","COLONEL","&UID","123456" // Values of SubClass0 ], "#AASGEYER", // SubClass1 [ "&MONEY","50","&RANK","PRIVATE","&UID","789102" // Values of SubClass1 ] ] ] Here is the db.xml that I used: <?xml version="1.0"?> <players> <terra> <money>100</money> <rank>COLONEL</rank> <uid>123456</uid> </terra> <aasgeyer> <money>50</money> <rank>PRIVATE</rank> <uid>789102</uid> </aasgeyer> </players> The next problem is to figure out how to access and modify the database.
  18. Oh that was not intentional. I rewrote part of the script and it seems that I missed the cursor position to delete the entire line 😅 New fix on GitHub.
  19. It is not you who forgot something important but me 😄. There was a line of code which I copied and didn't modify so the change in the players money was never executed correctly. The newest commit on GitHub fixes that.
  20. https://community.bistudio.com/wiki/BIS_fnc_exportInventory The arsenal uses this function too.
  21. Is there a possibilty to create a rectangular camera area for Zeus? The addCuratorCameraArea command only makes circles. I can work around the circular editing area by adding an eventhandler but restricting the camera is beyond me... Thanks! 7erra
  22. I was thinking that you are using the arsenalShop version but if you are using VASS then there should be no TER_moneyVariable as I have found an easier and more adaptable way of getting and setting the players money. In which script is the error occurring? Also just changed the example code for getting and setting the money to use the rating system of arma which tracks enemies and friendlies killed.
  23. Normally yes but the TER_moneyVariable is a global variable which represents a string defined in the config.sqf: // config.sqf, line 5 TER_moneyVariable = "TER_money"; Have you added these lines to your description.ext? class CfgFunctions { #include "arsenalShop\cfgFunctions.hpp" }; I am going to recommend switching to the newest update. It is easier to handle and more stable. I'm stupid. I was using a wrong variable for the condition so it never showed... GitHub updated again. Code should look like this: if (hasInterface) then {// adding an action on a client which cant access the shop doesnt make sense _shop = [TraderTest,"Shop test"] call TER_fnc_addShop; }; _cargoArray = [ // array in format: "class", price, amount "arifle_AK12_F",100,5, "arifle_AKM_F",50,5, "arifle_MX_F",75,5, "hgun_P07_F",20,5, "optic_DMS",10,5, "optic_ACO_grn",5,5, "B_AssaultPack_mcamo",25,5, "U_B_CombatUniform_mcam",15,5, "30Rnd_762x39_Mag_F",5,true, "30Rnd_65x39_caseless_mag",13,true ]; if (isServer) then {// only add inventory at mission start [TraderTest, _cargoArray, 2] call TER_fnc_addShopCargo; };
  24. The TER_fnc_addShop function runs locally so init.sqf is fine. The next step would be to add an inventory to the trader: if (hasInterface) then {// adding an action on a client which cant access the shop doesnt make sense _shop = [TraderTest,"Shop test"] call TER_fnc_addShop; }; if (isServer) then {// only add inventory at mission start [ TraderTest,// object [// array in format: "class", price, amount "arifle_AK12_F",100,5, "arifle_AKM_F",50,5, "arifle_MX_F",75,5, "hgun_P07_F",20,5, "optic_DMS",10,5, "optic_ACO_grn",5,5, "B_AssaultPack_mcamo",25,5, "U_B_CombatUniform_mcam",15,5, "30Rnd_762x39_Mag_F",5,true, "30Rnd_65x39_caseless_mag",13,true ], 2,// overwrite mode: see VASS\fnc\fn_addShopCargo.sqf for more. in this case set the inventory as the passed array true// make inventory the same for everyone ] call TER_fnc_addShopCargo; }; ON ANOTHER NOTE: I just noticed that I forgot to make the new variable global. Will be fixed in the next update. Until then you can remoteExecCall the function to achieve the same effect (at least for non JIP players): [TraderTest, _cargoArray, 2] remoteExecCall ["TER_fnc_addShopCargo",0]; // add cargo for everyone Due to untested MP environment I am also concerned for JIP players as they will probably receive the starting inventory and not the current one. Added to my todo list. EDIT: Updated GitHub
×