Jump to content

jshock

Member
  • Content Count

    3059
  • Joined

  • Last visited

  • Medals

  • Medals

Everything posted by jshock

  1. From the wiki arrayIntersects: So if they don’t share an element the returned value should be []. I did test this before posting. I avoided making a number of the assumptions you’ve made in your code simply because OP never really specified the intent of the action, only that it’s available when the player has a certain magazine (which can be a type that isn’t for the weapon the player carries, think wasteland or survival modes where you pick up what you can) or uniform. I concede on otherwise inefficient code though, forgot findIf even existed .
  2. Going back to OP about mags and uniform: fnc_hasTheStuff = { params [ ["_unit",objNull,[objNull]], ["_magClasses",[],[[]]], ["_uniClasses",[],[[]]] ]; private _uniClass = toLower uniform _unit; private _magArr = magazines _unit; _magArr pushBackUnique currentMagazine _unit; { _x = _x apply {toLower _x}; } forEach [_magClasses,_uniClasses,_magArr]; private _hasMag = count (_magArr arrayIntersect _magClasses) > 0; private _hasUni = _uniClasses find _uniClass > -1; _hasMag || _hasUni; }; player addAction [ "My Action", {/*do stuff*/}, [], -1, false, true, "", "[_originalTarget,['myMagClass1','myMagClass2'],['myUniformClass1']] call fnc_hasTheStuff" ]; Of course replace info where necessary (in the addAction portion), fnc_hasTheStuff is called with the parameters of a unit (namely the player), an array of magazine classnames and an array of uniform classnames, if the player has either the right magazine or the right uniform then the action is shown.
  3. If you're worried about string defaulted attributes like you had above that have spaces you can test with the return of splitString: count ((getText (missionConfigFile >> "TestClass" >> "test2")) splitString " ") > 1 //returns true //if the returned array from splitString is greater than one element that means there is at least one space in the returned config attribute count ((getText (missionConfigFile >> "TestClass" >> "test1")) splitString " ") > 1 //returns false Of course you can add to what splitString looks for, so if you don't want spaces or dashes or underscores, etc....just add them into the list of delimiters and if the returned array is greater than one element, the value of the attribute is not proper and you can send a RPT report or otherwise notify the user of bad input.
  4. I think I kinda see what you're asking but I'm equally lost. You're thinking robustness of the returned attributes for the class, right? But there is a finite number of config data types: arrays, strings, and scalars. Now I'm thinking the engine defaults anything that is not one of those three types to be a string to avoid unforeseen complications (that's a guess though). So if you need to make sure each attribute is of an expected value you will have to run a unique robustness check on every class attribute where that is necessary. If you want certain attributes to be indirectly boolean you can make the attribute a scalar and use BIS_fnc_getCfgDataBool on that attribute where a value of zero returns false and anything greater than zero returns true.
  5. private _props = configProperties [missionconfigFile >> "TestMain","true",false]; private _attributeValues = []; { private _ele = [_x] call BIS_fnc_getcfgdata; if (_ele isEqualType "") then { if (_ele isEqualTo "true") then { _ele = true; } else { if (_ele isEqualTo "false") then { _ele = false; }; }; }; _attributeValues pushBack _ele; } forEach _props; //for example purposes, use returned array values as necessary copyToClipboard str(_attributeValues); //return: [111,true,"hmmm",["one","two"]]
  6. objNull (in the param array) is the default value that overrides in case an empty argument array is passed in, it’s a robustness thing, and yes can be a placeholder for an absent object, gives us something to check against. The 1.5 is the priority of the action. The higher that value, the higher in the list of actions it will be when you scroll wheel. See addAction for all the details on what’s what.
  7. Just realized a mistake on my part, param for _unit should be: [“_args”, [],[[]]] and you would: _args params [“_unit”] under the original params line
  8. player addAction [ “Sneak Attack”, { params [“”, ””, ””, [“_unit”,objNull,[objNull]]; if (isNull _unit) exitWith {}; [_unit] execVM “myscript.sqf”; }, [cursorTarget], 1.5, true, true, “”, “cursorTarget isKindOf “Man” && alive cursorTarget && *sideCheck* && *distanceCheck* && *stancePlayerCheck* && *speedPlayerCheck*” ]; Something like this replace necessary conditions/script path/name etc. Rough outline at least.
  9. I’m thinking and addAction added to the player checking the side of the cursorTarget of the player (along with all your other conditions, distance/speed/stance/etc) would be more efficient. I’m on my phone or else I would throw up an example, but it’s a concept.
  10. Hm, cool, I'll try and see what it's all about. I've used it before in a super limited capacity over 5 years ago.
  11. Haven't considered Git before, I will try and look into it when I can. Don't know why they can't just contribute here (in the forums) either. Unless I've been away from the game for so long that most modders use Git over anything else now? I think I have looked into Assualtboy's mod, honestly it may have been part of my initial inspiration back in the day. I may be able to pull some ideas out of it for damage handling though, as you pointed out. Thanks! Just an FYI before you push it out to your community too fast, I did just receive some reports on some MP issues with the most recent version. I will be pushing a hotfix as soon as I get things sorted out.
  12. jshock

    Linear execution, how?

    thing = [] spawn { scriptOneHandle = [] execvm "code1.sqf"; waitUntil {scriptDone scriptOneHandle}; scriptTwoHandle = [] execvm "code2.sqf"; };
  13. Ah, yep, I knew speed reading this thread at 4am would come back to bite me. My bad there OP.
  14. Small thing that cleans stuff up a little and if I remember optimized a little better too: _allplayers = (allPlayers select { lifeState _x != "DEAD-RESPAWN" && hasInterface });
  15. UPDATE: v0.5.4 is LIVE OP mirror links updated. Well, when I originally started I wanted to steer away from making any dependencies in my mod and make everything myself. I hated biting the bullet and having to use outside assistance with the code, but I've already let most of you down. I've quasi kept it from being a true dependency but to get the full functionality of this update you will need to load in with Achilles and CBA (links in OP). Now, you only need these extras if you are the Zeus master of the mission everyone else can load in just fine without them . I would like to thank you all again for your esteemed patience . That being said, I bring to you Zeus compatibility. I especially urge those of you that play MP (both player-hosted and dedicated server) to report back with any problems because I no longer have the means to properly test those things anymore. I had a few reports of MP issues from like a year ago but they have, of course, moved on at this point. So please provide any and all feedback possible, the debug module is there for a reason. Changelog:
  16. Don’t get too excited, I’ve only got a couple weeks free and don’t know if I’ll be able to continue at my old rate. If I can, barring a hotfix or anything for the most recent update, I will try and get some very basic Zeus functionality posted up before I hit the grind with school again. This functionality will probably be limited to drag and drop modules from Zeus (with limited to no modularity) for add/remove safe/contaminated areas, make safe vehicles, toggleable invulnerability for units, and maybe a couple other things. This means that add area modules will probably be of a default size and MOPP level. I just didn’t have very strong GUI skills originally and definitely don’t now, that’s why I never did Zeus stuff in the first place.
  17. UPDATE: v0.5.3 is LIVE OP mirror links updated. Smallish update. Just trying to knock the rust off. I released a mission along with this as well on the Workshop. Changelog:
  18. Heyo......so.........yea I'm not dead as much of you probably wished I were since I left mid grind. Found some time since it's the end of the semester and I actually had a day or two off from work. I know this isn't the update you all would prefer for this mod, but I did just release the gear pack on the Workshop. Thanks again to Mr. Skellington and Ltf for their contributions as this would not have been possible. The rundown: https://steamcommunity.com/sharedfiles/filedetails/?id=1738216191
  19. Nope, life caught up to me once again...I'm now fully into a semester and a job on top of that, so I'll be a bit indisposed for a while. Hopefully I'll get some time here, but I can't say for certain.
  20. I've had the same issue before. A work around could be adding multiple actions, where each one covers a "stage" of building or repair. So Stage 1 through whatever.
  21. ACE website's advanced example looks promising to give you some insight on "child" actions: https://ace3mod.com/wiki/framework/interactionMenu-framework.html#25-advanced-example
  22. count (allPlayers select {alive _x && _x inArea thisTrigger}) isEqualTo count allPlayers Could be another way.
  23. Hello Arma 3 Community, I bring to you the, A3 Cruise Control Script Original Author and point of inspiration Vehicle Cruise Control Mod By Allen Kaganovsky http://kaganovsky.ca See it here: http://opendayz.net/threads/vehicle-cruise-control-server-side-script.18583/ Current Modification Author: J.Shock Note and thanks to DreadedEnitity for debugging. Modifications: Move from a modded platform to a script/function version. Allowed cruise control at speed when cruise control was set (not predefined). Short Description: Via scroll-menu action the driver of any car (cars, hunters, etc.), sadly not tanks or boats or air vehicles, can set a speed at which to travel in his vehicle, and still have full turning capabilities! Use and Limitations: -Simply get in a vehicle as the driver, speed up to desired speed, scroll-wheel, click "Cruise Control", and there you have it! -By pressing the "S" key (standard Arma 3 vehicle brake key), like in any real world vehicle will stop the cruise control so you can then drive like normal. -The script won't allow the player to set the cruise control unless he is above 30 km/h. Download: In your mission folder and files: Place the "SHK_cruise" folder in the main body of your mission folder. In your init.sqf: [] call SHK_fnc_cruiseSpawn; In your description.ext: class CfgFunctions { #include "SHK_cruise\cfgfunctions.hpp" }; And that's it! Hope the community can enjoy and appreciate this script :D. Changelog: v1.0.1 >>Moved speed condition from while loop to addAction condition. v1.0 >>First Release
  24. https://community.bistudio.com/wiki/Arma_3_Actions (driver myHeli) action ["CollisionLightsOff",myHeli];
  25. pubilcVariableServer sends defined information (lets call it a packet) from a client (you, for example) to the server. This packet is normally picked up by a public variable event handler for proccesing. This would be used if a client has data that the server needs to process, for example, the set of addons the client is running could be sent via publicVariableServer and filtered through a defined addon whitelist/blacklist on the server. This command should also only be ran on a client publicVariableClient sends a packet to a specified client. Same thing applies here for the event handler, whichever client it is intended for will be the proccessing entity in this case. This command should be executed on the server, to then send a packet to the defined client or set of clients. An example could be if the server wants to send a welcome message to a client that hasn't connected before. The message itself would be sent via publicVariableClient and picked up by that client and sent through the event handler to show a hint or similar with the message. That's the quick and dirty of those two commands. EDIT: The event handler isn't always necessary. A direct publicVariableServer "myVariable" will also suffice to share the value and reference of that variable for use by the server from a client. As GOM is pointing out.
×