Jump to content

slothstronaut

Member
  • Content Count

    14
  • Joined

  • Last visited

  • Medals

Everything posted by slothstronaut

  1. Hey guys. I have an idea for a project, and I'm wondering if there's a way to create a custom ammunition type and to have an event fire when that ammunition type is fired / hits someone or something? The only way I can think of doing it, is to attach an event to the object being hit for "hit" events, which: 1. Detects if the ammunition type used is my custom type 2. Fires another event based on the ammunition type This seems to be a little wasteful, and I'm not even sure if it's possible. I would like to be able to attach a script to the ammunition itself stating what happens when it hits something, but I can't seem to find anything in CfgAmmo that would allow me to do this. Any pointers to documentation or forum threads dealing with this that you know of would be fantastic. Cheers!
  2. slothstronaut

    Custom Ammunition Types and Events

    My only concern with using the "fired" or "hit" is that it could be potentially expensive. If you have a hundred active players, and each of them is firing weapons, that's a lot of event calls and checks given the event is called for all ammunition types. I can't seem to find a way to attach an event to a particular ammunition type though, so it might just have to be that way!
  3. Hey guys, I am running into a problem with an extension I am working on. Basically, I have a DLL (a.dll) called from a mod directory, which depends on another DLL (b.dll). It seems that my a.dll can't find b.dll unless it's in the ARMA root. Is there any way around this? I'd love to have everything I need to be distributed as part of an addon. Cheers for any help you can give me!
  4. Hey guys, I have a problem. I'm building a script that loads a bunch of predefined items into a crate when it's accessed by the correct player. The logic is: - InventoryOpened event triggers - Check if you can open the container - If yes, load the container - If no, show message, stop you from loading the container When loading the container, the following steps happen: - Clear the current contents (clearItemCargoGlobal, clearWeaponCargoGlobal etc) - Load each item in (addItemCargoGlobal, addWeaponCargoGlobal etc) This all works correctly, however, when the Inventory window actually shows, none of the added items are added until you change the gear type filter (All, Items, Magazines, Weapons at the top of the left inventory panel). As soon as you change the filter all of the correct items show up. Does anyone know why this is happening / what I can do to stop this from happening? Cheers for any help you can give me :)
  5. slothstronaut

    Dynamically adding items to container

    That worked perfectly. Thanks!
  6. slothstronaut

    Dynamically adding items to container

    To give some context, the reason I do the "can open" step, is because I want only one person accessing the box at one time, so on open it sets an inUse variable to true, which blocks any other player accessing it at the same time. Regardless, I don't think it's actually contributing to my problem. So, code sample: Event Handler: _this addEventHandler ["InventoryOpened", { if (_this call crj_fnc_openContainer) then { true; } else { _this execVM "crj_evt_inventoryOpened.sqf" }; } ]; crj_evt_intentoryOpened.sqf private _unit = _this select 0; private _container = _this select 1; private _name = "TEST"; private _isContainerLocker = _container getVariable "crjContainerLocker"; if (isNil "_isContainerLocker") then { true; } else { private _inUse = _container getVariable "inUse"; if (isNil "_inUse") then { _inUse = false; }; if (_inUse) then { closeDialog 106; true; } else { _container setVariable ["inUse", true, true]; _params = [_container, _unit, _name]; [_params, "crj_fnc_loadContainer", false] call BIS_fnc_MP; } }; crj_fnc_loadContainer.sqf (edited for brevity) private _unit = _this select 1; private _container = _this select 0; private _name = _this _select 2; _params = [_container, _unit, _name]; [_params, "crj_fnc_loadContainer", false] call BIS_fnc_MP; crj_fnc_loadContainer.sqf (edited for brevity) crj_fnc_loadContainer = { params ["_container", "_unit", "_name"]; _params = [_container]; _params call crj_fnc_clearContainer; // Load contents in... }; crj_fnc_clearContainer = { params ["_container"]; clearItemCargoGlobal _container; clearMagazineCargoGlobal _container; clearWeaponCargoGlobal _container; clearBackpackCargoGlobal _container; }; So, crj_evt_inventoryOpened.sqf is called when you open an appropriate container, crj_fnc_loadContainer.sqf is then actioned, which calls crj_fnc_loadContainer.sqf (which in turn calls crj_fnc_clearContainer). Hopefully that adds some clarity to what I'm trying to do. Cheers!
  7. Thanks for the code example serena and the documentation link killzone_kid! The example you've given is close to what I have now but on ContainerOpened. I am guessing that doesn't make sense as the event is for the container, not the player, whereas the opposite is true for InventoryOpened. I'll adjust my script today and see how I go.
  8. I'd like to block players from opening a crate that another player is currently accessing. I had thought to set a variable on the container (inUse or something) on the ContainerOpened event, which was reset on ContainerClosed, then have anyone attempting to open the container check against that variable. The logic, I think, is sound. I just don't know how to prevent bringing up the container dialog. Any assistance would be fantastic!
  9. Hey guys, I'm storing an array of actions and objects, and rather than have to write a handler for each equipment type as it comes through, I'd like to be able to do something a little more generic. Here's a small example of what I'm trying to do (please note, this is not production ready, just a test): _command = "addGoggles=G_Aviator"; _split = _command splitString "="; _unit = player; _function = _split select 0; _object = _split select 1; >> insert part I don't know how to do but something like _unit _function _object or in pseudo "for this unit, call this function, with this argument" I've looked into call and it doesn't seem to work with having an argument on the left hand side (such as player addGoggles "G_Aviator"; for example). I can get it to work if I write a helper function, which looks like this: kitAddGoggles = { params ["_unit", "_object"]; _unit addGoggles _object; }; _command = "kitAddGoggles=G_Aviator"; _split = _command splitString "="; _unit = player; _object = _split select 1; _function = _split select 0; _params = [_unit, _object]; _params call call compile _function; But I'd prefer to not have to do a helper for every equipment type. Anyone have anything they can suggest, or even if this is possible? Cheers!
  10. Apologies, I didn't see your update. That definitely did work. Fantastic! Thank you very much!
  11. That doesn't seem to work, unfortunately. Complains that there's a missing semi-colon, no matter how I rearrange things.
  12. Oh, I know I can call it explicitly, but I was hoping to call it by reference, so, something like: _unit = player; _function = "addGoggles"; _object = "G_Aviator"; _unit _function _object;
  13. I was hoping to avoid having a helper function like fn_kitAddGoggles and just call addGoggles directly, but if this is the only way, it's not so bad. Thanks for the reply!
  14. slothstronaut

    The Newcomers' Introduction Thread

    Hey guys! Quick one for my first post! I'm looking forward to being part of this community and learning all I can about modding in the Arma series. Have a good one!
×