Jump to content

Heeeere's johnny!

Member
  • Content Count

    899
  • Joined

  • Last visited

  • Medals

Everything posted by Heeeere's johnny!

  1. I've fixed the error. You may download the fixed version from the usual link (here). Please let me know if it works properly (which it actually should ^_^).
  2. Thank you for reporting! This is a pathing problem. The script searches for the "doors..." files in the folder of the running mission. I did not find that error, because I tested the addon version in a mission where the required files luckily existed. I'm going to fix this and inform you as soon as I uploaded the fixed script. Sorry for that.
  3. Heeeere's johnny!

    Two condition in "setTriggerStatements"

    Please correct me if I get something wrong in the following: If a blufor player enters the trigger area, this trigger activates and "won" gets the action. If a blufor player leaves the trigger area or mounts "won", the action gets removed from "won". If bluforPlayer1 and bluforPlayer2 enter the trigger area and bluforPlayer1 mounts "won", the action gets removed from "won", but only on the machine of bluforPlayer1. So bluforPlayer2 can still use the action, because he neither left the trigger area nor mounted "won". Is that correct?
  4. Heeeere's johnny!

    Two condition in "setTriggerStatements"

    Well, at least to some excant it is what I expected. Never tried it with the single quote though, good to know. But when I started learning SQF, I was missing the \ to escape stuff until I stumbled across this "" notation. I wonder why they introduced the \ for escaping line breaks in defines, but not for ecaping quotes in strings.
  5. Heeeere's johnny!

    Two condition in "setTriggerStatements"

    It's a quotation problem. Your second line doesn't work, because you use the same quotes for color=... as you do for the whole action text string. If you remove the quotes encapsulating the whole line, you'll see: (thisTrigger getVariable 'won') addaction [ '<t color='FF0000'>Hello</t>', 'staz\staz.sqf','',5] I removed the # because it caused some unexpected behaviour with the coloration. But as you can see, the action text is pretty much broken into two pieces namely '<t color=' and '>Hello</t>' and since the interpreter cannot handle the stuff in between, it's a syntax error. You can solve this by using double-double quotes, like this: "(thisTrigger getVariable 'won') addaction [ '<t color=""#FF0000"">Hello</t>', 'staz\staz.sqf','',5]"
  6. Heeeere's johnny!

    Two condition in "setTriggerStatements"

    Let me try a different approach here: _won = createVehicle ["C_SUV_01_F", getPosATL player, [], 0, "NONE"]; _trg = createTrigger ["EmptyDetector", getPos _won, false]; _trg setTriggerArea [3, 3, 0, false]; _trg setTriggerActivation ["WEST", "PRESENT", true]; _trg setVariable ["won", _won]; [ _trg, { if (_x == player) then { hint 'action added'; player setVariable ["wonAction", player addAction ["<t color='#0000FF'>Hello</t>", "staz\staz.sqf", "", 5]]; }; }, { if (_x == player) then { hint 'action removed'; player removeAction (player getVariable "wonAction"); }; } ] call fnc_triggerListChanged; //Source: https://forums.bistudio.com/?showtopic=179622
  7. Hi lordprimate, I'm very sorry I didn't notice your post, I didn't get a notification that you posted in here. Since your issue is already two months old, I wouldn't doubt you have already found some solution. Nevertheless, let me try to explain this here so if you shouldn't need it, then maybe somebody else might. So, in your case, you don't need to use the trigger inside the "on enter" and "on leave" code. But you were very close with your setup, you just made a small mistake in the removeEventHandler line, namely the second parameter in the array must be a number - the index of the event handler that should be removed. But you put a piece of code "{0}" in there. So, you could setVariable the ID returned by addEventHandler to the unit and then getVariable it again when the unit leaves the area, like this: _safezone = createTrigger ["EmptyDetector", getPosATL player]; _safezone setTriggerActivation ["ANY", "PRESENT", true]; _safezone setTriggerArea [10, 10, 0, false]; [ _safezone, {_x setVariable ["invincible", _x addEventHandler ["HandleDamage", {0}]];}, {_x removeEventHandler ["HandleDamage", _x getVariable "invincible"];} ] call fnc_triggerListChanged; Again, I am very sorry that this comes so lately. I have made sure now that I won't miss a post in here again. Kind regards, Johnny
  8. Automated Doors v2.5 Download v2.5 from Armaholic Changelog: Happy new year, people! First off, yes I have friends and family and I have spent Christmas and New Year's Eve with them. But that doesn't mean I can't publish an update on 2 January 2016. ;) Since the number of building classes grew massively with this update and the file size (especially the number of lines) got off the charts, I decided to outsource the door positions into separate files. As long as you have the "doors..." file needed for your map in the same folder as the "automatedDoors.sqf", everything's fine. As always, if you have any issues, suggestions or whatsoever, just let me know. :) Have a nice Play! Johnny
  9. Heeeere's johnny!

    Two condition in "setTriggerStatements"

    What exactly does not work? Is nothing happening when you use the action or is the action not showing up at all?
  10. Heeeere's johnny!

    find enterable buildings

    I did not find a way to grab the door positions from the configs. Actually, it seems like I haven't known the right command (selectionPosition) to use the config's door triggers - damn it.
  11. Heeeere's johnny!

    Two condition in "setTriggerStatements"

    The issue must be in your "staz.sqf" then, because it works for me. And btw, you don't need to use format if you don't put anything (like numbers or so) into the string.
  12. Heeeere's johnny!

    Two condition in "setTriggerStatements"

    You're missing a "=" and an opened <t> must be closed using a </t>: <t color='#0000FF'>Hello</t>
  13. The forum is still supporting BBCode, just not in code blocks as it seems, because they have their own coloration. private ["_myroads","_d0","_br0","_br1","_myarea","_mkrname", "_mname1"]; _myroads = dude nearRoads 10000; { _br0 = (boundingBoxReal _x) select 0;// get its lower left near extreme pos _br1 = (boundingBoxReal _x) select 1;// get its top right far exreme pos _maxwidth = abs ((_br1 select 0) - (_br0 select 0)); _maxlength = abs ((_br1 select 1) - (_br0 select 1)); _myarea = floor (_maxwidth * _maxlength); _mname = format ["m%1%2", _forEachIndex, _x]; _mkr = createMarker [_mname, _x]; _mkr setMarkerShape "ICON"; _mkr setMarkerType "hd_dot"; _mkr setMarkerSize [0.1,0.1]; _mkr setMarkerText format ["%1", _myarea]; }forEach _myroads;Made with KK's SQF to BBCode Converter I know, indentations are gone - not my fault.
  14. Heeeere's johnny!

    find enterable buildings

    You can check for the object's animation sources. In ArmA 3, doors are called "Door_..._rot" or "Door_..._move", so as soon as you find an animation source that starts with "door_", you know it's an entrable building. _allSources = configFile / "CfgVehicles" / _buildingType / "AnimationSources"; _hasDoors = false; for "_i" from 0 to count _allSources - 1 do { _source = configName (_allSources select _i); if (-1 != _source find "Door_") exitWith { _hasDoors = true; }; };
  15. I wouldn't be that quick with a judgement like that. For scripts which are run only once in a while, I'd agree. But think about scripts which run waitUntil or while loops or which run onEachFrame, probably even with rather complex code inside. Producing unnecessary variables and operations may at some point impact the game's fluency. I personally do not assign local variables if the operation is easily readable and I would use the variable only once. So as per cybercoco's example, I prefer latter: hint format ["%1",_varUnprocessed call _fnc_processor]; And reducing lines of code to reduce redundance is simply senseful, because you only have to maintain the respective code in one place rather than in many. That's one of the main reasons why functions were invented.
  16. Heeeere's johnny!

    Two condition in "setTriggerStatements"

    If the car has no name or is added via script, you may setVariable it to the trigger and getVariable it inside the condition again. That way, you don't need a global variable: _won = createVehicle [_type, _position, [], 0, "NONE"]; _trg = createTrigger ["EmptyDetector", getPos _won, false]; _trg setTriggerArea [3, 3, 0, false]; _trg setTriggerActivation ["WEST","PRESENT",true]; _trg setVariable ["won", _won]; _trg setTriggerStatements [ "this && !(player in (thisTrigger getVariable 'won'))", "hint 'yes yes yes'", "hint 'no civilian near wonno'" ];
  17. This error arises, because I simply forgot something in that context, I'm sorry. When I added the different door area sizes, I forgot to add the respective values in the "non-debug" version. The script works though because if the function creating the triggers does not get a value as size parameter, it takes 3 meters as default value. Either way, this problem will be fixed with the next update (coming the next days). Thank you very much for reporting! I personally did not get this message yet. But I do not have the knowledge to tell you where this might come from. The global variable "scriptHandle_automatedDoors" exists so people have something definite to terminate the script if needed. But I was already thinking how senseful this really is since they could simply create a handle themselves when using execVM.
  18. Heeeere's johnny!

    recall function after respawn

    What you think we're doing? :P But seriously, if you have a clear goal of what you want to achieve and put a lot of dedication (and time) into it, you will learn SQF very quickly. The three most important things are "trial and error" and these two pages: https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3 https://community.bistudio.com/wiki/Category:Arma_3:_Functions But for the "never left my keyboard" thing, please never ever neglect your real life for this! When I started learning SQF, I was very close to doing so and changed course before I lost myself into it.
  19. Heeeere's johnny!

    recall function after respawn

    You're wrong. If you use setVariable, it will save whatever you put in there as-is. For instance, player setVariable ["someHouse", cursorTarget]; //where the cursorTarget is a house will save a reference to the house on the player object and you can treat it as if it was that house, no need to "compile", parse or something. But for the record, JavaScript's localStorage saves everything as string, no matter what.
  20. Heeeere's johnny!

    recall function after respawn

    Event handlers pass various different variables into the attached script, depending on which event handler you add. You can find everything in detail here: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Respawn If you want to pass something different into the code, you may setVariable to the unit the EH is added to and then getVariable inside the EH code again to retrieve the variable.
  21. Heeeere's johnny!

    Add killed eventhandler

    Try the "HandleScore" EH, it only works in MP, but it fires whenever the player's score changes, usually after a kill. Having said that, I don't know which other situations might occur for this EH to fire, so you better check if the "object" parameter of this command isKindOf "Man".
  22. Heeeere's johnny!

    Multiple conditions for variables in hint

    Yes, that's what I meant with "parameters". Happy Christmas to you, too!
  23. Heeeere's johnny!

    Add killed eventhandler

    I've never used the "MPKilled" EH yet, only the "Killed" EH. But as far as I understand it, "MPKilled" is like "Killed", only that the code will be executed on each connected machine when the unit it's added to is killed. That in mind, INS_fnc_ckMP will only be executed if the player is the killer of the unit the "MPKilled" EH is added to. The problem is, if the player is the one which the EH is added to, this thing will only fire if the player is killed by himself. But that again is opted out by this line: if (vehicle _ckiller isEqualTo vehicle _cvictim) exitWith {}; So, the "MPKilled" EH must be added to the victim, not the killer, just like it's done with the "Killed" EH.
  24. Heeeere's johnny!

    Multiple conditions for variables in hint

    You may invoke a function with any parameter you like. If you want to pass an array, you just need to handle it as an array inside the function. Well, I see what you want to do, but " _health " and "_ammo" do not exist inside the "_fnc_getFile" function, so this is syntactically not correct. Also, if you compare two variables, the comparison will only be regarding the value. So even i f your code would work, it would always go into one of the two first cases if "_health " and "_ammo" were the same value. What you could do instead is pass a second parameter, like the following: I do not recommend execute files directly though, because that's as if you were calling the file with execVM which means that everytime the file is executed, it's firstly read, then interpreted ("compiled") and then and then executed - which is highly inefficient. _health = 0.7; _ammo = 0.4; _fnc_getFile = { params ["_value", "_name"]; switch true do { case (_value < 0.5 and _name == "health"): { "healthlow.sqf" }; case (_value > 0.5 and _name == "health"): { "healthhigh.sqf" }; case (_value < 0.5 and _name == "ammo"): { "ammolow.sqf" }; case (_value > 0.5 and _name == "ammo"): { "ammohigh.sqf" }; }; }; player addaction ["Health Status", [_health, "health"] call _fnc_getFile]; player addaction ["Ammo Status", [_ammo, "ammo"] call _fnc_getFile]; If the code inside these files is mostly similar, you may wanna think about combining them to one file and make the code dynamic enough to distinguish the different cases using parameters.
  25. Heeeere's johnny!

    handle fuel

    Maybe I didn't get something here, but couldn't the code be condensed to this? handle_fuel = [_tankveh, _mrapveh, _apcveh, _airveh] spawn { _vehicleCounter = 1; while {_vehicleCounter > 0} do { sleep 200; _vehicleCounter = 0; { if (alive _x && damage _x < 0.2 && {alive _x} count crew _x > 0) then { _x setFuel 1; _vehicleCounter = _vehicleCounter + 1; }; } forEach _this; }; };
×