TYsiEK 0 Posted May 6, 2006 Hello guys. I got pretty big problem I made the script that creates Tomahawk missile some 50 meters above the marker. It looks like that: _xPos = getMarkerPos "uav" select 0 _yPos = getMarkerPos "uav" select 1 _zPos = getMarkerPos "uav" select 2 _missile = "CoC_TomahawkBlock2BLU" createvehicle getmarkerpos "uav" _missile setPos [_xPos,_yPos,_zPos + 50] "uav" is some kind of gps marker I made the script where marker follows vehicle/soldier . So the problem is... when running script, Tomahawk missile is setting at 50 meters just above the marker and OFP crashes I know guys it's very funny hehehe . This is an error report: ------------------------------------------------------- Exception code: C0000005 ACCESS_VIOLATION at 00493E71 Version 1.96 Fault address: 00493E71 01:00092E71 D:\Gry\OperationFlashpoint\FLASHPOINTRESISTANCE.EXE file: Tomahawk testings1 world: Intro Prev. code bytes: 20 DB 71 00 D9 9E 68 02 00 00 8B 43 2C 8B 40 08 Fault code bytes: 8B 40 4C 8B 58 08 8D 45 B8 50 8B CB E8 6A 85 FF Registers: EAX:00000000 EBX:151BD700 ECX:00000000 EDX:14C93840 ESI:151ED600 EDI:00000000 CS:EIP:001B:00493E71 SS:ESP:0023:0012F890 EBP:0012F9A4 DS:0023 ES:0023 FS:003B GS:0000 Flags:00010202 ======================================================= If somebody could help me I could be thankful Share this post Link to post Share on other sites
raedor 8 Posted May 6, 2006 Does it crash _after_ the setPos or before? Try <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_missile = "CoC_TomahawkBlock2BLU" createvehicle [_xPos,_yPos,_zPos + 50]Maybe CoC replaces the missile via init EH with something... Share this post Link to post Share on other sites
nindall 0 Posted May 6, 2006 I'm not sure if this'll cause a crash but, AFAIK, markers only have 2d positions so _zPos can't be anything. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_missile = "CoC_TomahawkBlock2BLU" createVehicle [_xPos, _yPos, 50] Share this post Link to post Share on other sites
TYsiEK 0 Posted May 6, 2006 Raedor, it crashes after setpos. Your example code is working but missile is not creating 50 meters above the ground, but just on the ground at elevation zero Nindall, I know, markers position are only in 2d but it works if you type _y height too as I typed. So how to create the missile not on the ground but above it without crashing ofp ? EDIT I forgot to tell you that: _missile = "CoC_TomahawkBlock2BLU" camCreate [_xPos,_yPos,_zPos + 50] It crashes ofp too after camcreating. Share this post Link to post Share on other sites
UNN 0 Posted May 6, 2006 Quote[/b] ]Your example code is working but missile is not creating 50 meters above the ground, but just on the ground at elevation zero Quote[/b] ]Nindall, I know, markers position are only in 2d but it works if you type _y height too as I typed. Nindall's point still stands. The reason your missile is being created on ground level is the bad _zPos your using. You should only need this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_xPos = getMarkerPos "uav" select 0 _yPos = getMarkerPos "uav" select 1 _missile = "CoC_TomahawkBlock2BLU" createvehicle [_xPos,_yPos,50] BTW Does it crash if you try this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_missile = "CoC_TomahawkBlock2BLU" createvehicle [0,0,50] If it does, it's either a problem with the addon, or something your missing thats required for the addonis init event, as Raedor said. Have you changed anything in it's config or pbo? Share this post Link to post Share on other sites
TYsiEK 0 Posted May 6, 2006 I didn't change anything . Share this post Link to post Share on other sites
baddo 0 Posted May 6, 2006 According to my tests getMarkerPos and markerPos return the height value, it will just be zero. So it is not a bad value. This is what I wrote to some other forum about position arrays as arguments and return values: <span style='font-family:Courier'>FUNCTIONS WHICH TAKE POSITION AS ARGUMENT TESTED IF THEY ACCEPT BOTH 2D AND 3D POSITION TYPES. FUNCTION:    3D POS. WORKS:  2D POS. WORKS:  NOTES: ************************************************************************************* camCreate      X          X camSetPos      X          X camSetRelPos     X              Error Generic error in expression camSetTarget     X          X commandMove     X          X commandWatch     X          X createUnit      X          X createVehicle    X          X doMove        X          X doWatch       X          X mapAnimAdd      X          X move         X          X nearestObject    X          X setMarkerPos     X          X setPos        X          X setWPPos       X          X To be absolutely sure, I tested all commands which return a position array: buildingPos    getMarkerPos    getPos      getWPPos    markerPos    onMapSingleClick position waypointPosition All of the above commands return a 3D position array.</span> Tests for the return values were a simple hint format ["%1", command] which always gave a 3D position array to the screen so the height value was in the returned array in every case. I can't see any reason why the height value returned by getMarkerPos could not be used. It is zero but it still is a perfectly valid value which can be added to and multiplied etc. the normal stuff you can do with numbers. I tested the code from the first post by creating a couple of shells 50 meters above a marker and it worked fine, nice explosion. The code was exactly the same but the classname was changed to "Shell125". Share this post Link to post Share on other sites
nindall 0 Posted May 6, 2006 I just ran your original code with no problems - <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_xPos = getMarkerPos "uav" select 0 _yPos = getMarkerPos "uav" select 1 _zPos = getMarkerPos "uav" select 2 _missile = "CoC_TomahawkBlock2BLU" createvehicle getmarkerpos "uav" _missile setPos [_xPos,_yPos,_zPos + 50] Although the missile falls rather than flys! (IIRC you need to create a pilot.) Share this post Link to post Share on other sites
Guest [B.B.S.] T_D Posted May 6, 2006 afaik missiles have to be created above sea level. So maybe you should use fSetPosASL function to create the missile. Share this post Link to post Share on other sites
UNN 0 Posted May 6, 2006 Quote[/b] ]afaik missiles have to be created above sea level. So maybe you should use fSetPosASL function to create the missile. True, but in this case the CoC Tomahawk is a vehicle piloted by the AI. Quote[/b] ]I didn't change anything It does sound like your copy of the Tomahawk is corrupt or some other addon\code elsewhere, is crashing OFP. Share this post Link to post Share on other sites
TYsiEK 0 Posted May 7, 2006 I'm just testing scripts The script looks like that: _missile = _this select 0 _pilot = _this select 1 _uav = _this select 2 _pos1 = _this select 3 _xPos = getMarkerPos "uav" select 0 _yPos = getMarkerPos "uav" select 1 _zPos = getMarkerPos "uav" select 2 #position goto "createmissile" #createmissile ~2 player globalChat "It's going it's going !" _missile = "CoC_TomahawkBlock2BLU" camCreate [_xPos,_yPos,_zPos + 50] _missile setDir getDir _uav _pilot = "soldierWB" camCreate [(getPos _uav select 0),(getPos _uav select 1),0] _pilot moveindriver _missile _missile domove getpos _pos1 _pilot setBehaviour "CARELESS" _pilot setCombatMode "BLUE" _missile setSpeedMode "FULL" _pilot allowFleeing 0 goto "cruise" #cruise ?(_missile distance _pos1 < 400): _missile flyinheight 25 ?(_missile distance _pos1 < 150): _missile flyinheight 0 ?(_missile distance _pos1 > 25): goto "cruise" ?(_missile distance _pos1 < 25): _missile fire "CoC_CMPayload" goto "end" #end I wanna remake Dragon Warrior UAV and add two HellFire rockets because there is no single Predator UAV add-on to download. Here you got the link how iraqi guys who is setting up roadside bomb dying because of UAV's HellFire boom In the second video I'm not sure is it Cobra or UAV. But I think that should be some helicopter UAV HellFire Car hit by rocket Have a nice watching For this time I'm using UAV and CoC Tomahawk radio strike. It's a lot of fun . Share this post Link to post Share on other sites
UNN 0 Posted May 7, 2006 This might cause OFP to crash: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_pilot = "soldierWB" camCreate [(getPos _uav select 0),(getPos _uav select 1),0] If you don't create a pilot\driver with CreateUnit and a valid group. It can cause OFP to crash when in certain vehicles, at certain times. As a test you could place an infantry guy in the editor and move him into the pilots seat instead, to see if that solves the problem. If it does it's just a case of getting a valid group and using CreateUnit. Share this post Link to post Share on other sites