Αplion 1122 Posted December 4, 2012 Hi all, as my scripting knowledge is trully limited, I need your help on that ... My project is a Heavy Landing Craft with ability to carry vehicles pes user choice. I need a script in order to select and attach in specific positions of the craft (given by some memory points in my p3d) any land vehicle in some area around it, as also the ability to detach them through user action menu (both attach and detach will be performed through user action menu). Is it possible to give me a hand on this ? Thanks in advance. Aplion Share this post Link to post Share on other sites
larsiano 12 Posted December 4, 2012 I think there is a ship that has a similar possibility: http://forums.bistudio.com/showthread.php?123082-LPD-29-San-Antonio-Class Maybe you can have a look at the script and see how its done? Share this post Link to post Share on other sites
Αplion 1122 Posted December 5, 2012 I think there is a ship that has a similar possibility: http://forums.bistudio.com/showthread.php?123082-LPD-29-San-Antonio-ClassMaybe you can have a look at the script and see how its done? The ship you are pointed me is a static one and all vehicles are using it as, lets say, a platform. In my project there must be a fully functional landing craft and all vehicles on it must be attached upon sailing. Thank you anyway. Share this post Link to post Share on other sites
[aps]gnat 28 Posted December 9, 2012 Open and have a look at my FSF scripts I do exactly as your asking. http://forums.bistudio.com/showthread.php?96295-Fast-Sea-Frame-FSF-1-Sea-Fighter Share this post Link to post Share on other sites
Αplion 1122 Posted December 9, 2012 Thanks a lot Gnat ... I'll have a look and I'll come back to you .. Share this post Link to post Share on other sites
Αplion 1122 Posted December 9, 2012 (edited) @Gnat ... I'm a little be confused .. I had a quick look on your scripts and probably that it fits to my needs is the position.sqf ... I saw that there is a call like "xx = [MyUH60,MySHIP,"Pad1"] execVM "\GNT_FSF\position.sqf";" i must probably set in my config init ... if I'm right to this ... this call is setting an exact vehicle (in this case is "MyUH60") on some given by memory point positions on my craft ... but as this script must run directly through my addon config, I need to have the choice to load and secure on it any land vehicle near in the area. Could you advise me regarding this ? Thanks Aplion UPDATE Nope ... probably it is not working like I said above ... I'm lost on that :( Edited December 9, 2012 by Aplion Share this post Link to post Share on other sites
[aps]gnat 28 Posted December 10, 2012 Did you try using the FSF in game ...... ? You will find you can attach "any" vehicle to the FSF (so long as its RHIBs or choppers) The position script you described above is NOT used, there are other scripts inside the addon Thats why I said "open it" Share this post Link to post Share on other sites
Αplion 1122 Posted December 10, 2012 (edited) Gnat;2262769']Did you try using the FSF in game ...... ?You will find you can attach "any" vehicle to the FSF (so long as its RHIBs or choppers) The position script you described above is NOT used' date=' there are other scripts inside the addon Thats why I said "open it"[/quote'] I did open it and I saw some extra scripts inside ... I'm trying to figure out how to use them but so far I'm stacked ... The point is that I need to have an action menu with all available vehicles around the area of my craft (or just the vehicle which will be step on the deck area maybe) ... after that I must have the option to select and attach any of these vehicles on "deck" or specific by memory points positions on my craft ... Truly I can't think how this is possible ... and maybe your scripts are capable to do this ... but I don't know how to use them in order to do it so !! Is there any possibility to help on that ? ofcourse I realize that your time is precious so there is no problem if your answer is "no" ... thanks for the help provided so far anyway ... appreciated. btw ... this is my LandingCraft Vehicle we are talking about ... http://img.photobucket.com/albums/v648/aplion/ArmA2OA2012-12-1015-14-23-31.jpg Aplion Edited December 10, 2012 by Aplion Share this post Link to post Share on other sites
Αplion 1122 Posted December 10, 2012 (edited) @Gnat ... well I might found something ... Using your FSFZodiacDock1.sqf script I have some progress ... now when I'm driving a vehicle on LandCraft deck, I have the action menu command for docking the vehicle ... but when I'm using this option, the crew of the vehicle stays into it (I always have the "get out" action menu) and the vehicle remains undocked ... Any thoughts about it ? Aplion Edited December 10, 2012 by Aplion Share this post Link to post Share on other sites
[aps]gnat 28 Posted December 11, 2012 (edited) From the config, each memory position has something like this (and Action); class UserActions { class Zodiac2 { displayName="Dock Left"; position="BBay"; onlyforplayer=0; radius=13; condition="(vehicle player isKindOf ""Boat"") and (this animationPhase ""ZL1"" == 0)"; statement= "this animate [""ZL1"",1];[this, vehicle player] execVM ""\GNT_FSF\scr\FSFZodiacDock1.sqf"""; }; The ANIMATION method was an old way of "storing" data inside an addon. Instead you can use the SETVARIABLE and GETVARIABLE commands to store status data inside the addon/vehicle. What you can do is have one of these UserActions for EVERY memory position you want to use; class UserActions { class Pos1 { displayName="Dock Front Left"; position="BBay"; onlyforplayer=0; radius=20; condition="((this getVariable ""PosFrontLeft"") == 0)"; statement= "this setVariable [""PosFrontLeft"", 1, true];;[this, vehicle player, -3,-20.5,-1.5, ""PosFrontLeft""] execVM ""\YOURADDON\scripts\Dock.sqf"""; }; class Pos2 { displayName="Dock Front Right"; position="BBay"; onlyforplayer=0; radius=20; condition="((this getVariable ""PosFrontRight"") == 0)"; statement= "this setVariable [""PosFrontRight"", 1, true];;[this, vehicle player, +3,-20.5,-1.5, ""PosFrontRight""] execVM ""\YOURADDON\scripts\Dock.sqf"""; }; class Pos3 { displayName="Dock Center Left"; position="BBay"; onlyforplayer=0; radius=20; condition="((this getVariable ""PosCenterLeft"") == 0)"; statement= "this setVariable [""PosCenterLeft"", 1, true];;[this, vehicle player, -3,-10,-1.5, ""PosCenterLeft""] execVM ""\YOURADDON\scripts\Dock.sqf"""; }; etc etc etc class Release1 { displayName="Release Front Left"; position="BBay"; onlyforplayer=0; radius=20; condition="((this getVariable ""PosFrontLeft"") == 1)"; statement= "this setVariable [""PosFrontLeft"", 0, true];"; }; class Release2 { displayName="Release Front Right"; position="BBay"; onlyforplayer=0; radius=20; condition="((this getVariable ""PosFrontRight"") == 1)"; statement= "this setVariable [""PosFrontRight"", 0, true];"; }; class Release3 { displayName="Release Center Left"; position="BBay"; onlyforplayer=0; radius=20; condition="((this getVariable ""PosCenterLeft"") == 1)"; statement= "this setVariable [""PosCenterLeft"", 0, true];"; }; etc etc etc Then Dock.sqf can be a more generic script. private["_ship","_boat"]; _ship = _this select 0; _boat = _this select 1; _XX = _this select 2; _YY = _this select 3; _ZZ = _this select 4; _StoreLoc = _this select 5; _boat attachto [_ship,[_XX, _YY, _ZZ]]; driver _boat action ["engineOff", _boat]; sleep 2; while {(alive _boat) and (alive _ship) and ((_ship getVariable _StoreLoc) == 1)} do {}; detach _boat; UNTESTED EDIT To use Memory points instead of XYZ points Change lines to statement= "this setVariable [""PosFrontLeft"", 1, true];;[this, vehicle player, ""PosFrontLeft""] execVM ""\YOURADDON\scripts\Dock.sqf"""; Dock private["_ship","_boat"]; _ship = _this select 0; _boat = _this select 1; _StoreLoc = _this select 2; _boat attachto [_ship,(_ship modeltoworld (_ship selectionposition _StoreLoc))]; driver _boat action ["engineOff", _boat]; sleep 2; while {(alive _boat) and (alive _ship) and ((_ship getVariable _StoreLoc) == 1)} do {}; detach _boat; Name your position memory points the same as the storage variable name, i.e. PosFrontLeft, PosFrontRight, PosCenterLeft etc etc Edited December 11, 2012 by [APS]Gnat Share this post Link to post Share on other sites
Αplion 1122 Posted December 11, 2012 I'll give it a try but I'm a little bit confused with "ZL1" animationPhase and animation ... what exactly is that "ZL1" ? something from your model.cfg ? and what is it doing as animation ? Aplion Share this post Link to post Share on other sites
[aps]gnat 28 Posted December 11, 2012 DONT use the ZL1 animation code, the code I just provided should replace it. What the animate ZL1 was for; Little invisible bits of the model were animated. If you animated it to 1, the ship "stored" that for you like it was a variable Animate it back to 0, and it stored a zero for you. This way, if your Docked something at location ZL1, you'd animate that "variable" to 1 so that the addon would know that that docking position was currently in use, and the UnDock/Release command is now valid. Instead, suggest using SETVARIABLE and GETVARIABLE now to do that. Share this post Link to post Share on other sites
Αplion 1122 Posted December 11, 2012 Understood ... one more question ... in this "_boat attachto [_ship,[_XX, _YY, _ZZ]];" I suppose that I must give the coordinates that any vehicle would be attached on my craft ... so why variables instead of just cordinates ? Share this post Link to post Share on other sites
maddogx 13 Posted December 11, 2012 Understood ... one more question ... in this "_boat attachto [_ship,[_XX, _YY, _ZZ]];" I suppose that I must give the coordinates that any vehicle would be attached on my craft ... so why variables instead of just cordinates ? I just browsed the code quickly, but it looks like the variable names are equivalent to position names in the vehicle, and their value of "0" or "1" tells you whether or not the position is available. Since you know the position name, you can read its coordinates using selectionPosition, as shown in Gnat's code. Share this post Link to post Share on other sites
Αplion 1122 Posted December 11, 2012 I just browsed the code quickly, but it looks like the variable names are equivalent to position names in the vehicle, and their value of "0" or "1" tells you whether or not the position is available.Since you know the position name, you can read its coordinates using selectionPosition, as shown in Gnat's code. So if I understood correct ... e.x. ... I have a memory point (as position) which called "pos1" ... so the _XX variable could be set as "_pos1" and the exact geolocation will be settled through config - userActions class (statement) ... Is that right ? Share this post Link to post Share on other sites
maddogx 13 Posted December 11, 2012 I have a memory point (as position) which called "pos1" So far so good... ... so the _XX variable could be set as "_pos1" Nope, you're better off giving the variables the same name as the respective memory points, without the underscore. That way you can check for them directly without mucking around with the name. and the exact geolocation will be settled through config - userActions class (statement) ... The position of the action is set there, yes. In Gnat's config, that's the "BBay" position. (Which is the name of a memory point in the model.) Share this post Link to post Share on other sites
Αplion 1122 Posted December 11, 2012 (edited) So you mean that into Gnat "Dock.sqf" instead of "_pos1 = _this select 2;" I must set "pos1 = _this select 2;" and after that into config I must just set the exact position (for example "0,0,0") of this memory point ? Edited December 11, 2012 by Aplion Share this post Link to post Share on other sites
maddogx 13 Posted December 11, 2012 So you mean that into Gnat "Dock.sqf" instead of "_pos1 = _this select 2;" I must set "pos1 = _this select 2;" Ah, no. That's just the name of the local variable in the script, which is completely unrelated to the name of the memory point. You can call that local variable whatever you want, but it would need the leading underscore because it is local. (See here.) So let's say you called your memory point in the model "myCargo01", you would pass that name to the dock.sqf, and there you could refer to it by a local variable like _pos. The name of the variable doesn't matter. and after that into config I must just set the exact position (fos example "0,0,0") of this memory point ? No, the memory point already has its position - it is wherever you placed it in the model - no need to store the position seperately. You can get that position from a script using the selectionPosition command, as mentioned above. Share this post Link to post Share on other sites
Αplion 1122 Posted December 11, 2012 Sorry for being a pain in the ass mate ... but I still don't get it ... Into Gnat "Dock.sqf" there some variables (_XX, _YY, _ZZ) which probably their names have no affect ... so at this line "_boat attachto [_ship,[_XX, _YY, _ZZ]];" these variables just representing my memory points in my model I'd like to use ... (I hope I'm right so far). Now into config ... Gnat "position="BBay";" should be for example my "position="pos1";" as "pos1" is one of my memory points in my model which I want to use for my purpose ... after that there is (in Gnat config example) this ... "condition="((this getVariable ""PosFrontLeft"") == 0)";" but I can't figure out what is the "PosFrontLeft" variable !! ... at last there also this "statement= "this setVariable [""PosFrontLeft"", 1, true];;[this, vehicle player, -3,-20.5,-1.5, ""PosFrontLeft""] execVM ""\YOURADDON\scripts\Dock.sqf""";" which I believe that in place of "-3,-20.5,-1.5" I must set my cordinates for any vehicle I whish to be attached on "pos1" memory point position ... still I can't understand what is the "PosFrontLeft" variable !! Share this post Link to post Share on other sites
maddogx 13 Posted December 11, 2012 "PosFrontLeft" is the name of a memory point you would place in the memory LOD of your ship model. The idea is to place that memory point at the position where a vehicle should be attached, for example on the deck of your ship. (In this case, somewhere in the front left part. :)) "PosFrontLeft" is also the name of a variable assigned to one of those same ships in game. It stores whether there is a vehicle currently attached at that position. Share this post Link to post Share on other sites
Αplion 1122 Posted December 11, 2012 I thought that Gnat memory LOD point for that ... was the "BBay" !! ... if not ... what kind of memory point is that "BBay" ? Except if "BBay" is not memory point but just the area name and the "PosFrontLeft" is a memory point (position) on this area !! is this the case ? Share this post Link to post Share on other sites
maddogx 13 Posted December 11, 2012 The BBay memory point is the location where the action is shown, not where the vehicle is attached. :) I haven't seen Gnat's model, but I'm guessing the BBay point is somewhere at the entrance of the vehicle bay. As you can see in the config, it also has a 20 meter radius - so you drive up within 20 meters of the entrance of the vehicle bay, and then you see some actions depending on which points in the vehicle are free. Then, if you select "Dock Front Left" for example, the script attaches your vehicle to the PosFrontLeft position. Share this post Link to post Share on other sites
Αplion 1122 Posted December 11, 2012 The BBay memory point is the location where the action is shown, not where the vehicle is attached. :)I haven't seen Gnat's model, but I'm guessing the BBay point is somewhere at the entrance of the vehicle bay. As you can see in the config, it also has a 20 meter radius - so you drive up within 20 meters of the entrance of the vehicle bay, and then you see some actions depending on which points in the vehicle are free. Then, if you select "Dock Front Left" for example, the script attaches your vehicle to the PosFrontLeft position. That was enlightening !! Thanks a lot mate ... I thing now I can give it a try and I'll come back soon with results ... Share this post Link to post Share on other sites
maddogx 13 Posted December 11, 2012 Cool. You also have a PM, just in case you need more help. ;) Share this post Link to post Share on other sites
Αplion 1122 Posted December 11, 2012 Cool. You also have a PM, just in case you need more help. ;) You have a reply to your PM but please ... as my English are awfull ... and in case something is not clear enough ... don't missunderstand me ... just let me know about it. Share this post Link to post Share on other sites