Search the Community
Showing results for tags 'scripting help needed'.
Found 2 results
-
I would love to have a intel gathering system similar to the Extraction mission from WS. Im not looking to have the fancy transitions where the intel appears on the desk when its handed in at HQ but something a bit simpler. Im an absolute scripting newb so I tried Chat GPT to help 🙂 It worked out the first part of the system where the enemy has a random chance of spawning intel in their inventory that I can collect as a physical item in my inventory private _intelItems = ["MobilePhone","SmartPhone","FlashDisk","Wallet_ID"]; /* This function will add random item to unit, if the unit has space in inventory for it. How to use the function: [ unit,//<unit> to which item should be added [],//<array of strings> array of items that function should add (this array can´t be empty) 0,//<scalar> number that will be randomized. (default:10) 0//<scalar> number that should be always lower than number randomized. The lower the number is the higher is the chance that unit will have the item generated. If number is 0 every unit will have random item selected (default:0) ] spawn soldierXXXX_fnc_randomItem; Example:[player,["FirstAidKit"],10,1] spawn soldierXXXX_fnc_randomItem; */ soldierXXXX_fnc_randomItem = { scriptName "RandomItem"; params ["_unit","_itemsArray",["_RandomNumber",10],["_RandomNumberLow",3]]; private _addIntel = round random _RandomNumber; if (_addIntel < _RandomNumberLow) exitWith {}; private _randomItem = selectRandom _itemsArray; if (_unit canAdd _randomItem) then { _unit addItem _randomItem; }; }; { [_x,_intelItems,10,6] spawn soldierXXXX_fnc_randomItem; } forEach units opfor; But I'm (Chat GPT) really struggling to work out anyway of counting how many items of intel the player has collected and anyway of dropping the intel off back at HQ. If I could have a counter of how many has been collected I could start activating triggers and events as the mission progresses. Any help would be very much appreciated!
-
Maybe this has already been discussed somewhere, but I couldn't find it, so I apologise in advance for possibly repeating a question that has already been asked here before. If there is a forum thread where it has already been discussed, send me the url. I created a .pbo file, which connected as an addon to the arma. With this, I figured it out. In general, I want my script runs every time I start any mission in arma3. I have config.cpp and the script itself with script.sqf file in the same folder. The sqf so far uses the hint call script just to check its auto-run. I've already tried everything and nothing happens after starting the mission or starting the game in the editor. My cpp file contains this but didnt work: class CfgPatches { class MyAddon { units[] = {}; weapons[] = {}; requiredVersion = 1.0; requiredAddons[] = {}; class Extended_InitPost_EventHandlers { class MyAddon { init = "call compile preprocessFileLineNumbers 'script.sqf';"; }; }; }; }; What's the best practice for this now?