Jump to content


  • Content Count

  • Joined

  • Last visited

  • Medals

  • Medals

Everything posted by xxanimusxx

  1. Chat-Events Library Summary Calling this a library may sound a bit excessive but it's as close as a definition I could think of. Using the Chat-Events Library you can define Events which are triggered everytime the player writes something specific into the game-chat. The usage resembles that of addEventHandler to ease and shorten the time to familiarize with the commands used in these scripts. This release was tested on my own copy of ArmA2OA (vanilla) and could harbor many bugs to correct - if you encounter any, feel free to rant about them! Downloads [latest] v0.81 Installation Extract the archive into your missions-folder and call the initialization in your init.sqf accordingly: // somewhere in your init.sqf if (!isDedicated) then { execVM "chatEvents\init.sqf"; waitUntil {!isNil "aniChatEvents_initated"}; }; Preface: These scripts are (hopefully sufficiently) commented and mostly provided with examples to offer a deeper insight of expected parameters and other stuff to consider. It is highly recommended to look into those files before posting any bug report to ensure a well defined usage of the provided scripts. Please also consider starting your missions with the -showScriptErrors startup parameter to get error messages ingame. This will save you some valuable time figuring out what your problem is in case of occuring errors. Functionality: This "library" consists of 3 main-functions and another 3 helper-functions. aniChatEvents_addEventHandler: adds an event-handler aniChatEvents_removeEventHandler: removes an event-handler aniChatEvents_removeAllEventHandlers: removes all event-handlers aniChatEvents_strstr: searches for a string in another string aniChatEvents_strlen: returns the string-length aniChatEvents_substr: returns a sub-string The four steps to success Define a global function which is bound to be spawned everytime a chat-event is triggered. Name it however you want, you could also use a public variable as the handler, but we'll indulge in that later. Add a new chat-eventhandler by supplying above meantioned function (by its name as a string) and the trigger-string. Everytime the player sends a message through the ingame-chat, the ChatEvents-Library will loop through all registered event-handlers and check their respective trigger-string (or also called "needle"). If the trigger-string is contained in the sent message, your registered function will be spawned and delivered an array with information about the message itself. ... Profit. Code examples For all these following codes, we will assume a scenario where we want to spawn a vehicle using the direct-channel of our chat (please disregard the logic behind this use case...). Furthermore we will use the whole message to extract which type of vehicle to spawn. The message we will use as reference is: /spawn MV22 So we're gonna define a function handling this for us and want to test out several configurations of adding the event-handler. And before these questions pop up: Where you put this following code is irrelavant - as long as you do it before you add the event-handler into the queue. Event-Handler spawnVehicleHandler = { _unit = _this select 0; _msg = _this select 1; _channel= _this select 2; _index = _this select 3; // disregard messages not sent in direct channel if (_channel == "direct") then { // Get the classname out of the message _className = ""; if ((_msg call aniChatEvents_strlen) > 7 /* 7 = Length of needle '/spawn' + Whitespace */) then { _className = [_msg, 7] call aniChatEvents_substr; // Is this a valid classname? if (configName(configFile >> "cfgVehicles" >> _className) != "") then { _spawnPos = _unit modelToWorld [0, 10, 0]; _spawnPos set [2, 0]; createVehicle [_className, _spawnPos, [], 0, "NONE"]; hintsilent format["%1 spawned", getText(configFile>>"cfgVehicles">>_className>>"displayname")]; } else { hintsilent "Invalid classname"; }; }; }; }; This code practically extracts the substring after "/spawn " and uses it to spawn the given vehicle. Adding the Event-Handler spawnHandlerID = [["/spawn", true, true, true], "spawnVehicleHandler"] call aniChatEvents_addEventHandler; The less code lines we have the more questions are arising. In this line we're telling that we want to register a global function named "spawnVehicleHandler" which is then spawned everytime the string "/spawn" is found in the sent chat-message. The three true's are "modifiers" and tell the search-engine to only match "/spawn" if it's the first word, not in another word and case-sensitive (but more on the syntax later). Removing the Event-Handler If you don't need the event-handler anymore (e.g. after activating a trigger once) you can also remove the event-handler out of the queue using the ID which was returned using the above command. spawnHandlerID call aniChatEvents_removeEventHandler; Syntax, parameters and return values Understanding the syntax of the three main functions is mandatory to get a well functioning and moreover efficient string-matching, as this can cansume a lot of script-execution-time if not used correctly. I will therefore insert the comment-section which I already wrote in the header of every individual file contained in this release to save me some time over typing it all again. aniChatEvents_addEventHandler aniChatEvents_removeEventHandler aniChatEvents_removeAllEventHandlers aniChatEvents_substr aniChatEvents_strlen aniChatEvents_strstr Useful informations These details are for the advanced scripters under us - if you're still dizzy from the above code examples, you can safely disregard this section :) The first revision of this library had you supply the reference to the global function in aniChatEvent_addEventHandler rather the name of the function as a string. I made this step in thought of more dynamic functions - you can at any time in your mission just redefine the global function you registered and your function will be spawned as if nothing happened - in fact there is no need to keep track of it as long as the variable which you registered using its name points to a function. Another probable use of this is using public variables - you could use publicVariable to broadcast a new function to every client as long as you use the same variable name which you registered before. The Chat-Events Library won't and can't replace complex routines and guis to execute in-place code - don't try to use the chat-box as a debugging-console or something of that sort as we did with our example above. This use case involves a custom made GUI and some scripting to back it up.
  2. AniRadar is a highly customizable radar for ArmA2 and was developed as a part of a mission I'm working on. Summary: This radar will let you decide what to show and allows you to change almost everything to meet your needs. Enhance your gaming experience and allow others to enjoy your missions using this feature, creating countless new mission objectives and adding new tactical possibilities. Due to technical problems I was forced to change the known rotating radar to a sonar type one, which is, honestly, not really realistic but meh, who gives a sh**t anyway ^^ Demo: When a picture is worth a thousand words, moving pictures are pure gold, so here's a demo mission with the AniRadar implemented: All the dialogs are part of the demo mission and are not element to the AniRadar. Downloads PSD-File (Photoshop Cs6): radarRsc.psd PSD-File (maximized compatibility): radarRsc_compatible.psd Demo-Mission: AniRadar.utes (v0.9.0) AniRadar.utes (v0.9.2) [*]AniRadar releases: AniRadar v0.9.0 initial release [*] AniRadar v0.9.2 new command added: aniRadarSetReferenceObject initialization of modules rewritten if the reference object is in the callback's results, it will be omitted [*] Armaholic.com Frontpaged (big thanks to Foxhound): Installation: UnRaR the archive into your mission folders root and initialize AniRadar. Just insert this line into your init.sqf to do so: execVM "AniRadar\scripts\aniradar_init.sqf"; waituntil {!isNil "aniRadarInitialized"}; // you can delete this line, but be sure to wait for an adequate time before calling aniRadar-functions. You have to edit your description.ext-file. If you don't have one in your mission folder, create a new one. Insert this line into the top: #include "AniRadar\gui\aniRadar.hpp" Insert the functions module into your mission (the radar is using BIS_fnc-commands). Preface: All of the scripts which are used to modify radar behaviour are located in the AniRadar\scripts - folder. These scripts are (hopefully sufficiently) commented and mostly provided with examples to offer a deeper insight of expected parameters and other stuff to consider. It is highly recommended to look into those files before posting any bug report to ensure a well defined usage of the provided scripts. Please also consider starting your missions with the -showScriptErrors startup parameter to get error messages ingame. This will save you some valuable time figuring out what your problem is in case of occuring errors. Using AniRadar: AniRadar is composed of two parts: the visual part (the radar itself) and the data part. Visual part: Data part: New in v0.9.2: Moving and Resizing: The visual part of the radar was made under the assumption of a 16:9 aspect ratio. Upon calling aniRadarShow the first time in your mission, the radar will be placed in the NORTH_WEST corner of your screen and the default size beeing 512x512pixel. This specification can be misleading, because there are no pixels in GUI scripting, just relative values ranging from 0.0 to 1.0 (and considering safe-zones even negative values). But normally you don't have to worry about all of this as long as you have the aspect ration written above (I'm fairly new to GUI scripting so I don't know of any method to be able to provide multi aspect-ratio solutions). Customizing: You're fed up with the used images or just want to do your own thing? That's no problem, you're free to customize everything to fit your needs. I want to change the background images for the radar! How can I use my own icons to show in the radar? I want another ping sound, how do I manage that? The minimized radar is too small/big, I want to change the default minimize scale! I want to change something, but it isn't covered in this section! Well, just explain your idea in this thread and I'll try to come up with a way to customize it asap. After word: I'm not experienced in GUI scripting, thus having problems here and there. I managed to create this with the little information I had and I'm sure there are several ways I could've made it better. If you find any bugs, ideas, suggestions or just want to rant about me being a noob - you're free to post your opinion. I'm eager to read suggestion to improve my scripts, even if it's just minor stuff, so if you took your time to browse through the scripts (I know that just a small number of you ppl will do this..) you can leave your ideas anytime in this thread. This is the first version which got publicly released so I bet it will have numerous bugs and other errors which are hard to find. If you hower contribute in improving this release by posting bug reports, please don't forget to meantion your used screen dimension (in game) and the exact error message you got. It would help alot if you could try to recreate the bug in order to discern specific patterns. Thank you for trying out AniRadar and have a great time using it for your missions. Known Bugs: Although cutRsc is used to create the radar, it doesn't dissapear when the map is opened. When the radar is moved or resized repeatedly without waiting for the effects, after-images will be displayed until the next pulse.
  3. And how in gods name should we ascertain the right one for you, if you don't even see it necessary to write a sentence or two about your actual problem? We aren't clairvoyants and can't help you if you're too lazy to state your actual problems and what you already did to overcome them...
  4. That's the final answer - you can't emulate a human person loggin in unless you actually do it. You could, however, setup a client from your end to do it, I mean if you setup your server as a dedicated one, whenever you connect you should be able to trigger those functions. If you know what parameters those functions expect, you can call them manually, like you can do with any other function.
  5. Nah, not really, to get the last element out of an array, you have to select using the count of the array minus one - what you actually did :D The only way to "fasten up" things would be storing (_paths select _i) into another local variable, so you don't have to "select" it several times (an existing reference to an array-element is faster than trying to get the array-element several times). From the coding angle, you should always prevent code redundancy as it will always bite you back when your code gets more complex. Everytime you see repeating code-lines , you should try to enclose them into a seperate function and for repeating blocks of code (like the meantioned above), store them into local variables. End of lesson.
  6. Even if _paths is a multi-dimensional array, you can't "select" an integer, what you actually do, twice. What you actually wanted is something like this: [color="#A52A2A"]([/color] [color="#0000FF"]([/color] [color="#008000"](_paths select ( INDEX_DIMENSION_1) )[/color] [color="#0000FF"]select ( INDEX_DIMENSION_2) )[/color] ... [color="#A52A2A"]select ( INDEX_DIMENSION_N ) )[/color] The first block returns an array, so you can use a subsequent select, to return another array in the second block. You can keep using selects as long as you've fetched an array in the select before.
  7. Well, first of all, you should declare your (local) variable outside of loops. This will (in most cases) solve scope problems and has a minor speed benefit. Furthermore, you should try to format your code, as it always will not only look better, but prevent errors, like the one you're having. If you have nested commands, you should try to wrap the commands/parameters into paranthesis - the problem, if there is any, will be visible that way. _pb = objNull; for "_i" from 0 to _n do { _pb = [color="#0000FF"]_paths select ([/color] [color="#008000"]_i select ([/color] [color="#FF0000"][b](count _paths)[/b][/color] [color="#DAA520"]select (_i - 1)[/color] [color="#008000"])[/color] [color="#0000FF"])[/color]; if ([getPos _pb,getPos _end] call BIS_fnc_areEqual) then { ... }; }; The red bit of code is (most likely) the culprit here: select is a command to get the n'th element out of an array. count is a command to get the number of elements in an array. So in the end, you're trying to get the (_i - 1)'th element from a number, which won't work obviously (integer != array). The same thing with the select before it. I think it will be more helpful if you could enlighten us in your intent, so we could figure out how the code would have to look like :)
  8. Well, after searching in the pbo's and extracting all scripts and looking into them, I couldn't really find the problem. Until... I noticed the blank in your string between the .sqf and the closing quotation sign, apparently there's no trimming when specifying script locations. So the following code works without problems: _newComp = [(getPos this), (getDir this), "FuelDump1_US"] execVM "ca\modules\dyno\data\scripts\objectMapper.sqf";
  9. xxanimusxx

    vehicle ammo check?

    There was a request like this some time ago, you could take the script and edit it to suit your needs. http://forums.bistudio.com/showthread.php?162620-How-can-I-add-more-magazines-to-the-door-gun-of-a-helicopter&p=2483091&viewfull=1#post2483091
  10. xxanimusxx

    addaction problem

    I wouldn't use player in the condition field, this could lead to unwanted results, use _target instead: count (nearestobjects [_target, ["Land_Money_F"], 5]) != 0 Another (and more easy way) would be assigning the action to the objects itself ("Land_Money_F") and using _target and _this to perform your script. That would be also the more effective way, because assigning an action to a player will check the condition on every frame, whereas assigning the action to a stationary object will check it only if there's a player in the vicinity.
  11. To concatinate strings with variables, you should opt to use format. _debug = format["http://dev.taskforce47.de/missingAddons.php?map=%1&mission=%2&player=%3&missing=%4,%5", _map, _mission, _player, (_missing select 0), (_missing select 1)];
  12. So, what's the question here?
  13. Oh wow, didn't know that the 3D-Editor would actually produce that crappy code markup.... it was a pain in the ass to decipher what was going on. So I beautified it a little and did test it with Radio-Trigger as well as putting it into the init.sqf and both yielded the same result: No duplicates, everything was normal and working as intended. // truck.sqf if (isServer) then { _vehicles = [ // Vehicle-className 3D-Coordinates direction Optional: Damage ["Ural_UN_EP1", [8618.9258, 2599.2754, -4.2915344e-006], 155.97241, ["wheel_1_1_steering",1]], ["Ural_UN_EP1", [8608.3711, 2615.105, -1.5258789e-005], -171.47652], ["Ural_UN_EP1", [8602.0576, 2628.5286, -5.9604645e-005], -175.51186], ["Ural_UN_EP1", [8596.2676, 2642.9153, -2.2888184e-005], -189.62248], ["UAZ_Unarmed_UN_EP1", [8593.1455, 2656.0056, 3.8146973e-006], 151.63525], ["UAZ_Unarmed_UN_EP1", [8587.5156, 2662.9124, 1.0490417e-005], 194.97041], ["LadaLM", [8634.1074, 2591.7109, 4.0054321e-005], -8.3406734] ]; // Create the vehicles _vehicleTemp = objNull; { _vehicleTemp = createVehicle [_x select 0, _x select 1, [], 0, "CAN_COLLIDE"]; _vehicleTemp setDir (_x select 2); _vehicleTemp setPos (_x select 1); // apply damages if present if (count _x > 3) then { _cnt = (count _x) - 1; for "_i" from 3 to _cnt do { _vehicleTemp setHit (_x select _i); }; }; } forEach _vehicles; _units = [ // Unit-Class 3D-Coordinates Direction Leader [ civilian, [ [ ["Policeman", [8646.4141, 2559.5491, 1.5735626e-005], 152.46233, true] ], [ ["Policeman", [8573.2393, 2697.1929, -2.6702881e-005], -50.373871, false] ] ] ], [ resistance, [ [ ["UN_CDF_Soldier_Officer_EP1", [8628.3105, 2565.7915, -5.7220459e-005], 141.05481, true], ["UN_CDF_Soldier_MG_EP1", [8628.5488, 2568.9143, 2.0027161e-005], 66.318787, false], ["UN_CDF_Soldier_AMG_EP1", [8627.6377, 2571.634, 3.9577484e-005], 0, false], ["UN_CDF_Soldier_EP1", [8624.8496, 2569.9492, 1.7642975e-005], -83.715508, false] ], [ ["UN_CDF_Soldier_Officer_EP1", [8595.0264, 2688.5332, -1.7642975e-005], 0, false], ["UN_CDF_Soldier_MG_EP1", [8599.4121, 2687.4063, -4.5776367e-005], 44.90382, true], ["UN_CDF_Soldier_AMG_EP1", [8593.7959, 2685.6555, -5.197525e-005], -156.03745, false], ["UN_CDF_Soldier_EP1", [8597.4424, 2683.595, -2.0980835e-005], 121.56821, false] ] ] ] ]; // Create the units _hq = objNull; _group = grpNull; _unit = objNull; { _hq = createCenter (_x select 0); _hq setFriend [east, 0]; { _group = createGroup _hq; { _unit = _group createUnit [_x select 0, _x select 1, [], 0, "CAN_COLLIDE"]; _unit setDir (_x select 2); _unit setPos (_x select 1); _unit setUnitAbility 0.60000002; if ((_x select 3)) then { _group selectLeader _unit; }; } forEach _x; } forEach (_x select 1); } forEach _units; };
  14. These errors stem from BIS-Functions which sometimes contain bugs or will produce errors in conjunction with user made scripts. The only way I got rid of these errors is to install the last "stable" beta update (afaik build 108074 is the culprit here, dunno if installing 112555 would help...)
  15. Well, "_pMission_array" is a local variable and exists only in the scope where it was defined. I assume the line "_pMissionId = _pMission_array select 0;" is being executed in another scope or script so the variable is undefined, hence the error. Please be adviced that your use of BIS_fnc_MP seems to be false, you're just supplying a parameter. I never used that function before so I cannot say that for sure, but the BIKI-page says otherwhise: https://community.bistudio.com/wiki/BIS_fnc_MP
  16. xxanimusxx

    Help with waitUntil

    waitUntil's and GUI controls are a bad mix in my opinion. What you want to do is assigning the yes-Button an EventHandler which performs the tasks you want to do when "yes" is clicked. You can either do it in your dialog's class ("onAction= ...") or using ctrlAddEventHandler.
  17. Well the chat relies on GUI controls so you have to make your own OR modify the ingame chat to fit your needs - both ways require some first-hand knowledge in GUI scripting, so you should consider reading the tutorials which float in this subforum first. I made a script some months ago which reads the text out of the chat inputfield, so you can propably build your script ontop of that.
  18. The given name via the editor is just the variable's name which references the object in the given namespace. So by all means that is not the "name" attached to an object, but the name your scripts can use to reference the object. If you want to "name" an object for later use, you have to manually do so, like using setVariable in the init-field of the object: this setVariable ["flagName", "NAME_ME_LIKE_ONE_OF_YOUR_FRENCH_FLAGS"]; so you can get that name later (using your analogy): _index = (uinamespace getvariable "doolb") lbadd (_x getVariable ["flagName", ""]);
  19. What? You dug up a thread which is more than half a year old of a trivial problem you had to give a half-correct answer? http://i.imgur.com/BV3QjE9.gif (1768 kB)
  20. You see? I had the exact same reaction after reading your text - no context or anything helpful to understand your problem whatsoever. Please don't be offended, but you have to help us in order to help yourself, and you won't do yourself any good with lacking information in your original post. How about you tell us what Addon you're using, what the intended use/goal is and what you already did to solve the problem.
  21. Ah that's probably due to the recent updates in the framework, had this problem a few days ago as well. You need to replace the callbacks in the main module with empty stubs, somehow the original author forgot to remove them so using the deprecated code is crashing the rest. After the replacment you have to make sure that the submodules are triggered correctly, so you might as well check the individual files to match the latest builds. Some people also pointed out that having too many objects handled through the dispatcher would cause a slight synchronisation problem, thus leading to weird behavior.
  22. So as far as I understand you, you want to make a mod for a mod, namely your own version of DayZ-Mod. That is no easy feat though, you have to manually change a ton of config values in the original dayz mod to get it working for your custom enviroment (item spawn locations, probabilities, zed spawn points etc.). You need to modify or completely rebuild the Database interface to match your map/vehicles. There is a reason why there are so few mods out there that excell, not everyone has the knowledge to build something complex, or has the people who do. If you really want to mod dayz, you should head over to DayZ related forums, you'll get more help there, trust me. DayZ made so many changes to the configs that you also won't get any support here, the peeps here hate everything which has to do with dayz :D
  23. Oh wow, I don't know where to begin... You seem to lack fundamental knowledge about the use of ArmA-Script and other affiliated paradigms, thus I won't try to explain you what went wrong there but urge you to pick up some good tutorials explaining the basics. For your problem here, just change the if-condition and it should work: // init.sqf if (!isDedicated) then { waitUntil {player == player}; execVM "antiusebug.sqf"; };
  24. // init.sqf if (isServer) then { // stuff you execute here is exclusively run on the server execVM "antiusebug.sqf"; };
  25. Did you already uncomment the event-handlers in the main-loop? Maybe the pre-placed load-triggers are jamming the main-loop's event queue so the changes you make won't broadcast to everyone. If that does not help you should propably check the event queue itself, sometimes an user-made addon scrambles its way into it and nothings works anymore, happened to me several times already, a pain in the ass to detect. Just give us your feedback after you checked everything I mentioned. (I know this could be considered off-topic and/or highly sarcastic, but please bear with me, it's for didactical reasons)