Jump to content


  • Content Count

  • Joined

  • Last visited

  • Medals

Community Reputation

10 Good

About usbstuck

  • Rank
    Private First Class

Profile Information

  • Gender
  • Location
    Utrecht, Netherlands
  • Interests
    Games, Arma scripting, web development (javascript), climbing.

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I would like to access a variable with getVariable in setWaypointStatements. However, the variable name is dynamic, because I don't know how many variables there will be set. Referring to this post I came up with the following: params ["_group", "_pos", "_type", "_additionalStatements"]; private ["_wp", "_ref", "_refString"]; _wp = _group addWaypoint [_pos, 0]; _wp setWaypointType _type; // Make sure chopper lands on the spot _ref = "Land_HelipadCivil_F" createvehicle (_pos); // Save reference to Helipad on group leader _refString = "land_"+ str random [0, 5000, 10000]; _group setVariable [_refString, _ref, true]; hint format ["Reference to helipad: %1", _refString, _ref]; // Use reference on group leader to clean up Helipad after landing call compile format ["_wp setWaypointStatements [""true"", ""deleteVehicle ((group this) getVariable '%1'); %2""]", _refString, _additionalStatements]; (_wp) This works. But I have 2 objections: 1) It's not super-easy to read 2) Adding another format inside the statement (eg: `hint format ["%1", _someVar]` ) will break it. Does anyone know a better way? Thanks! **Edit: Actually objection #2 does work :rolleyes: . It was a different error I got... So basically the only thing that remains of the question is if it can be done neater. But hey, maybe I should just get used to it ;)
  2. Hi, I'd like to make contributions to the wiki (https://community.bistudio.com/wiki) but I only see a login link. Nowhere a link to register. Anyone know how?
  3. Thanks that cleared things up. Well, writing all that code, even though I might not use it now, at least gave me a thorough understanding of sqf :)
  4. I did read the post on your blog. Your blog is a great resource btw, cheers. Your code above is awesomely simple, but do I understand it correctly if this will be executed on every users computer? The command reference states this: In terms of performance, wouldn't it be better to create all triggers on the server? Still, I might have focussed on this too much, especially since your code is written in a fraction of the time that I spend writing mine.. :)
  5. Eventually got it to work using Schatten's suggestion. Still had to do a lot of coding though! Thanks all for the help If ur interested, this is the result: Referenced function arrayFindByFirstIndex.sqf:
  6. Hmm looks like that would considerably reduce my current code.. (still a lot to learn) triggerAttachVehicle seems to take an array, so I could add an array of all playables. Will this trigger deactivation for each? Well guess I find out tonight. Thanks Killzone_Kid!
  7. Thanks Schatten, I'll give that a try! It's probably best though to combine it with a trigger and onAct check if there's a player in the trigger/marker area. Otherwise I'd have to continuously do the check and that feels like a waste of system resources.
  8. Hi all, I'm trying to figure out the best way to keep track of players (MP compatible) entering and exiting an area. When they are entering I want to add actions to the unit, when exiting i want to remove them. I've been fiddling around with triggers for the better part of yesterday :) but it's quite tricky. I wonder if a trigger is actually the best way to do this, because the onDeactivation will only fire if all units are out of the area.. To sum up, my questions: - Is a trigger the right tool? - If it is, how can I fire the deactivate trigger for units leaving the area? (see all the way below @ PROBLEM) More info: Currently I'm not at home so I can't share the code I have so far, but I'll write it down in pseudo code below: (the adding part works) UNITS_IN_AREA = []; RESET_TRIGGER = true; // this makes it repeatable areaTrigger = [Repeating trigger set in mission builder, so it has static position and triggerArea] areaTrigger condition = ({_x in thisList} count (playableUnits + switchableUnits) > 0) && RESET_TRIGGER areaTrigger onActivation = [thisList] call addScript.sqf; RESET_TRIGGER = false; // bottom of addScript sets RESET_TRIGGER = true; areTrigger onDeactivation = [thisTrigger] call removeScript.sqf; addScript.sqf - adds units in thisList to UNITS_IN_AREA - adds actions to the units removeScript.sqf - should remove units from UNITS_IN_AREA that are no longer in the trigger area - should remove actions from these units PROBLEM: Issue here is we don't have a thisList magic variable. A workaround is using nearestObjects with range of triggerArea, but range is circular and a trigger can be ellipse or rectangular
  9. *crunch crunch*... aaah. That actually makes sense. Cheers!
  10. Hi all, Can anyone tell me how I can get this to work? When using radio command "BRAVO" the expected result is a hint with "yada 1 yada". However, it seems _forEachIndex is not passed properly. What I'm getting is "yada any yada". When I try to get the typeName, the result is an empty string... eg: hint format ["yada %1 yada", typeName (_this select 0)]; showId = { hint format ["yada %1 yada", _this select 0]; }; // Triggers _triggers = []; { _tr = createTrigger ["EmptyDetector", position player]; _tr setTriggerActivation [_x, "PRESENT", true]; _tr setTriggerStatements ["this", "[_forEachIndex] spawn showId", ""]; _triggers = _triggers + [_tr]; } forEach ["ALPHA", "BRAVO", "CHARLIE", "DELTA"];
  11. usbstuck

    The Newcomers' Introduction Thread

    Hi all, I just signed up and accepted the Forum Rules. However, I'm not able to post a new thread! I'd like to ask a question in the Editing and scripting forum, but there's no "New thread" button.. Can anyone explain what I need to do? I must have missed something.. ##edit: maybe this just took time... the button is there now. strange.