Jump to content

JulesMK2

Member
  • Content Count

    10
  • Joined

  • Last visited

  • Medals

Community Reputation

2 Neutral

About JulesMK2

  • Rank
    Private

Recent Profile Visitors

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

  1. Yeah I suppose I could and that would keep it all in its own functions. I will have to redo it later. Thanks for the suggestion!
  2. Of course! The select function is what gets the units index... Thanks 😄
  3. Ok so I have tried what was suggested and it seems like it (fn_teleportToPlayer) still isn't getting access to the variable. I then thought this could be due to it being on an event handler rather than the "action" property buttons can have. So I tried it on "action" and this is my result: adminMenu.hpp class adminTeleport: RscButton { idc = 1601; //onMouseButtonClick = "[unit] call JC_fnc_teleportToPlayer;"; action = "[unit] call JC_fnc_teleportToPlayer;"; text = "TELEPORT"; //--- ToDo: Localize; x = 0.250625 * safezoneW + safezoneX; y = 0.22 * safezoneH + safezoneY; w = 0.091875 * safezoneW; h = 0.028 * safezoneH; }; fn_teleportToPlayer.sqf params ["_unit"]; hint format["Teleporting to: %1", name _unit]; player setPos( getPos _unit); I have tried: unit | _unit in both files. The hint also returns a blank space for _unit but "any" for unit
  4. Hi there, recently I stumbled across an "Amin Menu" tutorial and sadly the creator dropped it at 3 videos. I am trying to work on the next part he was going to include as a learning experience but I am unable to parse a variable from one function into another. Currently I have a function which gets the selected unit which works absolutely fine. I tried to make the variable global so it could get accessed outside of the scope but I can't parse it in via the .HPP. Is anybody able to shed some light? adminMenu.hpp //User selection class class playerSelectionBtn: RscButton { idc = 1600; onMouseButtonClick = "(lbCurSel 1500) call JC_fnc_playerSelected;"; text = "SELECT"; //--- ToDo: Localize; x = 0.664062 * safezoneW + safezoneX; y = 0.346 * safezoneH + safezoneY; w = 0.091875 * safezoneW; h = 0.028 * safezoneH; }; //Teleport button class class adminTeleport: RscButton { idc = 1601; onMouseButtonClick = "['unit'] call JC_fnc_teleportToPlayer;"; //Here I try to parse unit into the function text = "TELEPORT"; //--- ToDo: Localize; x = 0.250625 * safezoneW + safezoneX; y = 0.22 * safezoneH + safezoneY; w = 0.091875 * safezoneW; h = 0.028 * safezoneH; }; fn_playerSelected.sqf params ["_index"]; unit = (switchableUnits select _index); //Change the variable to global if (!(isNull(unit))) then { unit setDamage 1; hint name unit; } else { hint "No player selected"; }; fn_teleportToPlayer.sqf params ["_unit"]; //Attempt to "fetch" unit inside the params hint format["Teleporting to: %1", _unit]; //Initial test to see if unit was there. Did have ",name _unit" but that returned a generic error player setPos( getPos _unit);
  5. JulesMK2

    Blackfish script help

    For destroying the UAV surely something as simple as this would work: if (!alive _pilotguy) { //or _plane _uav allowdamage true; //re-enables damage _uav setDamage [1, false]; //Sets it's damage to fully destroyed with no effects played }
  6. JulesMK2

    Blackfish script help

    https://www.youtube.com/watch?v=0opszDP8XYs Have a look at this video as he forces Heli AI to shoot. Perhaps it could work for the blackfish as well. Not sure if it'd work for a static point as not tested it myself.
  7. Ah yes, I completely forgot Sequential Programming existed 😂 I suppose I can always just turn the if check into a while and at the end, set the variable back to 0 to prevent a loop. EDIT: It does seem like the problem is setting the value to one as @opusfmspol mentioned. The false block in your example @Maff does fire. EDIT 2: Moving the if/else into the addAction worked! I didn't properly read what @opusfmspol had suggested. Thank you very much for the help, you two!
  8. So I have tried both examples and I am getting the same output as last time. It will send the message in side chat (FOB Activated!), however nothing after that seems to get executed or the value is never set. here is my updated code after following your snippet (0 = false, 1 = true). _spawnPoleFnc = { _pole = "Flag_UK_F" createVehicle getMarkerPos "marker_5"; //Spawns Flag _pole setVariable ["activefob", 0, true]; //Sets variable to flag _pole addAction["Activate FOB", { [west, "HQ"] sideChat "FOB Activated!"; (_this select 0) setVariable ["activefob", 1, true]; //Changes variable value }]; if ((_pole getVariable ["activefob", 0]) != 0) then { hint "It works!"; }; }; call _spawnPoleFnc;
  9. Haha I will test it shortly and let you know! Thanks for your input and this can indeed be confusing at the best of times
  10. I am sure this has come up quite a bit but the examples I am finding aren't really helping much. The task I am trying to complete is when a player triggers the addAction, it changes the value of a local variable to true and then fires a hint if the value is true. For some reason, I just cannot get the hint inside the if to fire. I have tried changing the value of "activefob" from 0 to 1 and also currently false to true but to no avail. Is anybody able to lend a hand or tell me where I am going wrong? Much appreciated! _spawnPoleFnc = { //These comments are just for my own methodical thinking _pole = "Flag_UK_F" createVehicle getMarkerPos "marker_5"; //Spawns Flag _pole setVariable ["activefob", false]; //Sets variable to flag _pole addAction["Activate FOB", { [west, "HQ"] sideChat "FOB Activated!"; (_this select 0) setVariable ["activefob", true]; //Changes variable value }]; if ((_pole getVariable "activefob")) then { hint "It works!"; }; }; call _spawnPoleFnc;
×