Dschulle 0 Posted January 19, 2003 unofficial Bank/ Pitch angle functionextension for OFP. Skriptpackage offers 3 new functions: GetBankPitch GetBank GetPitch All you have to do, is copy some files to your mission folder and initialize the objects you want to use the functions with: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">[<unit1>,<unit2>, ...] exec "initBankPitch.sqs"<span id='postcolor'> Functions are then global available in the mission. Sample: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">_inclination= Jeep2 call GetPitch or _BankPitch = Plane1 call GetBankPitch _Pitch = _BankPitch select 1 <span id='postcolor'> Get it here Sample mission and Readme included. Share this post Link to post Share on other sites
Spitfire 0 Posted January 20, 2003 That's beautiful so far, but when you come up with a function to actually SET the pitch&bank, drop me an e-mail Share this post Link to post Share on other sites
Dschulle 0 Posted January 20, 2003 I don't think that's possible. There are ways to fake such a command, like placing small objects under wingtips or looping a waypoint command, but these are kind of "dirty" solutions. Another test would be a addon which defines two new axis and using the animphase command. But I haven't tried this. Share this post Link to post Share on other sites
Spitfire 0 Posted January 20, 2003 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Dschulle @ Jan. 20 2003,15:12)</td></tr><tr><td id="QUOTE">Another test would be a addon which defines two new axis and using the animphase command. But I haven't tried this.<span id='postcolor'> Hmm... if it's done that way it means that the behaviour of the plane will be totally independent of the "animated" roll since the flight model takes account only the "real" roll & pitch. Visually it could give nice effects but is no good for vehicles. And not to mention that you actually have to make new models for it. Share this post Link to post Share on other sites
Guest Posted January 20, 2003 For a set bank/roll discussion, some ideas and tests, check this thread Share this post Link to post Share on other sites
Prospero 1 Posted January 20, 2003 ... I used an almost identical method in my ProSphere scripts. I haven't read through yours completely yet, but two things occur: 1) You'll lose accuracy as you move towards the upper/right corner of the map (you're using the distance command, not triggers to determine absolute height). 2) If you've made your drop functions atomic, then this point doesn't apply. I had to put a catch in here to normalize the vector components of the dropped particles - particular when the vehicle is speeding along. Otherwise the arc trig functions will error out when asked to chew on something greater than unity. Prospero Share this post Link to post Share on other sites
Dschulle 0 Posted January 20, 2003 I have seen your Prosphere Skripts, nice work! (also it was hard to understand, when most variables only have one letter;) </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">1) You'll lose accuracy as you move towards the upper/right corner of the map (you're using the distance command,not triggers to determine absolute height). <span id='postcolor'> Yes, I realized that. First I also wanted to use a trigger, but </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">_tst = "trigger" camcreate[x,y,z]<span id='postcolor'>failed and I hate to use skripts which require special objects, which have to be placed in the editor, like triggers... Can anybody tell me, how to camcreate a trigger? I thought I read it long time ago, but couldn't find it. </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">2) If you've made your drop functions atomic,then this point doesn't apply. I had to put a catch in here to normalize the vector components of the dropped particles - particular when the vehicle is speeding along. Otherwise the arc trig functions will error out when asked to chew on something greater than unity. <span id='postcolor'>I haven't encountered this problem. Testet the command with a A10 at full speed... I'm calling the 3 drops in one function, so I think they can be asumed to be atomic. (drop lifetime is 0) And I used the atan2 function, which hasn't the restiction of the normal arc functions. By the way can anybody tell me a save way to check if an object is initialized? For instance if you want to initialize an object only the first time? [EDIT: Know this one by now, thanks to vektorboson] Share this post Link to post Share on other sites
Dschulle 0 Posted January 21, 2003 Camcreate a Trigger: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">Trigger = "EmptyDetector" createVehicle [_x, _y, _z]<span id='postcolor'> Test if variable is initialized: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">?format["%1", MEINLOGIC] == "scalar bool array string 0xfcffffef": MEINLOGIC = "Logic" createVehicle [_x, _y, _z]<span id='postcolor'> Thanx to vektorboson. Share this post Link to post Share on other sites
Prospero 1 Posted January 21, 2003 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Dschulle @ Jan. 21 2003,08:41)</td></tr><tr><td id="QUOTE">Camcreate a Trigger: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">Trigger = "EmptyDetector" createVehicle [_x, _y, _z]<span id='postcolor'> Test if variable is initialized: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">?format["%1", MEINLOGIC] == "scalar bool array string 0xfcffffef": MEINLOGIC = "Logic" createVehicle [_x, _y, _z]<span id='postcolor'> Thanx to vektorboson. <span id='postcolor'> Oooh good show. I didn't know that! Prospero Share this post Link to post Share on other sites
dinger 1 Posted January 23, 2003 Trigger = "EmptyDetector" createVehicle [_x, _y, _z] Sweet! Now, how do you make sure you create it at 0 ASL? (mmm... try createvehicle _x, _y) (then try creating it 30000,30000,0] (then just see if it really matters what you set the Z to) ... now can we set the conditions/activation of a trigger? hehe. give me a little and I want more more more! Share this post Link to post Share on other sites
Liquid_Silence 0 Posted January 24, 2003 Cool... EDIT: can anyone who tests out the usefulness of this for height ASL testing please post results... Share this post Link to post Share on other sites
Dschulle 0 Posted January 24, 2003 Get Height ASL using a trigger seems to work fine  Just updated my functions (same Link as above). I used </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">_trigger = "EmptyDetector" createvehicle [0,0,0]<span id='postcolor'> then: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">_trigger setpos [_unitpos select 0, _unitpos select 1, 0] _distance = _trigger distance _unit<span id='postcolor'> Trigger does stay at SL! Actually trigger is 2-3m below Sea Level... PS: I don't think that it's possible to set any condition for the trigger, so might only be used for ASL sort of stuff EDIT: Corrected Code, Thanx bigpoppa Share this post Link to post Share on other sites
vektorboson 8 Posted January 24, 2003 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Dschulle @ Jan. 24 2003,12:32)</td></tr><tr><td id="QUOTE">I used </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">_trigger = createvehicle [0,0,0]<span id='postcolor'><span id='postcolor'> Of course it should read </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">_trigger = "EmptyDetector" createvehicle [0,0,0]<span id='postcolor'> Share this post Link to post Share on other sites
Prospero 1 Posted January 24, 2003 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Dschulle @ Jan. 24 2003,12:32)</td></tr><tr><td id="QUOTE"></span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">_trigger setpos [_unitpos select 0, _unitpos select 1, 0] _distance = _trigger distance _unit<span id='postcolor'><span id='postcolor'> You are still using the distance command. To avoid substantial rounding errors, I would use: _aslheightofobject = (getpos theobject select 2) - (getpos trigger select 2) In place of: _distance = _trigger distance _unit Prospero Share this post Link to post Share on other sites
bn880 5 Posted January 24, 2003 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Dschulle @ Jan. 21 2003,02:41)</td></tr><tr><td id="QUOTE">Test if variable is initialized: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">?format["%1", MEINLOGIC] == "scalar bool array string 0xfcffffef": MEINLOGIC = "Logic" createVehicle [_x, _y, _z]<span id='postcolor'><span id='postcolor'> Resourceful but I think that's a workaround too round. (nichts gut) </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">_error = true; ?(MUJLOGIC == MUJLOGIC):_error = false; ?(_error):MUJLOGIC = "Logic" createVehicle [_x, _y, _z];<span id='postcolor'> Longer, but... Share this post Link to post Share on other sites