Jump to content

Heeeere's johnny!

Member
  • Content Count

    899
  • Joined

  • Last visited

  • Medals

Posts posted by Heeeere's johnny!


  1. Hey johnny,

     

    have you ever considered using https://community.bistudio.com/wiki/intersect to detect doors near a player instead of placing triggers everywhere?

    I guess that would be easier to handle and quite a bit faster.

     

    Yes I have and I did at first until I realized that intersect does not work with slider doors (like in the hospital) and I'm not sure if it works for fences like in ArmA 2. That's why I did the trigger approach. But as you may have seen, the triggers are only created in a certain area around players and they are removed as soon as no player is near a "trigger filled" building anymore, so I tried to keep the amount of simultaniously existing triggers as few as possible.

     

    But a few weeks ago, I saw that for at least some buildings, there is a generic approach without the need for huge lists of building positions. But I'll have to reseach that again as I cannot remember how it went, but if it works for all buildings, that would be a nice way to make this script map independent.

    • Like 1

  2. Hey guyz,

     

    thanks for the heads-up. Sorry that I was inactive lately, but I'm currently writing my diploma thesis, hence I don't have much time left for anything else.

     

    But I'll do my very best to step-by-step update the script and will notify you as soon as it's done. Please be a bit patient since in case of doubt my real life goes first. :)

     

    Have a nice Play!

    Johnny

    • Like 2

  3. You seemingly didn't tell that guy you were talking to, that you need your code to work with A2, because getAllHitPointsDamage is a command introduced in A3 v1.50.

     

    Since the syntax of the code you posted is incomplete, but you seem to have some solution already, I'd like to clearify for myself what exactly you mean by "damaged track or wheels". Do you want your event handler to only fire when at least one wheel is completely damaged?


  4. Well, let me put it this way:

     

    In multiplayer, createTrigger broadcasts the trigger creation throughout the network, having said that I don't know whether this also counts for editor created triggers. Either way, I only know in this particular case, a rather inconvenient way of getting the same trigger statements on both server and clientside, for the client should play the sounds and the server should handle anything else regarding the units in the radiation zone.

     

    But assuming, you've established that, the easiest way is to find out how many seconds the sound file plays and then put it in a "while in radiation zone" loop with a sleep of the length of the sound file. In the trigger, it should look like this (untested):

    //condition:
    player in thisList
    
    //onAct:
    thisTrigger setVariable ["geiger", 0 spawn {
            while {player in thisList} do {
                player say3D "GeigerSound";
                sleep 5.3; //if the sound is 5.3 seconds long
            };
    }];
    
    //onDea:
    terminate thisTrigger getVariable "geiger";
    

    That way, the say3D will be done every x seconds, when the previous play is done.


  5. "Actively engaging" triggers my cerebral database to autoquery for "fired event handler". But I'm too tired to write one right now.

     

    Let me see if I got that straight. If you set your trigger's condition to the following, it will never activate if an opfor unit is in the trigger area:

    this && 0 == {if (opfor == side _x) exitWith {1}} count thisList
    

    The trigger area is the area defined by the shape (ellipse or rectangle) and the sizes (width and height).


  6. You are obviously making the effort to bring object orientation to a non-object-oriented language which is a great thing if you ask me, because I honestly miss it in SQF. Having said that, I've never really used it yet, only watched your code to find out, how you've done it. ^_^

     

    It's just that I've learned very quickly, how powerful databases are and I wouldn't wanna miss SQL for persisting text and numbers like in case of ArmA 3. The only reason(s) I can imagine why people would not use a true database for persisting data, is that they either don't want to learn SQL or they simply don't care how their data is stored as long as it's stored at all.

     

    I hope you can understand why I cannot like iniDB. Sorry, don't mean to offend you.


  7. As far as I know, few people actually use real databases. From what I've heard so far, many scripters rely on plain and simple data persistence, such as iniDB.

     

    I personally consider iniDB horrible compared to the power and speed of an actual database, but nevertheless, maybe most people, if they use extDB, just use it as-is and don't see the need for an OO wrapper as you created it. :unsure:

    • Like 1

  8. The following code works, when I replace the projectile with any other object, but I can't seem to find a way to get the action show up on the (smoke) grenade / light stick.

    player addEventHandler ["Fired", {
        _projectile = _this select 6;
        _projectile addAction ["Pickup this object", {
            _params = _this select 3;
            deleteVehicle (_this select 0);
            hintSilent _params;
        }, "You have picked up this object", 3, false, true];
        
        //the following is just for visual tracking purposes
        _ehCounter = player getVariable ["ehCounter", 0];
        _ehName = format ["eh_throw_%1", _ehCounter];
        player setVariable ["ehCounter", _ehCounter + 1];
        
        _arrow = createVehicle ["Sign_Arrow_Large_F", getPosATL _projectile, [], 0, "CAN_COLLIDE"];
        [_ehName, "onEachFrame", {
            if (alive (_this select 1) && time - (_this select 3) < 10) then {
                (_this select 0) setPosATL getPosATL (_this select 1);
            } else {
                deleteVehicle (_this select 0);
                [_this select 2, "onEachFrame"] call BIS_fnc_removeStackedEventHandler;
            };
        }, [_arrow, _projectile, _ehName, +time]] call BIS_fnc_addStackedEventHandler;
    }];
    

  9. Another approach, which will also work on hilly terrain (because why not :D):

    _fnc_setDistance = {
        _params = _this select 3;
        _object = _params select 0;
        _object setVariable ["distance", (_object getVariable "distance") + (_params select 1)];
    };
    
    _object = createVehicle ["Sign_Sphere100cm_F", getPosATL player, [], 0, "CAN_COLLIDE"];
    _object setVariable ["distance", 100];
    
    _handle = _object spawn {
        while {true} do {
            _newPos = player modelToWorld [0, _this getVariable "distance", 0];
            _newPos set [2, 0.5];
            _this setPosATL _newPos;
        };
    };
    
    player addAction ["Move 100m Out", _fnc_setDistance, [_object, 100]];
    player addAction ["Move 100m In", _fnc_setDistance, [_object, -100]];
    player addAction ["Release", {terminate (_this select 3);}, _handle];
    

  10. In addition to DreadedEntity's answer, we can make this even a bit more compass-independent:

    _fnc_setDistance = {
        params ["_target", "_caller", "_id", "_params"];
        _object = _params select 0;
        _distance = _object getVariable "distance";
        //_distanceDiff = _params select 1;
        _distance = _distance + (_params select 1);
        _object attachTo [player, [0, _distance, 0]];
        _object setVariable ["distance", _distance];
    };
    
    _object = createVehicle ["Sign_Sphere100cm_F", getPosATL player, [], 0, "CAN_COLLIDE"];
    _object setVariable ["distance", 100];
    _object attachTo [player, [0, 100, 0]];
    
    player addAction ["Move 100m Out", _fnc_setDistance, [_object, 100]];
    player addAction ["Move 100m In", _fnc_setDistance, [_object, -100]];
    player addAction ["Release", {detach (_this select 3);}, _object];
    

  11. this enableSimulationGlobal false

     

    A bit more information might be helpful for those who don't know what to do with that.

     

    That syntax belongs into the init field of the unit. But its also possible to make this a bit more generic, so it doesn't depend on a single unit:

     

    Before the car is hooked:

    {_x enableSimulationGlobal false} forEach crew _car;
    

    After the car is unhooked:

    {_x enableSimulationGlobal true} forEach crew _car;
    

  12. _SEH_ID = [ missionNamespace, "arsenalClosed", format[ "
    	[%1,0] call BIS_fnc_dataTerminalAnimate;
    ", _object]] call BIS_fnc_addScriptedEventHandler;

    If you get errors with the data terminal line try passing _object call BIS_fnc_objectVar into the format instead.

     

     

    Correct me if I'm wrong, but to my unsterstanding, this ain't gonna work unless _object is anything but an object, because you can't format an object into a string.


  13. I think the GetIn and GetOut event handlers fit your needs best:

    chopper addEventHandler ["GetIn", {
        if (player == _this select 2) then {
            systemChat "You mounted the chopper";
        };
    }];
    
    chopper addEventHandler ["GetOut", {
        if (player == _this select 2) then {
            systemChat "You left the chopper";
        };
    }];
    

  14.  

    Some precise question like:

    1.
    while {true} do {
         {
         {
         if (_x in at) then {
              hint "t";
         };
         } foreach nearestObjects [_x, ["men"], 70];
         } foreach atu;
    };
    
    2.
    while {true} do {
         {
         {
         _lv = at find _x;
         if (_lv != -1) then {
              hint "t";
         };
         } foreach nearestObjects [_x, ["men"], 70];
         } foreach atu;
    };
    
    3.
    while {true} do {
         {
         {
         if (_x getvariable "pvt") then {
              hint "t";
         };
         } foreach nearestObjects [_x, ["men"], 70];
         } foreach atu;
    };
    

    What's better?

     

    Do you really write your code like that or do you obfuscate it before posting it in the forums?


  15. UI measures in ArmA are NOT pixels or inches or whatever. They are values between 0 and 1 where 0 is basically "nothing" and 1 is the height/width of the screen. There are some special things which make this statement not exactly true, but for ease of explanaition, let's keep say it was that way.

     

    Your lines to create _actX and _actY are very long. You shouldn't over complicate things when you don't know where the error is.

     

    If you want the top left corner of the image to be outside the screen, you need to use values smaller than 0 (as you already found out). I personally haven't had such problems yet, but I assume, you might get a senseful result, if you use ctrlPosition on the control containing the image, when the dialog is opened. Then you can do your calculation with these values, which come in form of an array [x, y, w, h].

×