+ Reply to Thread
Results 1 to 8 of 8

Thread: The Hollow Aircraft Carrier Dilemma

  1. #1

    Join Date
    Aug 2007
    Location
    Vancouver, Canada
    Posts
    688

    The Hollow Aircraft Carrier Dilemma

    Every time I spawn a carrier with this script:

    _replace = _this select 0;
    _pos = getpos _replace;
    _dir = getdir _replace;

    if (isServer) then {
    _parts = [
    "Land_LHD_house_1", "Land_LHD_house_2", "Land_LHD_elev_R",
    "Land_LHD_1", "Land_LHD_2", "Land_LHD_3",
    "Land_LHD_4", "Land_LHD_5", "Land_LHD_6"
    ];
    {
    _veh = _x createvehicle _pos;
    _veh setdir _dir;
    _veh setpos _pos;
    } foreach _parts;

    deletevehicle _replace;
    };
    _xhandle = [this] execvm "createCarrier.sqf"
    I encounter a certain area of the deck that is hollow, and that any players or objects spawned will fall through. I'm unsure if this is a problem with my script or a problem with the Khe Sanh itself, but I figured I'd double-check here and see if someone can solve my problem.


  2. #2
    Inkompetent's Avatar
    Join Date
    Jan 2006
    Location
    Sweden
    Posts
    820

    Re: The Hollow Aircraft Carrier Dilemma

    It is probably a problem with the carrier itself. Just out of curiosity, do you just put units on top of it in the editor, or do you setPos them to proper altitude? I haven't userd the carrier myself yet, so I don't know if setPosing is obligatory or not.





  3. #3

    LowSpeedHighDrag's Avatar
    Join Date
    Dec 2008
    Location
    Europe
    Posts
    723

    Re: The Hollow Aircraft Carrier Dilemma

    It's obligatory. Anthing in the editor that is 0.05 above the ground level must use the setpos or setposASL.

    Otherwise the units will spawn into the water or on top of the roof of buildings.

    Also, the 'hollow deck' that you mentioned. Is by any chance on the fore/bow side?


    |ArmA Admin|TG Pathfinder|TG Mission Dev Team|
    "Far better it is to dare mighty things, to win glorious triumphs, even though chequered by failure, than to rank with those poor spirits who neither enjoy much nor suffer much, because they live in the grey twilight that knows no victory nor defeat" Theodore Roosevelt



  4.  
  5. #4
    nthamma's Avatar
    Join Date
    Jul 2008
    Location
    Houston, Tx
    Age
    21
    Posts
    324

    Re: The Hollow Aircraft Carrier Dilemma

    What I encountered when setting the position of an AI manually is that if you set them a little above the ground like 0.5m or something, they will die. It seems like they are not affected by gravity and will just float in the air and eventually lose all their health and die.

    They need to be exactly right above the ground touching it. So, you might have to preview a few times to see what height is best so that the AI doesn't die. Note that the carrier is not leveled. Some parts of the carrier is in a lower height distance in reference to the water and some parts are higher.

    I have a question that I've been wondering for a while: In your script, I notice you have created a local variable _replace = _this select 0;

    What does "this" return? An array? And if I look further down, you have deletevehicle _replace. What element in the array "_replace" does it delete? Sorry, I've just seen that a lot in people's script and I'm just wondering what "this" returns.


    IN GAME ARMA: |TG-Irr| Lq.Snake


  6. #5

    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    733

    Re: The Hollow Aircraft Carrier Dilemma

    Quote Originally Posted by nthamma View Post
    ...

    I have a question that I've been wondering for a while: In your script, I notice you have created a local variable _replace = _this select 0;

    What does "this" return? An array? And if I look further down, you have deletevehicle _replace. What element in the array "_replace" does it delete? Sorry, I've just seen that a lot in people's script and I'm just wondering what "this" returns.
    In this case, _this represents the array passed to the script from the execVM command. So, the array [this]. Now, the "this" in this passed array represents the object where this code was launched (init line of something). So, when you put "_replace = _this select 0;", basically, you are giving the first element (select 0) of the array (_this) a new name, simpler to read the code instead of seeing _this select 0 everywhere. So, when you see deleteVehicle _replace, it is actually removing the vehicle where the code was launched from.


  7. #6
    Inkompetent's Avatar
    Join Date
    Jan 2006
    Location
    Sweden
    Posts
    820

    Re: The Hollow Aircraft Carrier Dilemma

    I suppose that 'this' is a unit, and the call to the script is in the unit's init field.

    A unit consists of an array of data, where the first index (_this select 0) is the unit's ID. So '_replace' in the script is a quick-variable to reference the unit itself. Thus, the whole carrier is positioned using the original unit's position and facing as reference, and after the carrier is placed it deletes the original unit by deleteVehicle-ing it's name.






  8.  
  9. #7
    nthamma's Avatar
    Join Date
    Jul 2008
    Location
    Houston, Tx
    Age
    21
    Posts
    324

    Re: The Hollow Aircraft Carrier Dilemma

    What I'm confused about now is why use the first element of the array? What does it represent? What about the second and third element? Thanks beita for the quick response!

    EDIT: Sorry, didn't see the post after beita's. What other data does a unit consist of? Thanks for the help!


    IN GAME ARMA: |TG-Irr| Lq.Snake


  10. #8
    Inkompetent's Avatar
    Join Date
    Jan 2006
    Location
    Sweden
    Posts
    820

    Re: The Hollow Aircraft Carrier Dilemma

    Can't exactly recall what data it holds, but it can be checked with a simple script.

    Use nul = [this] execVM "testarray.sqf"; in the unit's init-line. Let the script look like follows:

    _x = 0;
    _data = "bool";
    while {(_data != nil) or (_data != null) or (_data == "")} do {
    _data = _this select _x;
    player sideChat format ["Index %1: %2",_x,_data];
    _x = _x+1;
    };


    Not entirely sure it'll work (and can't test it yet in a month), but if it does it should list all existing variables for the unit.
    Last edited by Inkompetent; 07-06-2009 at 04:12 AM. Reason: fixed blunder





  

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts