Jump to content

Mattar_Tharkari

Member
  • Content Count

    961
  • Joined

  • Last visited

  • Medals

Posts posted by Mattar_Tharkari


  1. http://community.bistudio.com/wiki/ctrlSetEventHandler

    (findDisplay 46) displayAddEventHandler ["keyDown", "if ((_this select 1) == ???) then {hint '??? key pressed';}"];

    You need to find the DIK code for the TAB key and put it in the above '???' - here:

    http://community.bistudio.com/wiki/DIK_KeyCodes

    then:

    (findDisplay 46) displayAddEventHandler ["keyDown", "if ((_this select 1) == ???) then {player PlayACTION 'amovpercmstpsnonwnondnon_amovpercmstpssurwnondnon'; player enablesimulation false;}"];
    (findDisplay 46) displayAddEventHandler ["keyUp", "if ((_this select 1) == ???) then {player enablesimulation true;}"];

    Are you sure it's wise to use the TAB key? Might be best to unbind one of the lesser used keys - eg diary and use that instead? You may need an additional condition to check the player isn't in a vehicle when this is used, if using TAB.


  2. //To get the atv in the right place in the chinook - you will need to add/subtract from each of the 3 elements below to get the exact position:
    _atv setposATL [getPosATL chinook select 0,(getPosATL chinook select 1)+1,getPosATL chinook select 2];
    
    //To get the heading to the rear of the chinook and ATV facing backwards is:
    _atv setDir ((getDir chinook) - 180);
    
    //To give the ATV forward velocity of 20m/sec, upward 1m/sec:
    _atv setVelocity [(sin (getDir _atv))*20, (cos (getDir _atv))*20, 1];

    I'm doing this with paratroopers out of a C130 and it works well (over 14 ish m/sec injures AI and players though!) - just got to get them into 2 parallel lines in the aircraft and get them to shuffle along to the back!


  3. Meditated a bit while watching Predators and it occurred to me that if you know the positions of the playableUnits and IEDS you can:

    -build 2 arrays of positions and compare 1 with the other - distance;

    -for each playableUnit you can locate the closest IED and get the direction to it - degrees;

        _dx = (_iedPos select 0) - (_manPos select 0);
         _dy = (_iedPos select 1) - (_manPos select 1);
           _dirTo = _dx atan2 _dy;
    if (_dirTo < 0) then {_dirTo = _dirTo + 360};

    -you can get the direction of the playableUnit and compare that with the above dirTo.

    All that gives you everything you need for the 2D - horizontal axis, to get everything you want, you of course need the vertical axis which takes you back to screenToWorld so can everything be done with this?:

    -screenToWorld will give you a position on the players screen

    -modelToScreen will give you the position of the IED on the players screen

    -distance can check if you are close enough

    -terrainIntersect and lineIntersects will check if the object is blocked by another object or the terrain.

    You also might need the safezone commands as some people have more than 1 monitor / different sizes and the screen area is different:

    http://community.bistudio.com/wiki/SafeZone

    To edit a safezone they recommend the User Interface Editor:

    http://community.bistudio.com/wiki/User_Interface_Editor_%28Arma_2%29


  4. What about the new aimPos and eyePos commands?

    Compare aimPos with getPosASL _myIED and beep if the [x,y,z] coords are withing a certain range of each other?

    Untested:

    _man = _this select 0;
    _ied = _this select 1;
    while {true} do{
    _a = aimPos _man;
    _b = getPosASL _ied;
    if (_a distance _b <= 10) then {hint "there's an ied where ur aiming!"};
    sleep 0.1;
    };
    

    http://community.bistudio.com/wiki/aimPos

    http://community.bistudio.com/wiki/eyePos - you could have IED detecting bionic eyes with this? lol

    edit: tested!

    No don't bother with those either - someone at BIS is having a joke with those? Seem to do the same thing as getPosASL player? You can walk / drive backwards to the ied and it sets off the hint WTF?


  5. Sorry didn't read your first post properly, it was late at night lol :).

    Another example if you want to not use processInitCommands (you can only use it once!)

    if (isServer) then {
        obj4 = createVehicle ["LandRover_ACR",getMarkerPos "marker4",[], 100, "NONE"] ;
        obj4  setDamage 0.7;
        obj4  setVehicleAmmo 0.5";
    };

    this setVehiclePosition [[], ["Pos1","Pos2","Pos3"], 0] - it's possible it doesn't like the empty [] - try:

    this setVehiclePosition [[getPosATL this], ["Pos1","Pos2","Pos3"], 0]

    4 random positions

    If you don't like scripting there is another way in the editor. group the vehicle to the markers.

    select group mode (F2), click on the vehicle, then draw a line connecting the vehicle to each marker.

    see chapter 1.9 of this:

    http://www.armaholic.com/page.php?id=4847


  6. Maybe this guy is right? Both sides are wrong?

    link: A Well-Regulated Militia:The Founding Fathers and the Origins of Gun Control in America:

    The Founding Fathers and the Origins of Gun Control in America (Google eBook)

    Americans are deeply divided over the Second Amendment. Some passionately assert that the Amendment protects an individual's right to own guns. Others, that it does no more than protect the right of states to maintain militias. Now, in the first and only comprehensive history of this bitter controversy, Saul Cornell proves conclusively that both sides are wrong.Cornell, a leading constitutional historian, shows that the Founders understood the right to bear arms as neither an individual nor a collective right, but as a civic right--an obligation citizens owed to the state to arm themselves so that they could participate in a well regulated militia. He shows how the modern "collective right" view of the Second Amendment, the one federal courts have accepted for over a hundred years, owes more to the Anti-Federalists than the Founders. Likewise, the modern "individual right" view emerged only in the nineteenth century.

  7. Yep aimedAtTarget is only for vehicle turrets/aircraft and doesn't seem to work on small objects or "man" targets. I got it to return on the toilet (yipee! :yay:), vehicle ammo box, H barrier cube, all vehicles, statics, military objects but not things like IEDS, signs, rucksacks, mines or buckets.

    Also it doesn't increse or decrease in a linear fashion - seems to jump from 0 - 0.9ish once you get the crosshairs roughly central.

    while {true} do {
    _Atarget = cursorTarget;
    _aimingQuality = player AimedAtTarget [_Atarget];
    hintSilent format["CT:%1|Aim:%2",_Atarget, _aimingQuality];
    sleep 0.1;
    };

    conclusion: It aint what you want :(


  8. I would have thought aimedAtTarget would be ideal for this? I've used it very successfully - the weapon string is optional did you try it without that 1st? eg:

    _aimingQuality = heli AimedAtTarget [target];

    with the above it should return with any weapon you point at the given target.

    Example of successful use here - the A10 kills everthing it points at:

    http://forums.bistudio.com/showthread.php?143761-A10-gun-run-script&p=2267304&viewfull=1#post2267304

    Relevant code from that script:

    while {alive _unit} do {
    _Atarget = assignedTarget _unit;
      _epos = getPosATL _Atarget;
        _aimingQuality = _unit AimedAtTarget [_Atarget];
    
    if (_aimingQuality >= 0.7) then {
     _pilot sidechat "Hog22: Attacking hostile vehicles - guns!";
       var_gunRuns = var_gunRuns +1;
    
    _Atarget say3D "A10rounds";
     _unit say3D "A10attack2";
    
    [_epos] call fnc_steelrain;
     sleep 6;
       };

    If you modify that loop with "if (_aimingQuality >= 0.7) then {" increments from 0.1 - 1 - beeping louder and faster each time, it should do it? Getting it to do it for a specific weapon might be tricky with the className but it should work.


  9. This anygood? Turns all opfor into suicide bombers if they get within 10m of any blufor but I'm sure you could adapt it to suit your needs? Change allUnits to playableUnits for MP?

    Adapted vigilante's post here: http://community.bistudio.com/wiki/nearestObjects

    //init.sqf: []execVM "suicidebomber.sqf";
    
    private ["_exclmArray","_exclm","_bomb","_fpos","_epos","_validNearestEnemy","_validNearestFriendlies"];
    while {true} do{
       _validNearestEnemy = [];
       {if (alive _x && side _x == EAST) then {_validNearestEnemy set [(count _validNearestEnemy),_x];};
    } foreach allUnits;
    
       _validNearestFriendlies = [];
       {if (alive _x && side _x == WEST) then {_validNearestFriendlies set [(count _validNearestFriendlies),_x];};
    } foreach allUnits;
    
    //player globalchat format ["E=%1",_validNearestEnemy];
    //player sidechat format ["F=%1",_validNearestFriendlies];
    
    for "_i" from 0 to (count _validNearestEnemy -1) do {
       _fpos = getPosATL (_validNearestFriendlies select floor(random (count _validNearestFriendlies)));
       _epos = getPosATL (_validNearestEnemy select _i);
         _foe = (_validNearestEnemy select _i);
    
    if (_epos distance _fpos <= 10 && vehicle _foe == _foe) then {
       _dx = (_fpos select 0) - (_epos select 0);
         _dy = (_fpos select 1) - (_epos select 1);
           _dir = _dx atan2 _dy;
    if (_dir < 0) then {_dir = _dir + 360};
    sleep 0.1;
    
    _foe setDir _dir;
     _foe switchmove "ActsPercMrunSlowWrflDf_FlipFlopPara";
       _foe setVelocity [(sin (getDir _foe))*10, (cos (getDir _foe))*10, 1];
    
    _exclmArray = ["Ahh fuck! Suicide bomber!","BB-IED! Suicide bomber!", "Get back! Suicide bombers!"];
     _exclm = _exclmArray select floor (random (count _exclmArray));
       player globalchat _exclm;
    
    sleep 0.1;
       _bomb = "R_57mm_HE" createVehicle _epos;
        };
      };
      sleep 1;
    };
    


  10. This latest patch for some reasons have been giving me major issues with LOD and blurry textures. Fed up, I purged my PC of everything Arma 2 related the other night, even manually dug up everything related in my registry.

    Cleanly re-installed Arma 2: CO and updated everything properly to 1.62, played for hours without issue. I set a system restore point for safety measures of reverting in the future and figuring out the origin of this problem through a process of elimination (figuring it must have been one of the mods I was using). I downloaded and install this patch via SixUpdater, jumped into a scenario and the annoying LOD/Blurry textures returned.

    I'm not sure what is necessarily wrong, all the tried and trusted tweaks to ArmA 2 that has been around for ages won't help the issue. My only solution is to revert back to 1.62 (95248). Textures have been set to Normal, High, Very High and Video Memory at Default, still occurs when playing. As I haven't been much involved with the community and ArmA for quite some time, I apologize if this isn't the proper place to address the problem I'm having with this particular patch.

    Sometimes this works:

    http://forums.bistudio.com/showthread.php?122102-ArmA-2-OA-Beta-Build-82604&p=1980550&viewfull=1#post1980550

    Shut down the game, delete these files in the Arma2 folders in "Documents", restart the game and files will be re-written:

    playerName.ArmA2OAProfile

    playerName.vars.ArmA2OAProfile

    ArmA2OA.cfg

    ArmA2.cfg


  11. I would have a look at the mission I posted in http://forums.bistudio.com/showthread.php?144053-How-to-attach-smoke-greande-Help!&p=2270506&viewfull=1#post2270506

    It generates a more realistic ammount of smoke and you don't need to turn it off - shell deletes itself after 3.5 seconds, but if you really want to use a smokeshell, try this

    init.sqf

    {if (_x isKindOf "Wheeled_APC" || _x isKindOf "Tank") then {
    _x addaction [("<t color=""#e6e600"">" + ("Smoke on") +"</t>"), "smokeshl.sqf","turnon", 1, false, true,"LaunchCM","isEngineOn _target && driver _target == _this"];};
    } forEach vehicles;
    
    {if (_x isKindOf "Wheeled_APC" || _x isKindOf "Tank") then {
    _x addaction [("<t color=""#e6e600"">" + ("Smoke off") +"</t>"), "smokeshl.sqf","turnoff", 1, false, true,"","isEngineOn _target && driver _target == _this"];};
    } forEach vehicles;

    smokeshl.sqf - turns on and off in same script depending on argument passed from addAction

    _vcl = _this select 0;
    _caller = _this select 1;
    _id = _this select 2;
    _arg = _this select 3;
    
    switch (_arg) do {
    case "turnon": {
    smokeCan = createVehicle ["SmokeShell", getPosATL _vcl, [], 0, "CAN_COLLIDE"];
    smokeCan attachto [_vcl, [0,-3,-0.5]];
    };
    case "turnoff": {
    detach smokeCan;
    deleteVehicle smokeCan;
    };
    };


  12. If you read what I said about that........you need something like this:

    http://community.bistudio.com/wiki/switch

    http://community.bistudio.com/wiki/Control_Structures

    _class = typeOf _vcl;
    switch (_class) do
    {case "M1A2_US_TUSK_MG_EP1":
       {
           _smoke attachto [_vcl, [0,-3,-0.5]];
       };
       case "MLRS_DES_EP1":
       {
           _smoke attachto [_vcl, [0,-3,-0.5]];
       };
    
       //etc etc for each type of tank where you need to change the position
    };


  13. Didn't think the smoke grenade had the volume to hide a tank? Just tested my script against some Takis with RPG's - it works - they can't see through the smoke.

    Mission reposted - accidentally put a : instead of a ; on 1 line.

    Something extra - launch smoke grenades option for the driver:

    init.sqf:

    {if (_x isKindOf "Wheeled_APC" || _x isKindOf "Tank") then {
    _x addaction [("<t color=""#ee6600"">" + ("Launch Smoke Grenades") +"</t>"), "smokenades.sqf","", 1, false, true,"","driver _target == _this"];};
    } forEach vehicles;

    smokenades.sqf

    _vcl = _this select 0;
    _caller = _this select 1;
    _id = _this select 2;
    
    [_vcl,4.0,120,false,false] spawn BIS_Effects_SmokeLauncher;

    @tryteyker

    Never had an addAction duplicate itself in single player unless you add it more than once elsewhere? Where it does duplicate is in multiplayer where you can accidentally have it running on server and client at the same time. Script above are single player only.


  14. OK this works well:

    Example mission:https://dl.dropbox.com/u/37698503/smoke_gen.Shapur_BAF.zip

    In your init.sqf:

    {if (_x isKindOf "Wheeled_APC" || _x isKindOf "Tank") then {
    _x addaction [("<t color=""#ee6600"">" + ("Smoke Plume") +"</t>"), "smoke.sqf","", 1, false, true,"LaunchCM","isEngineOn _target && driver _target == _this"];};
    } forEach vehicles;

    Adds the action to all tanks and APCs.

    Conditions added, Only the driver will see the action and only if the engine is on.

    Shortcut key is R, press R to trigger the shortcut without having to scroll and click.

    You can't trigger it from outside the vehicle.

    smoke.sqf:

    _vcl = _this select 0;
     _caller = _this select 1;
       _id = _this select 2;
    
    //_vcl removeAction _id1; //uncomment to use the action only once
    
    _smoke = createVehicle ["ARTY_SmokeShellWhite", getPosATL _vcl, [], 0, "CAN_COLLIDE"];
       _smoke attachto [_vcl, [0,-3,-0.5]]; //this position works for all US armour and APCs - test it with everything - if you can see the shell PM me and I will change script to switch position according to class.
           sleep 3.5;
    _smoke2 = createVehicle ["ARTY_SmokeShellWhite", getPosATL _vcl, [], 0, "CAN_COLLIDE"];
       _smoke2 attachto [_vcl, [0,-3,-0.5]];
    

×