Jump to content

MulleDK19

Member
  • Content Count

    430
  • Joined

  • Last visited

  • Medals

Everything posted by MulleDK19

  1. Your problem is that you're passing the value of pg_globalName (an object) to the getVariable command instead of the name of the variable. you need missionNamespace getVariable "pg_globalName"; Also, regular assignment uses the mission namespace, so pg_globalName = _unit; and pg_globalName enableAI "MOVE"; will do. And if you need to just detect the distance in a circle, it's easier to just script it yourself, instead of relying on a trigger.
  2. http://treesoft.dk/arma3/downloads/PlaneInterceptHelicopter.Altis.zip Copy interceptByPlanes.sqf and interceptByPlane.sqf into your mission folder. Then name the choppers, eg. chopper1 and chopper2. Then when you want them shot down use the following code: [[chopper1, chopper2], 2] execVM "interceptByPlanes.sqf; The script will automatically spawn 2 planes who will shoot down the choppers within a few seconds.
  3. "FullAuto" is not a valid fire mode for that weapon. For that specific weapon, the valid firemodes are: "manual", "close", "short", "medium", "far_optic1" and "far_optic2".
  4. MulleDK19

    getpos player in multiplayer

    The player command returns the local player.
  5. Like I told you on IRC yesterday, I already made a script for you. http://treesoft.dk/temp/Recording60.mp4
  6. MulleDK19

    Supply Drop script

    Depends on what you need. Actual plane/helicopter, or just an ammo crate spawning mid-air with a parachute.
  7. To delete a sound, play it on an object you can delete. Eg. attach an invisible helipad to the vehicle, and play the sound on that. Then if you delete the invisible helipad, the sound will be stopped too.
  8. Unlike the stable build, the dev build is unstable. That is, from time to time, it'll get updates that break some things, or even the entire game.
  9. Already made my function. It works wonderfully. simply [ai, "SmokeShell"] call MTP_fnc_throwGrenade; and the AI throws. Now I just need to spend a few more minutes to make it throw sub types if the unit doesn't have the specified type.
  10. Yup, that works, thanks! Though, it seems kinda stupid to me that magazinesDetail returns an array of strings. Why was it not made to return an array of arrays? It hurts my head just thinking about having to parse the strings in SQF just to get the ids. Not to mention the fact that the command returns the display name, not the class name. Hmpf. I'm gonna make myself a throwGrenade function. Something a la [player, "SmokeShellGreen"] call MTP_fnc_throwGrenade;
  11. The simplest way to get FIA on independent, is by creating an independent unit, set his "Probability of presence" to 0, then group FIA units to him. This will make the FIA units independent as they're added to a group of the independent side, while the "Probability of presence" will make sure the actual independent unit you placed as leader won't spawn. (Making the first grouped FIA unit leader).
  12. Use assignAsDriver, then use lock on the vehicle with parameter as 3. That'll prevent the player from entering anything but the driver seat.
  13. MulleDK19

    (MP) issues ARMA3 v. 1.6

    The IDs change every time the map is altered. Don't rely on IDs in your missions.
  14. No, you run that script once. You put the names of all the units in the _blockInventoryObjects array instead of ammo_crate1. So if you have ammo1, ammo2 and ammo3 you change the line to _blockInventoryObjects = [ammo1, ammo2, ammo3];
  15. How does that even make sense?
  16. while { true } do { _gear = findDisplay 602; if (!isNull _gear) then { closeDialog 602; }; sleep 0.1; }; Though, keep in mind that this will prevent the inventory all together. I'll try to work out something. EDIT: Okay, I couldn't find neither a command to detect when the inventory opens nor a variable containing the object the inventory is open for, so I made this script that blocks the inventory completely, but only when close to specific objects. Simply put all the ammo boxes you wanna block the inventory for in the BlockInventoryObjects array, instead of ammo_crate1. disableSerialization; _blockInventoryObjects = [ammo_crate1]; while { true } do { _blockInventory = false; { _distance = player distance _x; if (_distance < 2) exitWith { _blockInventory = true }; } forEach _blockInventoryObjects; if (_blockInventory) then { _gear = findDisplay 602; if (!isNull _gear) then { closeDialog 602; }; }; sleep 0.1; };
  17. No ranking changes required. This will make the switched unit the leader of the group he switches to (Including if he switches to a unit in the same group he's already in). onTeamSwitch { group _to selectLeader _to };
  18. I don't see the code where you include the .hpp file.
  19. Whoops, my bad. Fixed. This should do the trick: { if (!(_x isKindOf "Ship")) then { _x addEventHandler ["Killed", {(_this select 0) execVM "some_script.sqf";}]; }; } forEach vehicles;
  20. { _x addEventHandler ["Killed", {(_this select 0) execVM "some_script.sqf";}]; } forEach vehicles; Will execute some_script.sqf with _this being the killed vehicle. Eg. some_script.sqf: private ["_vehicle"]; _vehicle = _this; hint format ["Vehicle %1 was destroyed", _vehicle];
  21. I use them for debugging. Eg. I have a function I can call to mark all triggers, markers. etc. visually in the world. (It'll put a down arrow at the center of markers and triggers, and visualize the trigger radius with the arrows going around in a circle). They're used for whatever purpose you see fit.
  22. I was bored. // Variables prefixed with CS to avoid name clashes (CS = Civilian Spawner). CS_CivilianTypes = []; // Array containing all the possible types of civilians that will be used for spawning. This will be filled dynamically from the config files by the code below. CS_SpawnedCivilians = []; // An array containing all the civilians that have have been spawned by us. ////////// // Fill CS_CivilianTypes from config // Make the local variables private. private ["_civilianSide", "_cfgVehiclesConfig", "_cfgVehiclesConfigCount" ,"_config", "_isMan", "_sideIndex"]; _civilianSide = 3; // The civilian side index. _cfgVehiclesConfig = configFile >> "CfgVehicles"; // Get the CfgVehicles config. _cfgVehiclesConfigCount = count _cfgVehiclesConfig; // Count how many entries there are in CfgVehicles. for [{_i = 0}, {_i < _cfgVehiclesConfigCount}, {_i = _i + 1}] do { _config = _cfgVehiclesConfig select _i; // Get the vehicle at the current index. // We only want classes. if (isClass _config) then { _isMan = getNumber (_config >> "isMan"); // Get the value of the isMan property. // If it ain't zero, this is a man (soldier or civilian). if (_isMan != 0) then { _sideIndex = getNumber (_config >> "side"); // Get the index of the side the man belongs to. // If the man is on the civilian side, add him to CS_CivilianTypes. if (_sideIndex == _civilianSide) then { CS_CivilianTypes set [count CS_CivilianTypes, configName _config]; } } }; }; // Fill CS_CivilianTypes from config ////////// /** * Function to get a random element from the CS_CivilianTypes array. * * Parameters: * None. * * Returns: * string: the element retrieved from the CS_CivilianTypes array. * * Example: * // Prints 30 random civilians in a hint. * _text = "Civilian types:"; * for [{_i = 0}, {_i < 30}, {_i = _i + 1}] do * { * _text = format ["%1\n%2", _text, call CS_fnc_getRandomCivilianType]; * }; * * hint _text; **/ CS_fnc_getRandomCivilianType = { CS_CivilianTypes select (floor random count CS_CivilianTypes); }; /** * Spawns the specified amount of civilians at the "civilians_spawn_point" marker. * * Parameters: * _this: the number of civilians to spawn at the marker. * * Returns: * Nothing. * * Example: * 10 call CS_fnc_spawnCivilians; // Spawns 10 civilians at the "civilians_spawn_point" marker. **/ CS_fnc_spawnCivilians = { // Make the local variables private. private ["_amountToSpawn", "_spawnPosition", "_civilianGroup", "_civilianType", "_civilian"]; // Get the number of civilians to spawn from the parameter passed to this function. _amountToSpawn = _this; // Get the position to spawn them at. _spawnPosition = getMarkerPos "civilians_spawn_point"; // Create a group for the civilians. _civilianGroup = createGroup civilian; // Repeat _amountToSpawn times. for [{_i = 0}, {_i < _amountToSpawn}, {_i = _i + 1}] do { // Pick a random civilian type from the CS_CivilianTypes array. _civilianType = call CS_fnc_getRandomCivilianType; // Spawn the civilian as part of the created group, at the spawn position. _civilian = _civilianGroup createUnit [_civilianType, _spawnPosition, [], 0, "NONE"]; // Make the civilian stop moving. doStop _civilian; // Add the spawned civilian to the CS_SpawnedCivilians array. CS_SpawnedCivilians set [count CS_SpawnedCivilians, _civilian]; }; }; /** * Removes all civilians spawned by the CS_fnc_spawnCivilians function. * * Parameters: * None. * * Returns: * Nothing. * * Example: * call CS_fnc_removeAllCivilians; **/ CS_fnc_removeAllCivilians = { // Iterate each spawned civilian. { // Delete the iterated civilian. deleteVehicle _x; } forEach CS_SpawnedCivilians; // Clear the array. CS_SpawnedCivilians = []; }; // Add some actions to the laptop to allow spawning and removing civilians. laptop addAction ["Spawn 10 civilians", { 10 call CS_fnc_spawnCivilians; }]; laptop addAction ["Spawn 20 civilians", { 20 call CS_fnc_spawnCivilians; }]; laptop addAction ["Spawn 30 civilians", { 30 call CS_fnc_spawnCivilians; }]; laptop addAction ["Remove civilians", { call CS_fnc_removeAllCivilians; }];
  23. MulleDK19

    How to rearm UAVs

    uav setVehicleAmmo 1
  24. Works fine for me. Priority is commanded, setUnitPos, setUnitPosWeak.
  25. MulleDK19

    Orbital Strike help

    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
×