Search the Community
Showing results for tags 'mission scripting'.
Found 5 results
-
Error 0 elements provided, 3 expected
Questioning posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Howdy! I've made a function for an Ai commander that I'm working on that checks all of the Blufor groups + vehicles and categorizes them into four categories: "Car", "Car Armed", "Infantry" and "Infantry AT." The problem occurs in the debug section (> Line 45) where I'm trying place a marker on all of the groups to represent their category. It works when I'm marking less than ~5 groups, but when I try to mark more I get the error: "0 elements provided, 3 expected." The issue is with line 47 (commented "Our problem child"). Thank you! Here is the code: // This is the script/function that determines the types of units a commander has. fnc_unitTypeCheck = { params ["_side", "_position"]; _comPos = getMarkerPos _position; _availableGroups = groups _side; //All units/vehicles near _comPos. _availableVehicles = _comPos nearEntities ["Car", 150]; _cars = []; _armedCars = []; { if(typeOf _x in carSet) then {_cars pushBack _x; _availableVehicles = _availableVehicles - [_x]}; } forEach _availableVehicles; //Finds all cars { if(typeOf _x in armedCarSet) then {_armedCars pushBack _x; _availableVehicles = _availableVehicles - [_x]}; } forEach _availableVehicles; //Finds all armed cars _infantryATGroups = []; //[west, "HQ"] sideChat "All groups: " + str(_availableGroups); //Checks unit in blufor to see if they have an AT launcher. If they do the group is marked as AT capable and added to the Infantry AT group. (Checks for AT infantry) { _groupATCount = 0; _currentGroup = _x; { { if((_x in ATLauncherSet) && (_groupATCount == 0)) exitWith {_infantryATGroups pushBack _currentGroup; _groupATCount = _groupATCount + 1; _availableGroups = (_availableGroups - [_currentGroup]);}; } forEach weapons _x; } forEach units _x; } forEach _availableGroups; _infantryGroups = _availableGroups; // Initilized after infantry AT groups - sets the infantry groups to the _available groups. (Only groups that are available still are infantry groups) //Debug -- Issue is here { _mkr = createMarker ["InfantrySquad " + str(_forEachIndex + 1), _x]; //Our problem child _mkr setMarkerShape "ICON"; _mkr setMarkerType "mil_dot"; _mkr setMarkerColor "ColorBlack"; _mkr setMarkerText "InfSquad " + str(_forEachIndex); } forEach _infantryGroups; //Creates a marker identifying every infantry group { _mkr = createMarker ["ATSquad " + str(_forEachIndex), _x]; _mkr setMarkerShape "ICON"; _mkr setMarkerType "mil_dot"; _mkr setMarkerColor "ColorOrange"; _mkr setMarkerText "ATSquad " + str(_forEachIndex + 1); } forEach _infantryATGroups; //Creates a marker identifying every infantry AT group { _mkr = createMarker ["car " + str(_forEachIndex), _x]; _mkr setMarkerShape "ICON"; _mkr setMarkerType "mil_dot"; _mkr setMarkerColor "ColorGrey"; _mkr setMarkerText "Car " + str(_forEachIndex + 1); } forEach _cars; // etc. { _mkr = createMarker ["armedCar " + str(_forEachIndex), _x]; _mkr setMarkerShape "ICON"; _mkr setMarkerType "mil_dot"; _mkr setMarkerColor "colorRed"; _mkr setMarkerText "Armed Car " + str(_forEachIndex + 1); } forEach _armedCars; }; -
[SOLVED] Weird interactions between script and attachto
cooked auto posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I'm working on a mission where the player has to intercept a motorcade of three cars in order to capture an HVT. But an odd interaction between the method I use to disable the engine and the convoy script I'm using is causing some frustration. So in order to intercept the vehicles in the convoy, the players have to disable the engine of either the lead car, or the car carrying th HVT. The way I accomplished this was to attachto a balloon to the hood to the car that is tied to a trigger that will disable the engine once shot. (The Balloons later hidden by removing their textures while they're still considered there.) That works without issue. The motorcade itself uses Tova's Simple Convoy Script to get from point A to B. That works without issue. In this case using the line "convoyScript = [group this, 70, 20, false] spawn TOV_fnc_SimpleConvoy;" on the lead vehicle to call the script. In this case following the video tutorial found in the thread. The script itself present in the mission in a game logic file. But the problem arises when I combine these two parts. When I add a variable name to the cars for the attachto, the convoy script doesn't want to fire. The cars reverting back to the way the AI usually drives, ie poorly. Adding the cars variable name to the group doesn't work, neither does giving the group a variable name and using that. The thread for the script has another way of implementing the script, but using that doesn't seem to do much other than the AI marking off all the waypoints as completed without moving from the spot during testing. Even when trying on a LAN server I get a similar results. So what am I missing in this case? As far as I can deduce it out has something to do with how the convoy script is called, and how it doesn't seem to like the cars in it having names. I don't think I can use the attachto without using a variable name for the cars.- 9 replies
-
- mission scripting
- convoy mission
-
(and 1 more)
Tagged with:
-
Strange problem with GET IN waypoint condition.
KordaKolm97 posted a topic in OFP : MISSION EDITING & SCRIPTING
So I have a waypoint that gets activated by a trigger, where the units get in a T72. Unfortunatley, the units will go stand next to the T72, but wont get in it. By removing the condition field back to true, it all works fine. I have tried hours to see how could i fix this issue and now i really do not know what is up with that trigger. -
help Scripts not executing properly. Mods: (ACE, ALiVE, VCOM AI (script), RHS, MCC)
kohara_02 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Good day, I am currently at a dead end of the MP mission I am trying to create for my unit, solely with ALiVE modules, I don't really use any MCC features but just wanted to leave it loaded in case I need to create a scenario while the mission is running. I wanted to add specific vehicle cargo (custom loadout) in a medevac vehicle(RHS Asset), such as ace medical items. So our medics can replenish their inventory from the vehicle. I did this by adding this in the vehicle's init field: In addition I also added scripts on some vehicles and units init field to assign as ALiVE Combat Support so that ALiVE would work with VCOM accordingly, I followed this steps from ALiVE's FAQ site. I followed what's in the red box: But when I start the mission, the mission loads twice and respawns the vehicles rendering all the scripts I've put useless. I can't figure out how to stop the vehicles from respawning when the mission loads the second time or to have the script run at a specific time so it would execute once the mission finishes loading "Completely". Here's a 5 min. video to show what I am trying to do. https://youtu.be/3nxOfavKnBY TIA! PS: I don't know how to title this since I'm not exactly sure what's happening to name it properly. So my apologies if it's misleading. -
solution Multi-line Text in drawIcon3D
Whalenator posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I've been struggling for some time to create a nametag script that could: - use drawIcon3D to place the tags over players (like F3) instead of center screen (like ST) - have multiple lines of text for player roles, group names, etc - display these multiple lines (in 3D) as if they were one big sprite (psuedo-2D) ( Pictures available here ) drawIcon3D does not support structured text. It does not support text over multiple lines, or with a different justification, or any of that. You can render an icon, and you can render some text. That icon and text will always face you, and will appear the same size no matter the distance between your player and the drawIcon3D's position, but if you want to display multiple lines of text stacked upon each other you were out of luck. I was out of luck. I tried a few things. My original solution was to use the easy method (modelToWorld[0,0,0] + height for stance, +/- static Z-level spacing between tags) F3 uses, but to dynamically change the spacing between 3D icons on-screen depending on player FOV and distance to target. As you moved closer or further, the tags would space out or scrunch up in 3D accordingly. The problem? That solution only changed the Z levels of the tags, meaning that if I looked down on the tags from above (or up from below, or really any angle other than flat horizontal) the visual spacing would decrease until they appeared to overlap each other. The next attempt adjusted the spacing by first converting the world coordinates to screen coordinates (worldToScreen), adjusting those screen coordinates with a fixed Y spacing, and then converting them back into world coordinates before displaying them (screenToWorld). It worked, for the most part. Tags viewed from above would be spaced out perfectly. The problem here was twofold: first, screenToWorld gets the world position (going through models and buildings) at the screen position given, even if that world position is kilometers away. The drawIcon3D text looks the same size at any distance, of course, but this lead into a bigger problem -- If you were looking at someone and there was no "world" behind them (ie: just a sky) then screenToWorld would be unable to find a world position, and the tag would not appear. I had no idea what to do at this point and repeatedly turned to the Arma 3 Discord for help. A lot of people offered advice for which I am very grateful, but I am especially thankful towards cptnnick for helping me work through a solution to the dynamic spacing problem using orthogonal vectors and vector cross products. The solution is available in simplified form in my (unreleased, beta) nametag script, but a more expanded (and easily explained) process is this commented demonstration code graciously provided by cptnnick: comment "Setup. Not part of dynamic spacing solution."; removeMissionEventHandler ["Draw3D",missionNamespace getVariable ["drawHandler",-1]]; drawHandler = addMissionEventHandler ["Draw3D", { comment "Get the target object and player."; _target = cursorObject; _player = player; comment "Get the position of the player's camera and the middle of the target's body."; _targetPosition = _target modelToWorldVisual[0,0,1.3]; _playerPosition = positionCameraToWorld[0,0,0]; comment "Calculate the distance from target to player."; _distance = _targetPosition distance _playerPosition; comment "Get the player's current zoom level. Google 'Killzone Kid Get Zoom.'"; _fov = call wh_nt_fnc_getZoom; comment "Get the vector from target to player (GREEN LINE)."; _dir = _targetPosition vectorDiff _playerPosition; comment "NEW: vectorDir _player doesn't work when the player is using freelook."; comment "To get the vectorDir of the player's camera instead of his body, do this:"; _playerDir = _playerPosition vectorFromTo positionCameraToWorld[0,0,1]; comment "Get a vector orthogonal to the player's orientation (RED LINE)."; _cross = (_playerDir) vectorCrossProduct (vectorUp _player); comment "Get the relative "UP" direction of the target model (PURPLE LINE)."; _drawUpNormal = vectorNormalized (_cross vectorCrossProduct _dir); comment "Multiply the direction by how far we want the text spaced."; _drawUp = _drawUpNormal vectorMultiply (0.1 * _distance / _fov); comment "Flip it for down."; _drawDown = _drawUp vectorMultiply -1; _drawPosUp = _targetPosition vectorAdd _drawUp; _drawPosDown=_targetPosition vectorAdd _drawDown; comment "Render some cool drawIcon3D stuff with your new, dynamically-spaced positions."; drawLine3D [_targetPosition, _drawPosUp, [1,0,0,1]]; drawLine3D [_targetPosition, _playerPosition, [0,1,0,1]]; drawLine3D [_targetPosition, _targetPosition vectorAdd _cross, [0,0,1,1]]; drawIcon3D ["", [1,1,1,1], _drawPosUp, 0, 0, 0, "TOP", 2, 0.04, "RobotoCondensed"]; drawIcon3D ["", [1,1,1,1], _targetPosition, 0, 0, 0, "MIDDLE", 2, 0.04, "RobotoCondensed"]; drawIcon3D ["", [1,1,1,1], _drawPosDown, 0, 0, 0, "BOTTOM", 2, 0.04, "RobotoCondensed"]; }];- 2 replies
-
- 3
-
- drawicon3d
- nametags
-
(and 4 more)
Tagged with: