Jump to content

Search the Community

Showing results for tags 'eventhandler'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


    • Vigor
    • DAYZ
    • ARMA 3
    • ARMA 2
    • YLANDS
    • ARGO
  • Die Hard OFP Lovers' Club's Topics
  • ArmA Toolmakers's Releases
  • ArmA Toolmakers's General
  • Japan in Arma's Topics
  • Arma 3 Photography Club's Discussions
  • The Order Of the Wolfs- Unit's Topics
  • 4th Infantry Brigade's Recruitment
  • 11th Marine Expeditionary Unit OFFICIAL | 11th MEU(SOC)'s 11th MEU(SOC) Recruitment Status - OPEN
  • Legion latina semper fi's New Server Legion latina next wick
  • Legion latina semper fi's https://www.facebook.com/groups/legionlatinasemperfidelis/
  • Legion latina semper fi's Server VPN LEGION LATINA SEMPER FI
  • Team Nederland's Welkom bij ons club
  • Team Nederland's Facebook
  • [H.S.O.] Hellenic Special Operations's Infos
  • BI Forum Ravage Club's Forum Topics

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL


Jabber (xmpp)








Steam url id







PlayStation PSN














Found 34 results

  1. I've been hitting my head against a wall for a few days trying to sort this issue. I have a script (see below) that I wrote for a firing range. It works perfectly in SP and on locally hosted servers. I am having issues with it on the dedicated server. I dug through the (recent) topic below and have attempted tweaks off of that to no avail. https://forums.bohemia.net/forums/topic/221167-addmpeventhandler-not-working-on-dedicated-server/?_fromLogin=1 I feel like my issue is lying somewhere in the eventHandler not updating the score variables for some reason. I am not sure why it would be working on a local host and not dedicated. Below is the first snippet of the script down to where I added the first check to see if the EHs were working. Any help offered would be greatly appreciated. My head hurts and I'm afraid I'll dent my wall if I keep hitting it. PS. I am using the targetHumanSimple because it does not fall when it gets shot. I did this so the shooter has to observe the bullet strike and does not have a visual aide. I don't think this would make any difference but full disclosure is full disclosure.
  2. Hi, I'm still looking for the best way to manage some revive heal in SP and MP session. SP works fine but I can't find a reliable solution for MP, with the EH handleDamage. Restarting from the basement, I'd like to share this test I can't explain the result: I placed 2 playable groups in editor. and 1 trigger (true) to run this code: {_x addEventHandler ["handleDamage", { params ["_unit","","_dam"]; hint str (getAllHitPointsDamage _unit); _dam min 0.86 }]; } forEach allunits; This code is running on each hosted/clients. The EH is supposed to limit all the hits at 0.86 max. This way the unit is wounded but never die (OK in SP or units on hosted server). PS: I know, I can write the hint inside of a loop rather than inside of the EH, but that doesn't change anything for the following issue: If I JIP on the 2nd group leader, so the group will be remote to the client's PC. The group owner changes. Normal. Then if I continue to fire against these remote units, the EH still fires (I can see the new value for getAllHitPointsDamage), so the hint is "ok" then the EH code runs but the remote units die! - I can shoot the units of my group: they never die, - all remote units are dying... Everything goes as the EH fires locally (normal: E.L.) but this localization is not updated to the new localization of the unit! This EH is hard to manage, even for so small behavior as modifying a value for hit damage. I miss something, probably. Any help appreciated. Thanks.
  3. Hey guys, I would like to add for my players the ability to use an action which would only appear to them if they met a specific criteria. The criteria is to have a specific backpack and inside it, a specific item. I got the script responsible for the condition working, but only once I put it in the init.sqf. If I did it that way, the action would appear and remain available even after the condition was no longer fulfilled (the object being dropped for example). Naturally, I'd like to remove the action if the condition was no longer met. I basically do not know how to check for the condition so that it always pops up for the player once he meets that criteria. This is the script that I don't know how to call: if ((unitBackpack Player isKindof "tfw_ilbe_a_gr") && ("tfw_rf3080Item" in (items player + assignedItems player))) then {Player addAction ["Test Action", "test_action.sqf"];} Thanks!
  4. Last content update: 6/13/2018 showing how to use the radius for addAction, using params instead of select, adding to arrays with various commands, altering arrays with various commands, get/setUnitLoadout Last content update: 6/10/2018 going through config files and getting details to sort what you want, using radius with addAction, params, and altering arrays with resize, pushBack, pushBackUnique, set, and append and going over to assist with resize count. Last content update: 5/27/2018 added GUI tutorial for how to make a weapon selector using cfgWeapon Last content update: 5/24/2018 added sector control tutorial Last content update: 5/21/2018 This is my arma 3 scripting tutorial series which is aimed to help both people getting into making their own scripts with fairly detailed simple tutorials as well as for the intermediate person looking to create their own features for their missions. The plans for this series is to almost fully cover everything behind the arma 3 missions that people play on a daily basis and have enough content provided in the videos where people can go off and make their own vision for their mission with the knowledge gained. Most of these videos are made on the fly at 1AM-4AM without any pretesting which should give someone the idea of what goes into finding syntax errors and narrowing down a bug that's causing your feature to not function properly. It is also an excuse for you to cut me some slack if you see mistakes :) . A lot of these tutorials are made with multiplayer in mind since I think most people want to play their missions online with their friends(which is why publicVariable has been utilized so much so new people can get a good grasp on the power those commands have). New videos are added to the playlist almost every day so if your stuck with something, maybe it has been covered in a video. If you have any requests on what you would like to see made then please suggest it here. topics covered so far Scripting tutorial playlist Database tutorials with INIDBI2 playlist GUI/Dialog tutorials playlist
  5. Hey! If I want to add eventHandlers to: EDIT: class CfgVehicles { class Man; class CAManBase: Man { class EventHandlers { addEventHandler ["GetInMan", {[player] call Salmon_fnc_function}]; addEventHandler ["GetOutMan", {[player] call Salmon_fnc_function}] }; }; }; How would I go about doing that? I want to call a function every time a player with the mod loaded gets in or out of a vehicle.
  6. Hi, I need help to get this running. I want to call some code on opening the parachute. I didn't found anything matching in the list: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers. I even tried the GetIn-Handlers because the parachute seems to be handled as a vehicle. Any ideas? Thx in advance ;)
  7. Hello Armaholics! I must admit I'm very bad when it comes to scripting. Is there a easy way to have a trigger activate when you have closed a leaflet after you've read it. Couldn't find anything on leaflets on the wiki regarding event handlers. I'm using this for the leaflets: ["init", [this, "image.jpg", "Text message"]] call BIS_fnc_initLeaflet It will be used in a upcoming horror mission this halloween. Thanks in advance! :) Some of my missions: [CO-04] Last Stand - Bunker [CO-04] Last Stand - Compound [CO-04] Last Stand - Town [CO-04] Terrorist Hunt - Village [CO-04] Terrorist Hunt - Factory
  8. What is the best way to create and eventhandler for currentThrowable items? I want an event handler to track every time I throw a throwable, so when my player's inventory of "HandGrenade"or "SmokeShellGreen" is depleted I can refill it. I have tried to use an "explosion" EH with the following but does not work as _throwableArray is an array of strings, and I can't figure out how to create an array of throwables on the player...Also I don't think this would work for a "SmokeShell" _throwableArray = []; { if (_x == _throwable) then {_throwableArray pushBack _x} } forEach (magazines player); { _x addEventHandler ["Explosion", { params ["_vehicle", "_damage"]; if (damage _vehicle > 0.1) then { if !( _throwable in (magazines player) ) then {for "_i" from 1 to 3 do {player addItemToVest _throwable};}; }; }]; } forEach _throwableArray; I have tried to use "AnimDone" EH, but could not even find the common animation for throwing... player addEventHandler ["AnimDone", { params ["_unit", "_anim"]; if (_anim == "AmovPercMrunSlowWpstDf_AmovPercMstpSrasWpstDnon_gthThrow") then { if !( _throwable in (magazines player) ) then {for "_i" from 1 to 3 do {player addItemToVest _throwable};}; }; }];
  9. What is the best way to create and eventhandler for currentThrowable items? I want an event handler to track every time I throw a throwable, so when my player's inventory of "HandGrenade"or "SmokeShellGreen" is depleted I can refill it. I have tried to use an "explosion" EH with the following but does not work as _throwableArray is an array of strings, and I can't figure out how to create an array of throwables on the player...Also I don't think this would work for a "SmokeShell" _throwableArray = []; { if (_x == _throwable) then {_throwableArray pushBack _x} } forEach (magazines player); { _x addEventHandler ["Explosion", { params ["_vehicle", "_damage"]; if (damage _vehicle > 0.1) then { if !( _throwable in (magazines player) ) then {for "_i" from 1 to 3 do {player addItemToVest _throwable};}; }; }]; } forEach _throwableArray; I have tried to use "AnimDone" EH, but could not even find the common animation for throwing... player addEventHandler ["AnimDone", { params ["_unit", "_anim"]; if (_anim == "AmovPercMrunSlowWpstDf_AmovPercMstpSrasWpstDnon_gthThrow") then { if !( _throwable in (magazines player) ) then {for "_i" from 1 to 3 do {player addItemToVest _throwable};}; }; }];
  10. Hello, I've been playing with Put and Take event handlers to try and achieve functionality that's stated in the topic. For starters Put EH seems to only fire when you drop your weapon on the ground (groundWeaponHolder) or put the weapon into a container (box, vehicle) directly from your inventory. It doesn't fire when switching to a weapon that is on the ground even though (at least how I see it) you are still dropping your current weapon into a "groundWeaponHolder". Does anyone have an idea why this EH doesn't fire in that case? I used this shortie to test Put EH: player addEventHandler ["Put", {_unit = _this select 0; _content = _this select 1; _weapon = _this select 2; hint "This EH seems to be working";}]; Take EH on the other hand seems to work just fine for detecting the weapon pick up operation. But other than testing with simple hint that the EH fires when needed I haven't been able to come up with anything I'm looking to achieve. Now the ultimate question is: by using either of the aforementioned EHs how to delete the weapon that gets put on the ground during weapon switching operation?
  11. Hi folks, the following three lines in the middle are part of a function and the function is set to {preInit = 1}. //begin true spawn { waitUntil{!isNull player}; .... systemChat "I am here"; // is shown on the map at briefing screen. player addEventHandler [ "Respawn", {systemChat "respawn"}]; // this code is completly ignored, no EH is added, no text shown on respawn??? player addEventHandler [ "Killed", {systemChat "killed"}]; // is shown when player dies. ... }; //end if i put the second line in debug console and press local, it works fine after respawn!! My first question is, where is the difference between "respawn" and "killed" EH? (except the known funktionality from the wiki) My second question is, is there a proper way to find out, if an EH was added and is not firing, or if it just was not added? thanks a lot
  12. Hi all! I know that kind of event handler does not exist, but since the "AUTOCOMBAT" AI feature exists, it is definetly something BIS should implement to avoid disabling it and looping around unit current behaviour and switch it "manually". I want to take advantage of some UPSMon feature which orders AI to set in STEALTH, and, in that case, add them a supressor and make them use it. Is there any Smart way to do this avoiding loops? Thanks in advance!
  13. addMissionEventHandler ["EntityKilled", { params ["_dead"]; if (_dead in switchableUnits) then { addSwitchableUnit (units _dead param [1, objNull]); }; }]; This makes it so that when a playable entity is killed, their second in command becomes playable. Well if you test it, if you kill the first 2 guys really quickly, it doesn't work... or well the code works, but i don't know how to articulate what i want it to do. I know its because its selecting the 2nd item in an array, and it takes time for the array to readjust, but i don't know a compact and effective way for it to fix it self in case the first 2 units in the array are killed.
  14. Hello. When I try to add an event handler to a newly spawned vehicle, the event handler is NOT working. [_helicopter] remoteExec ["jey_helicopter_restriction",0,true]; jey_helicopter_restriction = { _vehicle = _this select 0; _vehicle addEventHandler ["GetIn",{_this call checkpilot}]; _vehicle addEventHandler ["Engine",{_this call checkengine}]; }; But if I add an event handler to an already spawned vehicle (that has been there from the mission start) it works : chopp3 addEventHandler ["GetIn",{_this call checkpilot}]; chopp3 addEventHandler ["Engine",{_this call checkengine}]; Any ideas?
  15. Hello, I'm having an issue getting this event handler to fire on dedicated server. Everything works perfect in player hosted server. I've tried to use the event handler with "remoteexec" but cannot seem to get that to work on player hosted or dedicated servers. I do believe "remoteexec" is the answer but I somehow have it setup wrong. Here are the codes ran from initserver.sqf This one works exactly as I want it to on player hosted server but does nothing on a dedicated server. while {true} do {sleep 5; {_x removeallEventHandlers "Handleheal"} forEach allUnits;{_x addEventHandler ["Handleheal", {_this select 1 addScore 1; _this select 0 disableai "move"; fire_enableaimoveforheal_trigger_1 = true}]} forEach allUnits }; This one above works exactly as I want it to on player hosted server but does nothing on a dedicated server. while {true} do {[{_x ["Handleheal", {_this select 1 addScore 1; _this select 0 disableai "move"; fire_enableaimoveforheal_trigger_1 = true}foreach allunits]] remoteExec ["addEventHandler", 0, true] }; This one above was my progress to get the Event Handler to work on dedicated server using "remoteexec". I cannot get this one to even do anything on player hosted server so I'm pretty sure I have some type of error in there but I'm getting no error code. Anyone that attempts to help is very much appreciated :-)
  16. I have a music loop eventhandler set up in a trigger. It works fine the code is: 1 fademusic 1; ehID = addMusicEventHandler ["MusicStop", {playMusic ["Track2", 2];}];playMusic ["Track2", 2]; And upon Deactivation it fades the music to 0. Works good. However. I have various other triggers on objective zones which fade back in the music using different tracks. Those work fine too but after they finish playing the music is still at fade 1 and it resumes the eventhandler for the loop. So basically I want this loop to only function inside of this trigger. How do I terminate this loop upon deactivation and will it reactivate on a repeatable trigger as it should after deactivation? Any help is greatly appreciated. For anyone wondering its for a type of safe house like Resident Evil style where you enter it and your cozy warm piano loop plays and reassures you that everything is going to be alright. ;) So it needs to be repeatable in and out type of deal. Thanks.
  17. Hi. How can I find the handler ID to use with ctrlRemoveEventHandler ? https://community.bistudio.com/wiki/ctrlRemoveEventHandler
  18. Hi I need some help with the precise syntax of an Eventhandler but I don't know programming and need help with the precise syntax. I want to insert in the init of a helicopter than when it switches its engine off, it kicks out of the vehicle all players in cargo. According to Arma wiki https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Engine the init shoul be something like this. This addeventhandler "engine" [this, false] { moveOut this } forEach crew this; But I can't make it work. Any idea of what I am doing wrong?
  19. Hi, For those who don't know, Arma has a framework to check for an event on each frame of the game (similar to the sleep/sleepUI commands but unscheduled, so higher priority). Currently, there's no easy way to make it consider objects (or indeed any other data) that does not have a global name. This basic framework can let you add events easily based on time (it uses diag_tickTime fyi). Also, you can pass custom functions to it not based on time and write out the outcomes yourself (bit more advanced). If you specify a timeout parameter (in seconds), it will only execute your code once the timeout is up. Without a timeout specified, it will execute your code on each frame. FORMAT This is the format for using it: _thisEventHandler = [arguments,code,timeout (optional)] call horde_fnc_addMissionEventHandler; The rules are that the arguments you pass to it must be in an array. So these are ok: [[player],myFunction,10] call horde_fnc_addMissionEventHandler; [["string"],myFunction,10] call horde_fnc_addMissionEventHandler; [[player,"string"],myFunction,10] call horde_fnc_addMissionEventHandler; Using a single argument is NOT ok: [player,myFunction,10] call horde_fnc_addMissionEventHandler; // bad ["string",myFunction,10] call horde_fnc_addMissionEventHandler; // bad There's no error checking currently* so as long as you stick to the format, then you're ok. EXAMPLES ein) _fnc = { player sideChat format ["%1",_this select 0] }; [["hello"],_fnc,2] call horde_fnc_addMissionEventHandler; [["poopy"],_fnc,3] call horde_fnc_addMissionEventHandler; [["fluffy paws"],_fnc,4] call horde_fnc_addMissionEventHandler; Prints "hello" on screen after 2 seconds, then "poopy" a second later, then "fluffy paws" a second after that. drei) _fnc = { missionNamespace getVariable ("horde_gv_eachFrameArgs_" + (_thisEventHandler toFixed 0)) params ["_unit","_moving","_notMoving"]; if (vectorMagnitude velocity vehicle _unit > 1) then { systemChat format ["%1 is %2",_unit,_moving] } else { systemChat format ["%1 %2",_unit,_notMoving] } }; TAG_movingIndicatorID = [[player,"moving","not moving"],_fnc] call horde_fnc_addMissionEventHandler; Infinite loop informing player if he/she is moving or not by systemChat. Note that we no not define the timeout (3rd parameter in the arguments). You can stop it in this example by using the return (TAG_movingIndicatorID) TAG_movingIndicatorID call horde_fnc_removeMissionEventHandler; // stops the sideChat zwei) _fnc = { missionNamespace getVariable ("horde_gv_eachFrameArgs_" + (_thisEventHandler toFixed 0)) params ["_unit","_moving"]; if (vectorMagnitude velocity vehicle _unit > 1) then { systemChat format ["%1 is %2 - deleting EventHandler",_unit,_moving]; _thisEventHandler call horde_fnc_removeMissionEventHandler } }; [[player,"moving"],_fnc] call horde_fnc_addMissionEventHandler; This is a function that is not dependent on time so the 3rd parameter of the arguments does not need to be defined. If the unit passed to it moves, then it prints a message and then quits. Note that the deletion is specified in the function. CBA I just wanted to mention cba as they have a great system for this sort of thing, but if you want to use it, then you have to be comfortable with mod dependencies. This is a poor man's system that lets you manage an unscheduled event system without mods. ALWAYS DO BETTER If you can write something faster/better than this then please comment and post your code in here so we can all benefit. My code's not great but works ok I think. I'm sure there's better ways of doing it but I can't think of them right now. FUNCTIONS horde_fnc_addMissionEventHandler = { params ["_args","_code","_timeout"]; private _thisEventHandler = -1; if (isNil "_timeout") then { _thisEventHandler = addMissionEventHandler [ 'EachFrame', _code ]; } else { _thisEventHandler = addMissionEventHandler [ 'EachFrame', horde_fnc_missionEventHandlerTimeout ]; _args pushBack [_code,diag_tickTime + _timeout] }; missionNamespace setVariable ["horde_gv_eachFrameArgs_" + (_thisEventHandler toFixed 0),_args]; _thisEventHandler }; horde_fnc_missionEventHandlerTimeout = { private _args = missionNamespace getVariable ("horde_gv_eachFrameArgs_" + (_thisEventHandler toFixed 0)); _args select (count _args - 1) params ["_code","_timeout"]; if (diag_tickTime > _timeout) then { _args deleteAt (count _args - 1); _args call _code; removeMissionEventHandler ["EachFrame",_thisEventHandler]; missionNamespace setVariable ["horde_gv_eachFrameArgs_" + (_thisEventHandler toFixed 0),nil]; }; true }; horde_fnc_removeMissionEventHandler = { removeMissionEventHandler ["EachFrame",_this]; missionNamespace setVariable ["horde_gv_eachFrameArgs_" + (_this toFixed 0),nil]; true }; Ta * = I could put this in if required but it will slow the execution down a bit
  20. Hi guys, im trying to simulate a miles (Multiple Integrated Laser Engagement System) exercise but im having some troubles, i'm using a eventhandler "HIT" to execute the effects, like this: { if ((side _x) == Independent) then { _x addEventHandler ["HIT",{ _this select 0 setCaptive true; _this select 0 setdamage 0; _this select 0 disableai "Anim"; _this select 0 disableAI "Move"; _this select 0 disableAI "AutoTarget"; _this select 0 switchMove "AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon"; }]; }; } forEach allUnits; well, if i shoot a independent unit to a leg, to a arm or even in the kevlar vest at distance, work well, the unit will stop, put his hands behind the head and the blufor IA´s stop shooting them, but, if i shoot to the units at the head, well, they simply dies, the same if i shoot to the chest in close combat... if i put the units in allowdamage false, the eventhandler "HIT" dont work... somebody knows how can i solve this? thank for all and sorry about my poor english :(
  21. There is weapon and magazines for weapon in container. player addEventHandler [ "Take", { params ["_unit", "_container", "_item"]; diag_log format ["_item: %1", _item]; } ]; When I take weapon, it shows up in log (_item variable). Problem: With weapon I receive also magazines for this weapon. Question: How to prevent to pick up these additional magazines? Idea: I want to have control of what I can take from container. I want only take weapon without magazines.
  22. When I open container, I am adding items to container. _object addEventHandler [ "ContainerOpened", { params ["_container", "_player"]; { _container addItemCargoGlobal [_x, 1]; } forEach ["FirstAidKit", "MineDetector", "ItemMap"]; } ]; Problem: I don't see items in inventory. I need to do some action (selection in dialog) to see those items inserted items. Question: How to "AUTO-REFRESH" dialog so I can see items in inventory list? Possible solutions: - refresh dialog - waitUntil { code }; showDialog; - other GUI Wizard @moricky do you have some ideas ?
  23. Welcome, To keep this short : _hit = 0 I want this variable to increase everytime the object _Str been hit. _Str addEventHandler ["HitPart",{_hit = _hit + 1}]; This doesn't work because the EH doesn't know the localvariable. _Str addEventHandler ["HitPart",{hit = hit + 1}]; This does work because it is a globalvariable. But i need it to be a localvariable, because there are 200 objects that are being spawned using the same variable. waitUntil {_Hit > 3}; deletevehicle _Str; I want the obj to delete itself after being hit 3 times. Is there workaround that i can use? Or maby a different way to approach this? Draoth
  24. Hi, I am using a function for conversations. It's defined in CfgFunctions and called via spawn command. Now I want to archive that conversation stops if the unit (conversation partner) gets killed. The units with the conversation action are civilians, spawned dynamically via Engima's Civilians script. I could do that with: // inside attached action to all civilian units: /* ...some code... */ handle = [params] spawn createConversation; // And this in unit's eventhandler: if (not isNil {handle} and {not scriptDone handle}) then { terminate handle}; The problem is, when I want to start another conversation now with a different unit, the conversation (or better saying: the createConversation function) doesn't execute anymore. How can I make sure that the function gets executed again? As I understand, the terminate command fires when the spawned script is processed the next time by the scheduler. In my case it immediately stops the conversation when the civilian gets killed, but it seems to also terminating the next started conversation, and so on. I also tried it without the "killed" eventhandler, and instead in units callback (like init field) did this: // No conversations with dead civs waitUntil { // exit when unit gets deleted if (isNull _unit) exitWith {true}; !alive _unit; }; sleep 1; _unit removeAction talk; if (not isNil {handle} and {not scriptDone handle}) then { terminate handle}; I couldn't find anything helpful... could someone help me, please? Thx in advance
  25. hi guys, im trying to attach an Eventhandler to a plane, so when it is destroyed, all usermade actions get removed. The script is run by an action. Here is the script: am i missing something?