Go Back   Tactical Gamer > Simulation > Armed Assault > Armed Assault - Mod & Mission Development

Armed Assault - Mod & Mission Development Discussion forum for Tactical Gamer's mod & mission development team.

Reply
 
Thread Tools
Old 07-03-2009, 03:55 AM   #1 (permalink)
 
Join Date: Aug 2007
Location: Vancouver, Canada
Posts: 465
Tournaments Joined: 0
Tournaments Won: 0
The Hollow Aircraft Carrier Dilemma

Every time I spawn a carrier with this script:

Quote:
_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;
};
Quote:
_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.
Sc[ + ]pe is offline   Reply With Quote
Old 07-04-2009, 04:15 AM   #2 (permalink)
 
Inkompetent's Avatar
 
Join Date: Jan 2006
Location: Sweden
Posts: 425
Tournaments Joined: 0
Tournaments Won: 0
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.
__________________

Inkompetent is online now   Reply With Quote
Old 07-04-2009, 07:23 PM   #3 (permalink)
 
LowSpeedHighDrag's Avatar
 
Join Date: Dec 2008
Location: Europe
Posts: 464
Tournaments Joined: 0
Tournaments Won: 0
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?
__________________


"In battle, there are not more than two methods of attack-the direct and the indirect; yet these two in combination give rise to an endless series of maneuvers."
"...just as water retains no constant shape, so in warfare there are no constant conditions."
Sun Tzu
LowSpeedHighDrag is offline   Reply With Quote
Old 07-05-2009, 04:44 PM   #4 (permalink)
 
nthamma's Avatar
 
Join Date: Jul 2008
Location: Houston, Tx
Age: 21
Posts: 253
Tournaments Joined: 0
Tournaments Won: 0
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 PR: [FxH] Lq.Snake IN GAME ARMA: |TG-Irr| Lq.Snake
nthamma is offline   Reply With Quote
Old 07-05-2009, 04:51 PM   #5 (permalink)
 
Join Date: Jan 2008
Location: Ontario, Canada
Posts: 635
Tournaments Joined: 0
Tournaments Won: 0
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.
beita is offline   Reply With Quote
Old 07-05-2009, 04:56 PM   #6 (permalink)
 
Inkompetent's Avatar
 
Join Date: Jan 2006
Location: Sweden
Posts: 425
Tournaments Joined: 0
Tournaments Won: 0
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.
__________________

Inkompetent is online now   Reply With Quote
Old 07-05-2009, 05:05 PM   #7 (permalink)
 
nthamma's Avatar
 
Join Date: Jul 2008
Location: Houston, Tx
Age: 21
Posts: 253
Tournaments Joined: 0
Tournaments Won: 0
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 PR: [FxH] Lq.Snake IN GAME ARMA: |TG-Irr| Lq.Snake
nthamma is offline   Reply With Quote
Old 07-05-2009, 06:27 PM   #8 (permalink)
 
Inkompetent's Avatar
 
Join Date: Jan 2006
Location: Sweden
Posts: 425
Tournaments Joined: 0
Tournaments Won: 0
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
Inkompetent is online now   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




» Log in
User Name:

Password:

Not a member yet?
Register Now!
» Advertisement



All times are GMT -4. The time now is 02:37 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
©2004-2008 - Tactical Gamer - All Rights Reserved