Jump to content

Bellicosity

Member
  • Content Count

    40
  • Joined

  • Last visited

  • Medals

Posts posted by Bellicosity


  1. I used this code to drop an ammo crate from a plane via an action, Im sure you can adapt it to do it at a preset time

    _gen = _this select 0;
    _caller = _this select 1;
    _id = _this select 2;
    
    
    
    _ammoBox = "USVehicleBox" createVehicle [0,0,0];
    _parachute = "ParachuteMediumWest" createVehicle getPos _gen;
    
    _vector = velocity _gen;
    _vectorLength = (sqrt (((_vector select 0) * (_vector select 0)) + ((_vector select 1) * (_vector select 1))));
    _unitVector = [(_vector select 0) / _vectorLength, (_vector select 1) / _vectorLength, (_vector select 2) / _vectorLength];
    
    _parachute setPos [(getPos _gen select 0) - (10 * (_unitVector select 0)),(getPos _gen select 1) - (10 * (_unitVector select 1)), (getPos _gen select 2) - (10 * (_unitVector select 2))];
    
    _parachute setVelocity (velocity _gen);
    
    sleep 0.1;
    
    _ammoBox attachTo [_parachute, [0,0,0]];
    
    waitUntil { getPos _parachute select 2 < 6 };
    
    detach _ammoBox;
    
    _ammoBox setPos [getPos _ammoBox select 0, getPos _ammoBox select 1, 0];
    
    sleep 5;
    
    deleteVehicle _parachute;
    


  2. Looking at that code you posted previously... there is a lot of undefined variables. It'd really help reading your code if you put

    _blah = _this select 4

    and used that through out your code (obviously changing blah to something descriptive).

    Im going about trying to mimic the results of that code in a different manner but have came across a hiccup... need the typeOf for every russian soldier. "Man" gets every soldier, anyone know what will return only russian soldiers?


  3. I think you're splitting hairs if the check in the waitUntil is a relatively easy operation

    I'd imagine that a sleep has the game checking every frame if time > (oldTime + sleepTime) then going its merry way whereas a waitUntil of someBool == someOtherBool or a waitUntil of someNumber < anotherNumber is going to be doing the same damn thing (as sleeping) every frame.


  4. Save the a10's into an array, something like this (NOT TESTED):

    if (isServer) then
    {
    count = 0;
    while { count < 5 } do
    {
    	A10s = [];
    	_grp = createGroup west;
    	_wp = _grp addWaypoint [getPos Armor1, 0];
    	[_grp, 0] setWaypointType "SAD";
    	[_grp, 0] setWaypointCompletionRadius 200;
    	for [{_x = 0}, {_x <= 2}, {_x = _x + 1}] do
    	{
    		_a10 = "A10" createVehicle [(getMarkerPos "PlaneSpawn" select 0), (getMarkerPos "PlaneSpawn" select 1), 250];
    		_a10 setPos [(getPos _a10 select 0) + (_x * 40), getPos _a10 select 1, 250];
    		_a10 engineOn true;
    		_a10 setDir 290;
    		_dir = 290;
    		_speed = 500;
    		_a10 setVelocity [(sin _dir * _speed),(cos _dir * _speed), 0];
    
    		"USMC_Soldier_Pilot" createUnit [getMarkerPos "PlaneSpawn", _grp];
    		(units _grp select _x) moveInDriver _a10;
    		(units _grp select _x) setSkill 1;
    		(units _grp select _x) flyInHeight 250;
    
    		A10s = A10s + [_a10];			
    	};
    
    	waitUntil { {alive _x } count A10s == 0 };
    	count = count + 1;
    };
    };
    


  5. here is the code I used in an older mission to spawn 3 flying a10's

    _grp = createGroup west;
    _wp = _grp addWaypoint [getPos Armor1, 0];
    [_grp, 0] setWaypointType "SAD";
    [_grp, 0] setWaypointCompletionRadius 200;
    for [{_x = 0}, {_x <= 2}, {_x = _x + 1}] do
    {
    	_a10 = "A10" createVehicle [(getMarkerPos "PlaneSpawn" select 0), (getMarkerPos "PlaneSpawn" select 1), 250];
    	_a10 setPos [(getPos _a10 select 0) + (_x * 40), getPos _a10 select 1, 250];
    	_a10 engineOn true;
    	_a10 setDir 290;
    	_dir = 290;
    	_speed = 500;
    	_a10 setVelocity [(sin _dir * _speed),(cos _dir * _speed), 0];
    
    	"USMC_Soldier_Pilot" createUnit [getMarkerPos "PlaneSpawn", _grp];
    	(units _grp select _x) moveInDriver _a10;
    	(units _grp select _x) setSkill 1;
    	(units _grp select _x) flyInHeight 250;
    };
    

    Been tested and works

    If someone wants to clean it up from the magic numbers and add parameters to it for a sqf function like, be my guest.


  6. It took me some time to figure out what was causing this so I hope this post will help someone in the future. Every SECOND time I would preview a certain mission ARMA2 would crash on me. I deleted portions of the mission at a time trying to narrow down what was causing it.

    I finally found it. It was a game logic with a deleteCollection being ran on a nearby static object. It worked the first preview through but the second one crashed the game.

    Very annoying to say the least. Hope someone else doesnt spend a chunk of their time trying to figure out the same thing.

×