OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: terran4999 on 24 Apr 2008, 07:32:42
-
I really like this airstrike script but i can't get it to work to target a game logic without clicking on the map for targeting
I tried inserting
Dummy1 doMove (getMarkerPos "target")
instead of
Dummy1 doMove _pos
Nothing happen, any ideas?????
;we deactivate the onmapclick once you clicked or it will create problems
onMapSingleClick {}
player sidechat "Coordinates transmitted, waiting for airstrike"
_pos = _this select 0
; we create a plane at the game logic A10ENTRY location
; high enough so the AI pilot can have time prevent his plane to fall in the sea
; we remove the weapons of the plane as the A10 AI even careless will want to engage with its canon
strikePlane = "A10LGB" camCreate getpos A10ENTRY
strikePlane setPos [(getPos strikePlane select 0),(getPos strikePlane select 1),(getPos strikePlane select 2)+2000]
strikePlane setDir 0
removeallweapons strikePlane
;we create the pilot for the plane
"SoldierWPilot" createunit [getpos player,group player,"Dummy1=this",0]
[Dummy1] join grpnull
Dummy1 moveInDriver strikePlane
Dummy1 doMove _pos
~1
Dummy1 setbehaviour "CARELESS"
~3
Dummy1 sideChat "Airstrike 1 On the way"
@ unitReady Dummy1
Dummy1 sideChat "Bomb away."
;here is a simple bombing run script
_num = 4
_i = 0
#loop
_bomb = "laserGuidedBomb" camCreate [(getPos strikePlane select 0)+((random 10)-5),(getPos strikePlane select 1)+((random 10)-5),(getPos strikePlane select 2)-3]
_bomb setDir (getDir strikePlane)
_bomb setVelocity [(velocity strikePlane select 0)*0.2,(velocity strikePlane select 1)*0.2,(velocity strikePlane select 2)*0.2]
_i = _i + 1
~0.2
? _i < _num : goto "loop"
;once the bombing run is done
;the pilot move back to the game logic A10ENTRY
;it will be deleted there as we don't need it anymore
Dummy1 doMove getpos A10ENTRY
Dummy1 sideChat "Heading back to base."
@ unitReady strikePilot
deleteVehicle strikePlane
deleteVehicle Dummy1
exit
-
From what I can see, there is a problem with your line.
Game Logics aren't markers, so would just use getpos.
You could use:
Dummy1 domove (getpos target)or
Dummy1 domove (getmarkerpos "marker1)
hope that helps. :)
-=GC=-Fungus1999
-
thanks for your input, but in putting that code i got the pilot to leave his plane and ran to the gamelogic name "target"
Dummy1 domove (getpos target)
Any other thought?????
-
Maybe try changing
[Dummy1] join grpnull
Dummy1 moveInDriver strikePlane
Dummy1 doMove _posto
[Dummy1] join grpnull
Dummy1 moveInDriver strikePlane
strikePlane Lock true
~0.3
Dummy1 doMove _pos
You could leave out the extra wait, but I think it might help.
Post the results.
-=GC=-Fungus1999
-
So do i put the below command in a "Radio Alpha" trigger
[target] exec "strike1.sqs"
with "target" being the name of the gamelogic the airstrike is suppose to hit
-
In this case, I dont think it matters what goes in the brackets. But to answer your question, yes put it in the trigger activation. You could just have
[] exec "strike1.sqs"what is in between the brackets is passed to the script in the array form, so it can be accessed using _this select. This is helpful for using the same script on multiple targets.
Anyway, does the script work now?
;)
-
Thank you for your input, but unfortunately when I radio Alpha the pilot of the plane appears in front of me doing nothing but a long hard stare. :no: :no: :no: ??? :confused:
-
Well, I can't think of much more however, one last throw of the dice:
[Dummy1] join grpnull
Dummy1 moveInDriver strikePlane
strikePlane Lock true
~0.3
Dummy1 doMove _posAdd
[Dummy1] join grpnull
Dummy1 moveInDriver strikePlane
Dummt1 assignasdriver strikePlane
strikePlane Lock true
~0.3
Dummy1 doMove _posIt may not do anything, but worth a try. If it still doesn't work, then someone else will have to try and help. :dunno:
-
That's ok i give up in trying to modify this script. Thank you for your help; you been most helpful :D :D :D :D
-
You're using camCreate to create the plane, which apparently creates a "prop" plane, not a usable one.
Use createVehicle instead and your pilot should be able to enter the plane.
-
does anyone know how to prevent the StrikePlane from joining my group??? I tried removing:
"SoldierWPilot" createunit [getpos player,group player,"Dummy1=this",0]well that just stop the script from working altogether.... ??? ???
-
Sure, just leave that line in and add another line after it:
Dummy1 join Grpnull
-
the command
Dummy1 join Grpnulldoes not do anything. The strikeplane still is joining my group when he is ordered to attack
any ideas???
-
might be it is case sensitive, use [Dummy1] join grpNull.