Model 299
Member-
Content Count
2 -
Joined
-
Last visited
-
Medals
Community Reputation
10 GoodAbout Model 299
-
Rank
Newbie
-
LHD (Aircraft Carrier) spawning script
Model 299 replied to armatech's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
What you have to do is setpos the units at the carrier. The problem is, that the carrier deck is technically 20 meters in the air and not at sealevel where the object is. So, you have to getpos something at the same position as the carrier. So in the new version of the script it deletes the helipad you used so you'll have to comment that out. deletevehicle _LHDspawn turns to ;deletevehicle LHDspawn it's easier not to delete the helipad because you want the position of objects that were created at it's position, and this is easier than exporting the position of the objects that were created. (cause the script uses a foreach) now that you have that you need to modify the position and set that for your units. so, your unit should have in it this setpos [(getpos LHD_Center select 0),(getpos LHD_Center select 1),10] where this is your unit, and LHD_Center is the name of the helipad you used to spawn the LHD. What it does is it uses getpos to get the numbers out of the position of the helipad. Positions are always an array of three numbers. like this [pos x east west, pos y north south, height above ground z] So you just grab the x and y coordinates out of the helipad and then set the altitude at 10 (which should put you inside the carrier, 20 will drop things on the deck) you have to play with the numbers to get things where you want them. Additionally it's possible to add or subtract meters from the coordinates. this setpos [((getpos LHD_Center select 0) + 2),(getpos LHD_Center select 1),18.50] this will put this two meters east of the LHD_Center position and 18.5 meters in the air. you can put -2 for two meters west, or do the same math on the other coordinate for north and south. So basically that's it you just have to rebuild the position array with the values that you want, which are relative to the location of any object. Careful dropping helicopters on the deck, if they start out too high they'll take damage, and if they're dropped inside the carrier they're hard to fly. I doubt if AI units will stay on the deck, so you'll have to order units into an empty chopper. -
LHD (Aircraft Carrier) spawning script
Model 299 replied to armatech's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
I know this is an older script, but I thought it was significant. I'm wondering why when I run the LHD script my arma2.RPT file seems to be written to in a loop, as long as the mission is running. The error which is repeated is: Error position: <createvehicle _LHDspawnpoint; _dummy set> Error Type Any, expected Number File C:\Users\(me)\Documents\ArmA 2 Other Profiles\Model299\missions\Annhialation.Chernarus\CreateLHD.sqf, line 20 Error in expression <d_LHD_5", "Land_LHD_6" ]; { _dummy = _x createvehicle _LHDspawnpoint; _dummy set> the complete file I'm using is ;this setPosASL [getposASL this select 0, getposASL this select 1, 0]; res=[this]execVM"CreateLHD.sqf" ;if (isServer) then { _LHDspawn = _this select 0; _LHDdir = 270; _LHDspawnpoint = [getposasl _LHDspawn select 0, getposasl _LHDspawn select 1, 0]; _playersetpoint = [getposasl _LHDspawn select 0,((getposasl _LHDspawn select 1)-7), 10]; _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" ]; { _dummy = _x createvehicle _LHDspawnpoint; _dummy setdir _LHDdir; _dummy setpos _LHDspawnpoint; } foreach _parts; ;}; I have if (isServer) commented out for now while I develop the mission in the editor. and the _playersetpoint was a local variable I was playing with to set a player on the carrier. but I'm not using it. Anyhow I don't really understand the error, and it's repetitive, as though the game were in a loop, I end up with 35MB arma2.RPT files after just a few moments. Any opinions would be appreciated. *EDIT: I think it had something to do with my filesystem, cause I replaced the script again with the one in the archive posted above and arma 2 stopped complaining. Probably some special character in the text.