-
Content Count
87 -
Joined
-
Last visited
-
Medals
Everything posted by Northup
-
Button Click event handler works and doesn't work (respawn)
Northup posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Working on a custom MP respawn function, placed inside onPlayerRespawn Pretty straightforward: - On death, we immediately move the _newUnit to [0,0,0] - Create a camera on the body of the _oldUnit - Create an included dialog that displays a map and a button that says respawn. - Add button event handler that when clicked moves _newUnit to an HQ building. - Add addaction to player corpse so that a friendly player can "heal". Issue is when clicked, respawn button just closes the dialog - which means it is doing something, and that something is at the end of the event handler, so I am unsure why everything else appears to be skipped: params ["_newUnit", "_oldUnit", "_respawn", "_respawnDelay"]; _newUnit setPos [0, 0, 0]; _newUnit allowDamage false; _newUnit enableSimulation false; [0, 1, true, false] call NUP_fnc_cinematicBorder; // Create camera to focus on the dead body _camera = "camera" camCreate (getPosATL _oldUnit); _camera cameraEffect ["INTERNAL", "BACK"]; _camera camPrepareTarget _oldUnit; _camera camCommitPrepared 0; _camera camPrepareRelPos [0, 0, 3]; _camera camPrepareFOV 0.5; _camera camCommitPrepared 0; // Open the RespawnDialog createDialog "RespawnDialog"; // Disable scoring UI private _scoreHUD = uiNamespace getVariable "ScoreHUD"; if (!isNull _scoreHUD) then { _scoreHUD closeDisplay 1; }; // Pass variables to the dialog private _display = findDisplay 9500; // RespawnDialog display _display setVariable ["NUP_camInstance", _camera, true]; _display setVariable ["NUP_newUnitInstance", _newUnit, true]; _display setVariable ["NUP_oldUnitInstance", _oldUnit, true]; // Fetch the map control and set its position to the player's position private _map = _display displayCtrl 9501; // Map control (_CT_MAP) if (!isNull _map) then { _map ctrlMapAnimAdd [0, 0.1, getPosATL _oldUnit]; // Set the map to player's position ctrlMapAnimCommit _map; }; // Fetch the dialog controls private _respawnButton = _display displayCtrl 2; // Respawn button (_CT_BUTTON) private _eventHandlerID = -1; // Attach functionality to the Respawn Button _respawnButton ctrlAddEventHandler ["ButtonClick", { params ["_control"]; // Retrieve variables from the dialog private _display = findDisplay 9500; private _camera = _display getVariable ["NUP_camInstance", objNull]; private _newUnit = _display getVariable ["NUP_newUnitInstance", objNull]; private _oldUnit = _display getVariable ["NUP_oldUnitInstance", objNull]; private _eventHandlerID = _display getVariable ["NUP_EventHandlerID", -1]; // Debug validation if (isNull _camera) exitWith { hint "Error: Camera instance is null!"; }; if (isNull _newUnit) exitWith { hint "Error: New unit instance is null!"; }; if (isNull _oldUnit) exitWith { hint "Error: Old unit instance is null!"; }; // Retrieve the player's faction private _playerFaction = _oldUnit getVariable ["playerFaction"]; private _respawnMarker = switch (_playerFaction) do { case "BLU_F": { "start_WEST" }; case "OPF_F": { "start_EAST" }; case "IND_F": { "start_INDEP" }; default { "start_CIVILIAN" }; }; private _markerPos = getMarkerPos _respawnMarker; // Building search logic private _buildingClasses = [ "Land_Cargo_HQ_V1_F", "Land_Cargo_HQ_V3_F", "Land_Medevac_HQ_V1_F", "Land_Cargo_House_V1_F", "Land_Cargo_Tower_V1_F", "Land_i_Shed_Ind_F" ]; private _nearestBuildings = nearestObjects [_markerPos, _buildingClasses, 100]; private _allBuildingPositions = []; { private _buildingPositions = [_x] call BIS_fnc_buildingPositions; _allBuildingPositions = _allBuildingPositions + _buildingPositions; } forEach _nearestBuildings; // Determine respawn position private _respawnPos = if (count _allBuildingPositions > 0) then { selectRandom _allBuildingPositions } else { _markerPos }; // Move player to respawn position _newUnit allowDamage true; _newUnit enableSimulation true; _newUnit setPosATL _respawnPos; // Cleanup the camera if (!isNull _camera) then { _camera cameraEffect ["TERMINATE", "BACK"]; camDestroy _camera; }; // Delete the old unit after 60 seconds [_oldUnit] spawn { sleep 60; deleteVehicle _oldUnit; }; // Remove the ButtonClick event handler inside itself _control ctrlRemoveEventHandler ["ButtonClick", _eventHandlerID]; // Close the dialog closeDialog 0; }]; // Add revive action to the dead body _oldUnit addAction [ "Revive Player", // title { params ["_target", "_caller", "_actionId", "_arguments"]; // script _arguments params ["_camera", "_oldUnit", "_newUnit"]; [_target, _caller, _camera, _oldUnit, _newUnit] call NUP_fnc_revivePlayer; }, _arguments, // arguments 1.5, // priority true, // showWindow true, // hideOnUse "", // shortcut "side _this == side _target", // condition 2, // radius false, // unconscious "", // selection "" // memoryPoint ]; // Set the safezone delay back to false so respawning players at HQ are protected immediately. _newUnit setVariable ["NUP_safezoneDelay", false]; _newUnit setVariable ["NUP_disableCommandChat", true]; _newUnit setVariable ["vehicle", 0]; [] call NUP_fnc_playerMarkers; // Apply the saved loadout if it exists private _savedLoadout = _newUnit getVariable ["NUP_savedLoadout", nil]; if (!isNil "_savedLoadout") then { _newUnit setUnitLoadout _savedLoadout; }; I tested also by replacing all functions inside the event handler with a hint. Got nothing. Used very similar approach in another dialog and it worked well enough. Any tips would be appreciated! Also, here is the rsc: class RscRedeployment { idd = 9000; // Display identification enableSimulation = 1; // 1 (true) to allow world simulation to be running in the background, 0 to freeze it enableDisplay = 1; // 1 (true) to allow scene rendering in the background class controls { // Add the black bar at the top class HeaderBar { idc = -1; type = CT_STATIC; style = ST_CENTER; x = safeZoneX + safeZoneW * 0.05; // Align with the map y = safeZoneY + safeZoneH * 0.01; // Slightly above the map w = safeZoneW * 0.9; // Match map width h = 0.05; // Height of the bar colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",1}; //background colorText[] = {1, 1, 1, 1}; // White text font = "PuristaMedium"; sizeEx = 0.04; // Text size text = "INFANTRY REDEPLOYMENT SYSTEM"; // Text content shadow = 0; // No shadow }; class _CT_MAP { access = 1; // Control access (0 - ReadAndWrite, 1 - ReadAndCreate, 2 - ReadOnly, 3 - ReadOnlyVerified) idc = 9001; // Control identification (without it, the control won't be displayed) type = CT_MAP_MAIN; // Type style = ST_PICTURE; // Style default = 1; // Control selected by default (only one within a display can be used) blinkingPeriod = 0; // Time in which control will fade out and back in. Use 0 to disable the effect. x = safeZoneX + safeZoneW * 0.05; y = safeZoneY + safeZoneH * 0.05; w = safeZoneW * 0.9; h = safeZoneH * 0.8; sizeEx = GUI_GRID_CENTER_H; // Text size font = GUI_FONT_NORMAL; // Font from CfgFontFamilies colorText[] = {0,0,0,1}; // Text color tooltip = ""; // Tooltip text tooltipColorShade[] = {0,0,0,1}; // Tooltip background color tooltipColorText[] = {1,1,1,1}; // Tooltip text color tooltipColorBox[] = {1,1,1,1}; // Tooltip frame color moveOnEdges = 1; // Move map when cursor is near its edge. Discontinued. // Rendering density coefficients ptsPerSquareSea = 5; // seas ptsPerSquareTxt = 20; // textures ptsPerSquareCLn = 10; // count-lines ptsPerSquareExp = 10; // exposure ptsPerSquareCost = 10; // cost // Rendering thresholds ptsPerSquareFor = 9; // forests ptsPerSquareForEdge = 9; // forest edges ptsPerSquareRoad = 6; // roads ptsPerSquareObj = 9; // other objects scaleMin = 0.001; // Min map scale (i.e., max zoom) scaleMax = 1.0; // Max map scale (i.e., min zoom) scaleDefault = 0.16; // Default scale alphaFadeStartScale = 2; // Scale at which satellite map starts appearing alphaFadeEndScale = 2; // Scale at which satellite map is fully rendered maxSatelliteAlpha = 0.85; // Maximum alpha of satellite map text = "#(argb,8,8,3)color(1,1,1,1)"; // Fill texture colorBackground[] = {1,1,1,1}; // Fill color colorOutside[] = {0,0,0,1}; // Color outside of the terrain area (not sued when procedural terrain is enabled) colorSea[] = {0.4,0.6,0.8,0.5}; // Sea color colorForest[] = {0.6,0.8,0.4,0.5}; // Forest color colorForestBorder[] = {0.6,0.8,0.4,1}; // Forest border color colorRocks[] = {0,0,0,0.3}; // Rocks color colorRocksBorder[] = {0,0,0,1}; // Rocks border color colorLevels[] = {0.3,0.2,0.1,0.5}; // Elevation number color colorMainCountlines[] = {0.6,0.4,0.2,0.5}; // Main countline color (every 5th) colorCountlines[] = {0.6,0.4,0.2,0.3}; // Countline color colorMainCountlinesWater[] = {0.5,0.6,0.7,0.6}; // Main water countline color (every 5th) colorCountlinesWater[] = {0.5,0.6,0.7,0.3}; // Water countline color colorPowerLines[] = {0.1,0.1,0.1,1}; // Power lines color colorRailWay[] = {0.8,0.2,0,1}; // Railway color colorNames[] = {1.1,0.1,1.1,0.9}; // Unknown? colorInactive[] = {1,1,0,0.5}; // Unknown? colorTracks[] = {0.8,0.8,0.7,0.2}; // Small road border color colorTracksFill[] = {0.8,0.7,0.7,1}; // Small road color colorRoads[] = {0.7,0.7,0.7,1}; // Medium road border color colorRoadsFill[] = {1,1,1,1}; // Medium road color colorMainRoads[] = {0.9,0.5,0.3,1}; // Large road border color colorMainRoadsFill[] = {1,0.6,0.4,1}; // Large road color colorGrid[] = {0.1,0.1,0.1,0.6}; // Grid coordinate color colorGridMap[] = {0.1,0.1,0.1,0.6}; // Grid line color widthRailway = 0; fontLabel = GUI_FONT_NORMAL; // Tooltip font from CfgFontFamilies sizeExLabel = GUI_GRID_CENTER_H * 0.5; // Tooltip font size fontGrid = GUI_FONT_SYSTEM; // Grid coordinate font from CfgFontFamilies sizeExGrid = GUI_GRID_CENTER_H * 0.5; // Grid coordinate font size fontUnits = GUI_FONT_SYSTEM; // Selected group member font from CfgFontFamilies sizeExUnits = GUI_GRID_CENTER_H * 0.5; // Selected group member font size fontNames = GUI_FONT_NORMAL; // Marker font from CfgFontFamilies sizeExNames = GUI_GRID_CENTER_H * 1; // Marker font size fontInfo = GUI_FONT_NORMAL; // Unknown? sizeExInfo = GUI_GRID_CENTER_H * 0.5; // Unknown? fontLevel = GUI_FONT_SYSTEM; // Elevation number font sizeExLevel = GUI_GRID_CENTER_H * 0.5; // Elevation number font size showCountourInterval = 1; // Show Legend class Task { icon = "#(argb,8,8,3)color(1,1,1,1)"; color[] = {1,1,0,1}; iconCreated = "#(argb,8,8,3)color(1,1,1,1)"; colorCreated[] = {0,0,0,1}; iconCanceled = "#(argb,8,8,3)color(1,1,1,1)"; colorCanceled[] = {0,0,0,0.5}; iconDone = "#(argb,8,8,3)color(1,1,1,1)"; colorDone[] = {0,1,0,1}; iconFailed = "#(argb,8,8,3)color(1,1,1,1)"; colorFailed[] = {1,0,0,1}; size = 8; importance = 1; // Required, but not used coefMin = 1; // Required, but not used coefMax = 1; // Required, but not used }; class ActiveMarker { color[] = {0,0,0,1}; // Icon color size = 2; // Size in pixels }; class LineMarker { textureComboBoxColor = "#(argb,8,8,3)color(1,1,1,1)"; lineWidthThin = 0.008; lineWidthThick = 0.014; lineDistanceMin = 3e-005; lineLengthMin = 5; }; class Waypoint { coefMax = 1; // Minimum size coefficient coefMin = 4; // Maximum size coefficient color[] = {0,0,0,1}; // Icon color icon = "#(argb,8,8,3)color(0,0,0,1)"; // Icon texture importance = 1; // Drawing importance (when multiple icons are close together, the one with larger importance is prioritized) size = 2; // Size in pixels }; class WaypointCompleted: Waypoint{}; class CustomMark: Waypoint{}; class Command: Waypoint{}; class Bush: Waypoint{}; class Rock: Waypoint{}; class SmallTree: Waypoint{}; class Tree: Waypoint{}; class BusStop: Waypoint{}; class FuelStation: Waypoint{}; class Hospital: Waypoint{}; class Church: Waypoint{}; class Lighthouse: Waypoint{}; class Power: Waypoint{}; class PowerSolar: Waypoint{}; class PowerWave: Waypoint{}; class PowerWind: Waypoint{}; class Quay: Waypoint{}; class Transmitter: Waypoint{}; class Watertower: Waypoint{}; class Cross: Waypoint{}; class Chapel: Waypoint{}; class Shipwreck: Waypoint{}; class Bunker: Waypoint{}; class Fortress: Waypoint{}; class Fountain: Waypoint{}; class Ruin: Waypoint{}; class Stack: Waypoint{}; class Tourism: Waypoint{}; class ViewTower: Waypoint{}; onCanDestroy = ""; onDestroy = ""; onSetFocus = ""; onKillFocus = ""; onKeyDown = ""; onKeyUp = ""; onMouseButtonDown = ""; onMouseButtonUp = ""; onMouseButtonClick = ""; onMouseButtonDblClick = ""; onMouseZChanged = ""; onMouseMoving = ""; onMouseHolding = ""; onDraw = ""; }; class _CT_BUTTON { deletable = 0; fade = 0; access = 0; type = CT_BUTTON; text = "CANCEL"; // Default text (empty) colorText[] = {1,1,1,1}; // White text colorDisabled[] = {1,1,1,0.5}; // Disabled text color x = safeZoneX + safeZoneW * 0.1; // Left side of the map y = safeZoneY + safeZoneH * 0.9; // Same vertical level as Redeploy w = safeZoneW * 0.2; // Button width h = safeZoneH * 0.05; // Button height colorBackground[] = {0,0,0,1}; // Black background colorBackgroundDisabled[] = {0,0,0,0.5}; // Disabled background colorBackgroundActive[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",1}; colorFocused[] = {0,0,0,1}; // Focused background (black) colorShadow[] = {0,0,0,0}; // No shadow colorBorder[] = {1,1,1,1}; // White border soundEnter[] = {"\A3\ui_f\data\sound\RscButton\soundEnter", 0.09, 1}; soundPush[] = {"\A3\ui_f\data\sound\RscButton\soundPush", 0.09, 1}; soundClick[] = {"\A3\ui_f\data\sound\RscButton\soundClick", 0.09, 1}; soundEscape[] = {"\A3\ui_f\data\sound\RscButton\soundEscape", 0.09, 1}; idc = 1; style = ST_CENTER; // Center text shadow = 0; font = "PuristaMedium"; // Use a consistent font sizeEx = 0.05; // Standard text size offsetX = 0; offsetY = 0; offsetPressedX = 0.002; offsetPressedY = 0.002; borderSize = ; }; class RedeployButton: _CT_BUTTON { idc = 2; // Redeploy button ID text = "REDEPLOY"; x = safeZoneX + safeZoneW * 0.7; y = safeZoneY + safeZoneH * 0.9; w = safeZoneW * 0.2; h = safeZoneH * 0.05; font = GUI_FONT_NORMAL; soundEnter[] = {"\A3\ui_f\data\sound\RscButton\soundEnter", 0.09, 1}; soundPush[] = {"\A3\ui_f\data\sound\RscButton\soundPush", 0.09, 1}; soundClick[] = {"\A3\ui_f\data\sound\RscButton\soundClick", 0.09, 1}; soundEscape[] = {"\A3\ui_f\data\sound\RscButton\soundEscape", 0.09, 1}; onButtonClick = ""; }; }; }; -
Button Click event handler works and doesn't work (respawn)
Northup replied to Northup's topic in ARMA 3 - MISSION EDITING & SCRIPTING
100%. Spent too much time looking at it and not seeing the obvious. IDC appears to be the culprit. I did read that in the biki, and tried changing it, but must not have had things setup correctly when testing. Assumed changing it to 1 (IDC_OK) would work. Didn't seem to. Double checked now, and decided to try an unreserved number as you suggested. Tested and error code - which means it is working. Thanks! -
Spawn with combat stance active
Northup replied to Alex417's topic in ARMA 3 - MISSION EDITING & SCRIPTING
-
addAction disappears with barrel objects
Northup replied to kibaBG's topic in ARMA 3 - MISSION EDITING & SCRIPTING
1. Pelvis is misspelled. I'm surprised you didn't get an error. 2. Your first addaction had an invisible character that precluded it from running. If you copied it from here, that is probably where you got it. 3. Now it adds the addactions, however once you pick it up, the object loses it's addaction, as it is attached to the player. To solve this, you need to assign the second addaction to the caller, not the object, and remove it when the caller drops it. Example (tested): // Create the barrel on the server _crate = createVehicle ["Land_MetalBarrel_F", position helipad, [], 0, "NONE"]; _crate enableDynamicSimulation false; _crate addAction [ "<t color='#FFFF80'>Pickup</t>", { params ["_target", "_caller", "_actionId", "_arguments"]; _target attachTo [_caller, [0, 2, 1], "Pelvis"]; _caller addAction [ "<t color='#FFFF80'>Drop</t>", { params ["_target", "_caller", "_actionId", "_arguments"]; { detach _x; _x enableSimulationGlobal true; } forEach attachedObjects _caller; _caller removeAction _actionId; } ]; }, nil, 1.5, false, false, "", "true", 3, false, "", "" ]; -
Need definitive answer on what sets Lobby Parameters - enabled and Mission settings (aka not working)
Northup replied to priglmeier's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Welp, then that's why it doesn't work. How/Where is CP defined in your mission? I am assuming you have a param for it in description.ext. Whatever that param is, it's value has to be retrieved in the script that handles that param. One super duper easy way to see if/where/how this param value is applied elsewhere is to first located is to use notepad++, open description.ext, find the parameter you want to look into, select and copy it, hit ctrl+f, click the 'Find in Files' tab, paste it. Change the 'Directory' to your mission folder root and click the 'Find All' button. That will show you any references to that variable in any script present in your mission folder. If you don't see it, there's your issue. Below is example of a parameter being defined in description.ext and retrieved elsewhere. Description.ext: class Params { //Changes speed of holdaction that captures the flag class NUP_flagCapSpeed // THIS IS THE VARIABLE WE WILL RETRIEVE ELSEWHERE { title = "Flag Capture Speed"; values[] = {1, 10, 15, 30}; texts[] = {"1 second (Testing)", "10 seconds", "15 seconds", "30 seconds"}; default = 1; }; }; Then, in my holdAction script, I have this line: _duration = ["NUP_flagCapSpeed", 5] call BIS_fnc_getParamValue; And a bit further down in that same script: ... //Interrupt { params[ "_flag", "_caller" ]; _baseMarker = _flag getVariable "NUP_baseMarker"; [ _flag, 1 ] remoteExec [ "setFlagAnimationPhase", 0, format[ "capFlagPhase_%1", _baseMarker ] ]; _sideID = _flag getVariable "TER_flagSide"; _fileFlag = ["flag_csat_co", "flag_nato_co", "flag_aaf_co", "flag_fd_purple_co", "flag_white_co"] select (_sideID call BIS_fnc_sideID); _flag setFlagTexture format ["\a3\data_f\flags\%1.paa", _fileFlag]; }, [], _duration, // HERE IS THE PARAMVALUE FROM MISSION PARAMETERS, PASSED AS A LOCAL VARIABLE 1.5, false ] call BIS_fnc_holdActionAdd; Point is, something being present in the mission parameters doesn't matter much if there isn't another script retrieving the variable and doing something with it. Same thing applies to the 2x param. I am assuming that CP is your mission's currency. Any currency system is going to be mission specific, created for that mission. As far as Arma is concerned, currency doesn't exist and there is no built in currency system in Arma 3. Disabling player fatigue is easy enough, though from what I found with a quick Google search, fatigue is antiquated and it'd probably be better to disable player stamina. In description.ext, I'd add another param to the params section: class Params { //Changes speed of holdaction that captures the flag class NUP_flagCapSpeed { title = "Flag Capture Speed"; values[] = {1, 10, 15, 30}; texts[] = {"1 second (Testing)", "10 seconds", "15 seconds", "30 seconds"}; default = 1; }; class TAG_myNewPlayerStaminaParam // THIS IS THE NEW STAMINA VARIABLE WE WILL RETRIEVE IN ONPLAYERRESPAWN.SQF { title = "Player Stamina"; values[] = {true, false}; texts[] = {"enabled", "disabled"}; default = false; }; }; Then, in onPlayerRespawn.sqf: params ["_newUnit", "_oldUnit", "_respawn", "_respawnDelay"]; _staminaSetting = ["TAG_myNewPlayerStaminaParam", false] call BIS_fnc_getParamValue; _newUnit enableStamina _staminaSetting; So as you can see, it's a bit more involved than just selecting a value. Please post your code so that someone can help point you in the right direction. -
Need definitive answer on what sets Lobby Parameters - enabled and Mission settings (aka not working)
Northup replied to priglmeier's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Post your code. -
Playing Music over addaction
Northup replied to Fipler's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Derp. Youre right. My bad. Thanks for the correction @pierremgi -
Playing Music over addaction
Northup replied to Fipler's topic in ARMA 3 - MISSION EDITING & SCRIPTING
If it's MP: this addAction ["Play Vietnam", {["Vietnam"] remoteExec ["playMusic", _caller];}]; I was wrong. -
[Solved] RemoteExec on player vehicle in trigger
Northup replied to Northup's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Ok, so I figured it out. I wasn't paying close enough attention to the repair script. All of the titleTexts and hints need to be remote exec'd, and the script can just be called. [["<t color='#00ff00' size='2'>Repairing Damage...</t><br/>", "PLAIN", -1, true, true]] remoteExec ["titleText", owner _driver]; -
[Solved] RemoteExec on player vehicle in trigger
Northup posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Have a repair trigger. Trying to figure out how to remoteExec to client (driver) of the vehicle the repair script. Crude example: // Set trigger condition and statements _repairTrigger setTriggerStatements [ //"{_x isKindOf 'LandVehicle' || _x isKindOf 'Helicopter' && speed _x < 1} count thisList > 0", // Condition (testing cond. below.) "{(_x isKindOf 'LandVehicle' || _x isKindOf 'Helicopter') && speed _x < 1 && damage _x > 0} count thisList > 0",// Condition "call {_handle = [(thisList select 0), thisTrigger] call NUP_fnc_repairVehicle;}", // Activation "" // Deactivation (empty) ]; works fine in local hosted, not dedicated, obviously. Tried: " [(thisList select 0), thisTrigger] remoteExec ['NUP_fnc_repairVehicle', owner _x] ;", // Activation I'm just a tad stumped. Any takers? -
[Solved] RemoteExec on player vehicle in trigger
Northup replied to Northup's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Yeah, a little titletext and a few of sleeps basically, in addition to rearming, repairing and refueling. I tried the original and had no result. Assumed it wasn't firing on player. 1. The trigger itself is part of a composition spawned in with Larrow's Eden Comp Spawn, which is called in zoneSelect. In initSafezone, I snag and update the trigger, and call addVehicleServices, where I apply setTriggerActivation and setTriggerStatements posted above. It's a bit complex. InitSever>zoneSelect>LARs_fnc_spawnComp>initSafezone>addVehicleServices. //get the repair trigger private _triggerList = _flag nearObjects ["EmptyDetector", 150]; // Filter only triggers with names starting with "NUP_repairTrigger_" private _repairTriggers = _triggerList select { (toLower (name _x) find "nup_repairtrigger_") isEqualTo 0 }; // Call NUP_fnc_addVehicleServices for each repair trigger { private _repairTrigger = _x; // Ensure the trigger name matches private _triggerName = toLower (name _repairTrigger); if (_triggerName find "nup_repairtrigger_" isEqualTo 0) then { // Call NUP_fnc_addVehicleServices passing the side and the repair trigger [_repairTrigger] call NUP_fnc_addVehicleServices; }; } forEach _repairTriggers; 2. I added a pastebin link to a previous post maybe 30 seconds before I got the notification for this. https://pastebin.com/hAyCkrfL Mission Link: https://drive.google.com/file/d/14ETgJGqbO3z3HL6CC-n4hwb-cGThFv7E/view?usp=sharing BTW Happy Thanksgiving @pierremgi. -
[Solved] RemoteExec on player vehicle in trigger
Northup replied to Northup's topic in ARMA 3 - MISSION EDITING & SCRIPTING
_repairTrigger setTriggerActivation ["ANY", "PRESENT", true]; Tried both of those. Neither seemed to work. The mission is MP. NUP_fnc_repairVehicle: https://pastebin.com/hAyCkrfL -
How to gradually overcast (cloud cover) on dedi ?
Northup replied to kibaBG's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Maybe something like: // Initial values private _startingOvercast = 0.3; private _increment = 0.0208; // Increase per step private _interval = 300; // 5 minutes in seconds // Skip 24 hours to simulate mission start skipTime -24; // Set initial overcast to _startingOvercast (0.3) over 24 hours (86400 seconds) [86400, _startingOvercast] remoteExec ["setOvercast", 0, true]; // Skip time forward 24 hours to make sure weather is applied skipTime 24; // Sync client weather to server 0 = 0 spawn {sleep 0.1; simulWeatherSync;}; // Overcast adjustment loop [_startingOvercast, _increment] spawn { params ["_startingOvercast", "_increment"]; for "_i" from 0 to 23 do { // 24 updates over 2 hours private _targetOvercast = _startingOvercast + (_i * _increment); // Set overcast to the calculated target value on all clients [0, _targetOvercast] remoteExec ["setOvercast", 0, true]; // Apply to both server and clients forceWeatherChange; sleep 300; // Wait 5 minutes before the next update }; }; remoteExecing overcast on JIP since syncing is broken. rest of changes are made with info on wiki: 1: Arma 3's volumetric clouds cannot be instantly changed (it would take up to a few seconds to do a full recompute). Therefore, 0 setOvercast 0 will not have the desired effect. You can use skipTime to get to the desired cloud coverage. NOTE: To get instant, seamless overcast change to overcast 1 advance the time 24 hours with skipTime while setting overcast transition time to 86400 seconds (24 hours) - Killzone_Kid (12:08, 15 August 2013) 2: With removal of simulSetHumidity, in order to add instant cloud cover, execute simulWeatherSync with delay (for now). -
Intel that plays sound on the player
Northup replied to Godfather Blue's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Post your code. -
Make radio play a song
Northup replied to Maguila.gm's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Description.ext: class CfgSounds { sounds[] = {}; class Track01 { name = "Track01"; sound[] = {"\Music\song1.ogg", db+10, 1.0}; titles[] = { 0, "*HEADBANGING*" }; // subtitles titlesFont = "LCD14"; // OFP:R - titles font family titlesSize = 0.05; // OFP:R - titles font size forceTitles = 1; // Arma 3 - display titles even if global show titles option is off (1) or not (0) titlesStructured = 1; // Arma 3 - treat titles as Structured Text (1) or not (0) }; }; In init of radio object: this say3D "Track01"; Example Mission: https://drive.google.com/file/d/15NAzb88tuGvRh8ZK2O4LOy8m0z9Dgcv6/view?usp=sharing Could also name the radio "radio1" and, in initServer: radio1 say3D "Track01"; Just remember to remove the line from radio1's init if doing it that way. -
_weather = ["Weather", -1] call BIS_fnc_getParamValue; if (_weather == -1) exitWith { hint "Weather parameter not found!"; }; switch (_weather) do { case 0: { skipTime -24; 0 setOvercast 0; //clear sky skipTime 24; [0,0] remoteExec ["setOvercast", -2, true]; //remoteExec for JIP 0 setRain 0; 0 setFog 0; forceWeatherChange; [1] remoteExec ["skipTime", -2, true]; //remoteExec for JIP [-1] remoteExec ["skipTime", -2, true]; //remoteExec for JIP 999999 setRain 0; 999999 setFog 0; 0 = [] spawn { sleep 0.1; simulWeatherSync; }; //To force instant cloud cover }; case 1: { skipTime -24; 86400 setOvercast 0.5; skipTime 24; [0,0.5] remoteExec ["setOvercast", -2, true]; 0 setRain 0; 0 setFog 0; forceWeatherChange; [1] remoteExec ["skipTime", -2, true]; [-1] remoteExec ["skipTime", -2, true]; 999999 setRain 0; 999999 setFog 0; 0 = [] spawn { sleep 0.1; simulWeatherSync; }; }; case 2: { skipTime -24; 86400 setOvercast 0.6; skipTime 24; [0,0.6] remoteExec ["setOvercast", -2, true]; 0 setRain 0; 0 setFog 0.1; forceWeatherChange; [1] remoteExec ["skipTime", -2, true]; [-1] remoteExec ["skipTime", -2, true]; 999999 setRain 0; 999999 setFog 0.1; 0 = [] spawn { sleep 0.1; simulWeatherSync; }; }; case 3: { skipTime -24; 86400 setOvercast 1; skipTime 24; [0,1] remoteExec ["setOvercast", -2, true]; 0 setRain 0.5; 0 setFog 0; forceWeatherChange; [1] remoteExec ["skipTime", -2, true]; [-1] remoteExec ["skipTime", -2, true]; 999999 setFog 0; 0 = [] spawn { sleep 0.1; simulWeatherSync; }; }; }; The above seems to work instantly for me. Haven't tested in dedicated.
-
The following code works, except for the music being played. No errors, just silence. What music plays is contingent upon if a player's side matches _winingside. I've tried not remote execing, same thing. // Display the ending message without background { private _playerSide = side _x; private _playerID = owner _x; // Get the player's ID if (_playerSide == _winningSide) then { titleText [_endingWinMessage, "PLAIN", -1, true, true]; // playMusic ["LeadTrack01_F_Bootcamp", 132]; ["LeadTrack01_F_Bootcamp", 132] remoteExec ["playMusic"]; } else { titleText [_endingLoseMessage, "PLAIN", -1, true, true]; //playMusic "BackgroundTrack03_F_EPC"; ["BackgroundTrack03_F_EPC"] remoteExec ["playMusic"]; }; } forEach allPlayers; Not sure where I am going wrong.
-
want script to not load until mission start screen of player looking through eyes (after mission intro map etc)
Northup replied to bendy303's topic in ARMA 3 - MISSION EDITING & SCRIPTING
waitUntil {getClientStateNumber == 10}; https://community.bistudio.com/wiki/getClientStateNumber -
RemoteExec a Function
Northup replied to FoxClubNiner's topic in ARMA 3 - MISSION EDITING & SCRIPTING
You can change how it is remoteExec'd. params remoteExec [order, targets, JIP] Params are the array of variables that are passed to the order. Order is the command or function name (the what) you want to execute. Target is the who. (optional). JIP is a boolean, so true/false (also optional). If true, a unique JIP ID is generated and the remoteExec statement is added to the JIP queue from which it will be executed for every JIP (player who joins while the mission is in progress). We want the who, so Target: 0: the order will be executed globally, i.e. on the server and every connected client, including the machine where remoteExec originated 2: the order will only be executed on the server - is both dedicated and hosted server. See for more info Other number: the order will be executed on the machine where clientOwner matches the given number Negative number: the effect is inverted: -2 means every client but not the server, -12 means the server and every client, except for the client where clientOwner returns 12. In the event that you only want it executed on players and not the server: ["end1", true , 3, true, true, true] remoteExec ["VN_fnc_endMission", -2]; If you wanted that to also apply to JIP: ["end1", true , 3, true, true, true] remoteExec ["VN_fnc_endMission", -2, true]; -
Anyone how to create KOTH server?
Northup replied to WhiteLotusxDD's topic in ARMA 3 - MISSION EDITING & SCRIPTING
You'd have to go to the discord for KOTH. Afaik, you're limited to a single provider at this point, as all legit KOTH servers are hosted by the same provider. You'll get access to something you can rcon into, but what you can do is heavily restricted. -
Full script: https://pastebin.com/knHsGNJs Thanks again!
-
I am trying to implement a safezone. Rules of safezone: Players who spawn inside safezone are invulnerable until they leave the safezone trigger. If they return there is a 10 second delay before they are invincible again. I managed to get that part working. // Create trigger centered on the safezone marker for vehicles _safezoneTriggerVehicle = createTrigger ["EmptyDetector", getPos _logic]; _triggerSize = [(_markerSize select 0), (_markerSize select 1), 0, false, 100]; _safezoneTriggerVehicle setTriggerArea _triggerSize; _safezoneTriggerVehicle setTriggerActivation ["ANY", "PRESENT", true]; _safezoneTriggerVehicle setTriggerStatements [ "this && {count (thisList select {alive _x && (_x isKindOf 'LandVehicle' || _x isKindOf 'Air')}) > 0}", " { if (_x isKindOf 'LandVehicle' || _x isKindOf 'Air') then { _x allowDamage false; hint format ['%1 is now invulnerable', _x]; }; } forEach (thisList select {alive _x && (_x isKindOf 'LandVehicle' || _x isKindOf 'Air')}); ", " { if (_x isKindOf 'LandVehicle' || _x isKindOf 'Air') then { _x allowDamage true; hint format ['%1 is now vulnerable', _x]; }; } forEach (thisList select {alive _x && (_x isKindOf 'LandVehicle' || _x isKindOf 'Air')}); " ]; However, I also need this to apply to players who get in vehicles, any vehicles spawned by the player (not yet implemented), as well as any vehicle being driven by a player. I've tried the following, but the vehicle and player don't become invincible again after reentering the trigger: // Create trigger centered on the safezone marker for vehicles _safezoneTriggerVehicle = createTrigger ["EmptyDetector", getPos _logic]; _triggerSize = [(_markerSize select 0), (_markerSize select 1), 0, false, 100]; _safezoneTriggerVehicle setTriggerArea _triggerSize; _safezoneTriggerVehicle setTriggerActivation ["ANY", "PRESENT", true]; _safezoneTriggerVehicle setTriggerStatements [ "this && {count (thisList select {alive _x && (_x isKindOf 'LandVehicle' || _x isKindOf 'Air')}) > 0}", " { if (_x isKindOf 'LandVehicle' || _x isKindOf 'Air') then { _x allowDamage false; hint format ['%1 is now invulnerable', _x]; }; } forEach (thisList select {alive _x && (_x isKindOf 'LandVehicle' || _x isKindOf 'Air')}); ", " { if (_x isKindOf 'LandVehicle' || _x isKindOf 'Air') then { _x allowDamage true; hint format ['%1 is now vulnerable', _x]; }; } forEach (thisList select {alive _x && (_x isKindOf 'LandVehicle' || _x isKindOf 'Air')}); " ]; I assume its something to do with the changing state of the player on the vehicle, but am not sure. I have combed through forums over the last 2 days, and all I find are old, generally outdated examples. Same with youtube. Any guidance would be appreicated: full script: https://pastebin.com/AExnxN2h
-
Works! Made some small changes, but it finally works. THANKS! BIS_endText = { private["_blocks","_block","_blockCount","_blockNr","_blockArray","_blockText","_blockTextF","_blockTextF_","_blockFormat","_formats","_inputData","_processedTextF","_char","_cursorBlinks"]; _blockCount = count _this; _invisCursor = "<t color ='#00000000' shadow = '0'>_</t>"; // Get screen center position using safezone private _safeZoneX = (safezoneX + safezoneW / 2); private _safeZoneY = (safezoneY + safezoneH / 2); // Process the input data _blocks = []; _formats = []; { _inputData = _x; _block = [_inputData, 0, "", [""]] call BIS_fnc_param; _format = [_inputData, 1, "<t align = 'center' shadow='1' size='2.0'>%1</t><br/>", [""]] call BIS_fnc_param; // Convert strings into array of chars _blockArray = toArray _block; { _blockArray set [_forEachIndex, toString [_x]] } forEach _blockArray; _blocks = _blocks + [_blockArray]; _formats = _formats + [_format]; } forEach _this; // Do the printing _processedTextF = ""; { _blockArray = _x; _blockNr = _forEachIndex; _blockFormat = _formats select _blockNr; _blockText = ""; _blockTextF = ""; _blockTextF_ = ""; { _char = _x; _blockText = _blockText + _char; _blockTextF = format[_blockFormat, _blockText + _invisCursor]; _blockTextF_ = format[_blockFormat, _blockText + "_"]; // Print the output at the center of the screen using safezone [(_processedTextF + _blockTextF_), 0, _safeZoneY, 35, 0, 0, 90] spawn BIS_fnc_dynamicText; playSoundUI ["a3\missions_f\data\sounds\click.wss", 0.25]; sleep 0.08; [(_processedTextF + _blockTextF), 0, _safeZoneY, 35, 0, 0, 90] spawn BIS_fnc_dynamicText; sleep 0.02; } forEach _blockArray; if (_blockNr + 1 < _blockCount) then { _cursorBlinks = 5; } else { _cursorBlinks = 15; }; for "_i" from 1 to _cursorBlinks do { [_processedTextF + _blockTextF_, 0, _safeZoneY, 35, 0, 0, 90] spawn BIS_fnc_dynamicText; sleep 0.08; [_processedTextF + _blockTextF, 0, _safeZoneY, 35, 0, 0, 90] spawn BIS_fnc_dynamicText; sleep 0.02; }; // Store finished block _processedTextF = _processedTextF + _blockTextF; // Do not clear the screen, to keep the text visible //["", _safeZoneX, _safeZoneY, 35, 0, 0, 90] spawn BIS_fnc_dynamicText; } forEach _blocks; }; // Example usage [ ["MISSION COMPLETE","<t align='center' shadow='1' size='2.0'>%1</t><br/>"] ] spawn BIS_endText; private _playerSide = side player; if (_playerSide == Winner) then { // Display win message with typewriter effect [ [WinMessage, "<t align='center' shadow='1' size='1.0'>%1</t><br/>"] ] spawn BIS_endText; playMusic ["LeadTrack01_F_Bootcamp", 132]; 0 fadeMusic 2; } else { // Display lose message with typewriter effect [ [LoseMessage, "<t align='center' shadow='1' size='1.0'>%1</t><br/>"] ] spawn BIS_endText; playMusic "BackgroundTrack03_F_EPC"; 0 fadeMusic 2; }; _start = diag_tickTime; [0, 1, true, false] call NUP_fnc_cinematicBorder; // Get the position of the NUP_endMissionCamera object private _cameraPos = getPos NUP_endMissionCamera; // Calculate starting and ending positions for the camera private _startPos = [ (_cameraPos select 0), // Same X position (_cameraPos select 1), // Same Y position (_cameraPos select 2) + 10 // 10 meters above ]; private _endPos = [ (_cameraPos select 0), // Same X position (_cameraPos select 1), // Same Y position (_cameraPos select 2) + 50 // 50 meters above (40 meters up during 30 seconds) ]; // Create the camera private _camera = "camera" camCreate _startPos; _camera cameraEffect ["internal", "back"]; _camera camSetTarget NUP_endMissionCamera; _camera camSetFOV 0.5; _camera camCommit 0; // Move the camera over 30 seconds _camera camSetPos _endPos; _camera camCommit 30; waitUntil { diag_tickTime - _start >= 25 }; 5 fadeMusic 0; // Wait until the camera has finished its trajectory waitUntil { camCommitted _camera }; // Terminate the camera effect and destroy the camera //_camera cameraEffect ["terminate", "back"]; //camDestroy _camera; // Force all players back to the lobby after the outro endMission "end"; Edit: A separate script appears to not be necessary. By storing the above in a local variable in the actual endMission function, (_NUP_endSequence), I can then spawn that via remoteExec. So far, seems to work! "_NUP_endSequence" remoteExec ["spawn", 0]; // remoteExec to every player locally
-
I haven't bothered testing singleplayer. Perhaps it's how I am testing? I know there's a way to test as if it were dedicated server, however for the time being I've been testing in a local server environment. Mission is intended to be ran on dedi, but can run local host. Just PVP, no AI. Only mods are 3den Enhanced, CompoT_dev and 3DEN Create as Simple Object. None create any dependencies for players. Edit: I hadn't tried testing it that way, only by executing the gameplay loop. When doing it with console, not only do I NOT hear music, but the environmental sounds (rain, etc) stop, and this cascades into the next loading of the mission: i.e., no music OR environmental effects. Very weird!
-
No change. Mission file is below. For now, keeping everything in fn_endMission. https://drive.google.com/file/d/1_4kvOg5A8Bj3XzzvSBeYdB1OM5Khq6Mp/view?usp=sharing