TGxAltair 10 Posted November 13, 2013 'Ello ARMA I need some help on my orbital strike script, please. So far I have: hint "Orbital strike inbound on designated location. Satellite aligning, stand by for ordnance. Tubes activated, countdown initiated. Atmospheric GBU12 has been released. Keep target designated to guide in package. Arming height of first package: 50m."; sleep 15; missile = "M_NLAW_AT_F" createVehicle [(getmarkerPos "Strike1" select 0),(getmarkerPos "Strike1" select 1), 50]; sleep 5; hint "Secondary package entering the atmosphere. Keep target designated for guidance, atmospheric GBU12 en route to target. Arming height: 100m."; sleep 10; missile = "M_NLAW_AT_F" createVehicle [(getmarkerPos "Strike2" select 0),(getmarkerPos "Strike2" select 1), 50]; sleep 5; hint "Final package entering the atmosphere. Keep target designated for guidance, atmospheric GBU12 en route to target. Arming height: 500m."; sleep 10; missile = "M_NLAW_AT_F" createVehicle [(getmarkerPos "Strike3" select 0),(getmarkerPos "Strike3" select 1), 50]; hint "Ordnance delivered. Satellite standing down. Reloading tubes and checking sight alignment."; This spawns three missiles at my designated markers, my only problem is that they don't go down, they fire straight in mid air. Is there a way to set a target or change their direction to down? I've tried SetDir but it only turns them. Cheers in advance Altair Share this post Link to post Share on other sites
lappihuan 178 Posted November 13, 2013 missile setVectorUp [0,0,-1]; should set your missile downside :) more infos on that command here Share this post Link to post Share on other sites
TGxAltair 10 Posted November 13, 2013 Where abouts should I place that? Cheers for getting back to me. Share this post Link to post Share on other sites
lappihuan 178 Posted November 13, 2013 directly after the createVehicle line. something like that: ... missile = "M_NLAW_AT_F" createVehicle [(getmarkerPos "Strike1" select 0),(getmarkerPos "Strike1" select 1), 50]; missile setVectorUp [0,0,-1]; ... not tested, so it may don't work as i expected. Share this post Link to post Share on other sites
TGxAltair 10 Posted November 13, 2013 Thanks for the reply. It still goes straight forward, I've also tried: missile = "M_NLAW_AT_F" createVehicle [(getmarkerPos "Strike1" select 0),(getmarkerPos "Strike1" select 1), 50,missile setVectorUp [0,0,-1];] But it doesn't work. Really appreciate the help. Share this post Link to post Share on other sites
lappihuan 178 Posted November 13, 2013 well is the problem that the missile dont fly as launched out of a launcher or is the vector wrong? Share this post Link to post Share on other sites
TGxAltair 10 Posted November 13, 2013 The missile spawns in mid-air and flies directly forwards rather than going down. I can't seem to place the setVectorUp line in the right place to get it to take notice and change direction. Share this post Link to post Share on other sites
lappihuan 178 Posted November 13, 2013 Ok, then maybe are the values wrong i gave you... (they make a house upsidedown) but since the missile don't point up as default the values just inverted it but it still flyes straight. (i think this is may confusing, i can't explain it better due lack of english knowledge ^^ ) w/e lets try to make the values do what you want. you can try it with: missile setVectorUp [0,0,-0.5]; just to see what changes. Share this post Link to post Share on other sites
TGxAltair 10 Posted November 13, 2013 Sadly it still doesn't work :( Share this post Link to post Share on other sites
lappihuan 178 Posted November 13, 2013 you could send me a MP with the whole script so i can take a look at it. Share this post Link to post Share on other sites
Larrow 2822 Posted November 13, 2013 It needs the direction and up vectors calculated on it. You could use the command setVectorDirandUp although i find working with this command a PIA. Try the function BIS_fnc_setPitchBank instead which i find a little easier to get what you need out of it and does all the calculations for you. [missile, -90, 0] call bis_fnc_setPitchBank; Header from setPitchBank function. /************************************************************ Set Pitch and Bank By Andrew Barron Parameters: [object, pitch, bank] Returns: nothing Rotates an object, giving it the specified pitch and bank, in degrees. Pitch is 0 when the object is level; 90 when pointing straight up; and -90 when pointing straight down. Bank is 0 when level; 90 when the object is rolled to the right, -90 when rolled to the left, and 180 when rolled upside down. Note that the object's yaw can be set with the setdir command, which should be issued before using this function, if required. The pitch/bank can be leveled out (set to 0) by using the setdir command. Example: [player, 45, -45] call BIS_fnc_setPitchBank ************************************************************/ Share this post Link to post Share on other sites
TGxAltair 10 Posted November 13, 2013 THANK YOU That works perfectly! Share this post Link to post Share on other sites
Mattar_Tharkari 10 Posted November 14, 2013 _missile = "M_NLAW_AT_F" createVehicle [(getmarkerPos "Strike1" select 0),(getmarkerPos "Strike1" select 1), 900]; _missile setVectorDirAndUp [[0,0,-1],[0,-1,0]]; whoops ninja'd Share this post Link to post Share on other sites
MulleDK19 21 Posted November 14, 2013 (edited) I just wrote a fully commented script just for you. This will fire missiles onto the target marker with some diversity in the spawn positions and target positions for each missile. private ["_numberOfMissiles", "_timeBetweenMissiles", "_spawnSpread", "_spawnHeight", "_targetSpread", "_spawnPosition", "_targetPosition", "_missile", "_missilePosition", "_direction"]; _numberOfMissiles = 10; // How many missiles to spawn. _timeBetweenMissiles = 0.25; // Time in seconds between each missile. _spawnSpread = 50; // The maximum distance from the spawn point missiles spawn. _spawnHeight = 250; // How high above the ground missiles spawn. _targetSpread = 10; // Maximum distance from the target point the missiles land. _missileTargetMarkerName = "missile_target"; // The name of the marker to hit. _missileType = "M_NLAW_AT_F"; // The type of the missile to use. // Loop the number of times we want to spawn a missile (_numberOfMissiles). for [{_i = 0}, {_i < _numberOfMissiles}, {_i = _i + 1}] do { // Get the position of the target marker and store it in _spawnPosition, so we can calculate the spawn position. _spawnPosition = getMarkerPos _missileTargetMarkerName; // Add some diversity to the spawn position on the X axis, by adding from -spread to +spread. (So if spread is 50, up to 50 will be added to X, or up to 50 will be subtracted from X). _spawnPosition set [0, (_spawnPosition select 0) - _spawnSpread + random (_spawnSpread * 2)]; // Add some diversity to the spawn position on the Y axis, by adding from -spread to +spread. (So if spread is 50, up to 50 will be added to Y, or up to 50 will be subtracted from Y). _spawnPosition set [1, (_spawnPosition select 1) - _spawnSpread + random (_spawnSpread * 2)]; // Set the height of the spawn position. _spawnPosition set [2, _spawnHeight]; // Get the position of the target marker. _targetPosition = getMarkerPos _missileTargetMarkerName; // Add some diversity to the target position on the X axis, by adding from -spread to +spread. (So if spread is 50, up to 50 will be added to X, or up to 50 will be subtracted from X). _targetPosition set [0, (_targetPosition select 0) - _targetSpread + random (_targetSpread * 2)]; // Add some diversity to the target position on the Y axis, by adding from -spread to +spread. (So if spread is 50, up to 50 will be added to Y, or up to 50 will be subtracted from Y). _targetPosition set [1, (_targetPosition select 1) - _targetSpread + random (_targetSpread * 2)]; // Markers are always placed at sea level (Z = 0), so we need to adjust the Z to be on top of the terrain where it's placed. // Otherwise, the missiles would not hit as they'd try to hit the water surface underneath the terrain. _targetPosition set [2, getTerrainHeightASL _targetPosition]; // Spawn the missile at the spawn position. _missile = _missileType createVehicle _spawnPosition; // Get the missiles position, as vehicles may not be spawned exactly at the position passed to createVehicle. So we get it here just to be sure we get the exact position, instead of just using _spawnPosition. _missilePosition = getPosASL _missile; // Get a vector that points from the missile position to the target position. _direction = [_missilePosition, _targetPosition] call BIS_fnc_vectorFromXToY; // Set the missile direction to that. _missile setVectorDirAndUp [_direction, [0, 1, 0]]; // We don't take the missile's drop into account, so set the velocity of the missile to 200m/s immediately, instead of waiting for the missile to "ignite" to lessen the drop. _missile setVelocity ([_direction, 200] call BIS_fnc_vectorMultiply); // Wait before we spawn the next missile. sleep _timeBetweenMissiles; }; Sample (Lots of missiles to visualize): http://img844.imageshack.us/img844/1728/s2g3.png Edited November 14, 2013 by MulleDK19 Share this post Link to post Share on other sites
TGxAltair 10 Posted December 11, 2013 Cheers for the help (: Share this post Link to post Share on other sites
legio4777 12 Posted December 11, 2013 I just wrote a fully commented script just for you.This will fire missiles onto the target marker with some diversity in the spawn positions and target positions for each missile. private ["_numberOfMissiles", "_timeBetweenMissiles", "_spawnSpread", "_spawnHeight", "_targetSpread", "_spawnPosition", "_targetPosition", "_missile", "_missilePosition", "_direction"]; _numberOfMissiles = 10; // How many missiles to spawn. _timeBetweenMissiles = 0.25; // Time in seconds between each missile. _spawnSpread = 50; // The maximum distance from the spawn point missiles spawn. _spawnHeight = 250; // How high above the ground missiles spawn. _targetSpread = 10; // Maximum distance from the target point the missiles land. _missileTargetMarkerName = "missile_target"; // The name of the marker to hit. _missileType = "M_NLAW_AT_F"; // The type of the missile to use. // Loop the number of times we want to spawn a missile (_numberOfMissiles). for [{_i = 0}, {_i < _numberOfMissiles}, {_i = _i + 1}] do { // Get the position of the target marker and store it in _spawnPosition, so we can calculate the spawn position. _spawnPosition = getMarkerPos _missileTargetMarkerName; // Add some diversity to the spawn position on the X axis, by adding from -spread to +spread. (So if spread is 50, up to 50 will be added to X, or up to 50 will be subtracted from X). _spawnPosition set [0, (_spawnPosition select 0) - _spawnSpread + random (_spawnSpread * 2)]; // Add some diversity to the spawn position on the Y axis, by adding from -spread to +spread. (So if spread is 50, up to 50 will be added to Y, or up to 50 will be subtracted from Y). _spawnPosition set [1, (_spawnPosition select 1) - _spawnSpread + random (_spawnSpread * 2)]; // Set the height of the spawn position. _spawnPosition set [2, _spawnHeight]; // Get the position of the target marker. _targetPosition = getMarkerPos _missileTargetMarkerName; // Add some diversity to the target position on the X axis, by adding from -spread to +spread. (So if spread is 50, up to 50 will be added to X, or up to 50 will be subtracted from X). _targetPosition set [0, (_targetPosition select 0) - _targetSpread + random (_targetSpread * 2)]; // Add some diversity to the target position on the Y axis, by adding from -spread to +spread. (So if spread is 50, up to 50 will be added to Y, or up to 50 will be subtracted from Y). _targetPosition set [1, (_targetPosition select 1) - _targetSpread + random (_targetSpread * 2)]; // Markers are always placed at sea level (Z = 0), so we need to adjust the Z to be on top of the terrain where it's placed. // Otherwise, the missiles would not hit as they'd try to hit the water surface underneath the terrain. _targetPosition set [2, getTerrainHeightASL _targetPosition]; // Spawn the missile at the spawn position. _missile = _missileType createVehicle _spawnPosition; // Get the missiles position, as vehicles may not be spawned exactly at the position passed to createVehicle. So we get it here just to be sure we get the exact position, instead of just using _spawnPosition. _missilePosition = getPosASL _missile; // Get a vector that points from the missile position to the target position. _direction = [_missilePosition, _targetPosition] call BIS_fnc_vectorFromXToY; // Set the missile direction to that. _missile setVectorDirAndUp [_direction, [0, 1, 0]]; // We don't take the missile's drop into account, so set the velocity of the missile to 200m/s immediately, instead of waiting for the missile to "ignite" to lessen the drop. _missile setVelocity ([_direction, 200] call BIS_fnc_vectorMultiply); // Wait before we spawn the next missile. sleep _timeBetweenMissiles; }; Sample (Lots of missiles to visualize): http://img844.imageshack.us/img844/1728/s2g3.png Hi Mulle do you have any missions to see how it works your script? Share this post Link to post Share on other sites
TGxAltair 10 Posted December 13, 2013 I used part of the script above to create the following: http://steamcommunity.com/sharedfiles/filedetails/?id=203179844&searchtext= Share this post Link to post Share on other sites
legio4777 12 Posted December 14, 2013 Ok. I will check it! Share this post Link to post Share on other sites
zgmrvn 95 Posted December 14, 2013 easyer than setVectorUp, you can use setPitchBank, values are in degrees: // object, pitch, bank [_missile, -180, 0] call BIS_fnc_setPitchBank; try this to force to move down the missile. _missile setVelocity [0, 0, -100]; Share this post Link to post Share on other sites