OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: terran4999 on 24 Apr 2008, 07:32:42

Title: Airstrike without clicking
Post 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

Code: [Select]
Dummy1 doMove (getMarkerPos "target")
instead of

Code: [Select]
Dummy1 doMove _pos
Nothing happen, any ideas?????

Code: [Select]
;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
Title: Re: Airstrike without clicking
Post by: Gcfungus on 24 Apr 2008, 08:33:00
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:
Code: [Select]
Dummy1 domove (getpos target)or
Code: [Select]
Dummy1 domove (getmarkerpos "marker1)
hope that helps. :)

-=GC=-Fungus1999
Title: Re: Airstrike without clicking
Post by: terran4999 on 24 Apr 2008, 10:08:19
thanks for your input, but in putting that code i got the pilot to leave his plane and ran to the gamelogic name "target"

Code: [Select]
Dummy1 domove (getpos target)
Any other thought?????
Title: Re: Airstrike without clicking
Post by: Gcfungus on 24 Apr 2008, 17:26:21
Maybe try changing

Code: [Select]
[Dummy1] join grpnull
Dummy1 moveInDriver strikePlane
Dummy1 doMove _pos
to
Code: [Select]
[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
Title: Re: Airstrike without clicking
Post by: terran4999 on 24 Apr 2008, 20:15:51
So do i put the below command in a "Radio Alpha" trigger

Code: [Select]
[target] exec "strike1.sqs"
with "target" being the name of the gamelogic the airstrike is suppose to hit
Title: Re: Airstrike without clicking
Post by: Gcfungus on 24 Apr 2008, 20:23:36
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
Code: [Select]
[] 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?
 ;)
Title: Re: Airstrike without clicking
Post by: terran4999 on 25 Apr 2008, 03:04:19
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:
Title: Re: Airstrike without clicking
Post by: Gcfungus on 25 Apr 2008, 08:36:57
Well, I can't think of much more however, one last throw of the dice:
Code: [Select]
[Dummy1] join grpnull
Dummy1 moveInDriver strikePlane
strikePlane Lock true
~0.3
Dummy1 doMove _pos
Add
Code: [Select]
[Dummy1] join grpnull
Dummy1 moveInDriver strikePlane
Dummt1 assignasdriver strikePlane
strikePlane Lock true
~0.3
Dummy1 doMove _pos
It may not do anything, but worth a try. If it still doesn't work, then someone else will have to try and help. :dunno:
Title: Re: Airstrike without clicking
Post by: terran4999 on 26 Apr 2008, 00:48:21
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
Title: Re: Airstrike without clicking
Post by: Pirin on 26 Apr 2008, 01:58:51
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.
Title: Re: Airstrike without clicking
Post by: terran4999 on 11 May 2008, 05:47:18
does anyone know how to prevent the StrikePlane from joining my group??? I tried removing:
Code: [Select]
"SoldierWPilot" createunit [getpos player,group player,"Dummy1=this",0]well that just stop the script from working altogether.... ??? ???
Title: Re: Airstrike without clicking
Post by: Gcfungus on 11 May 2008, 09:01:18
Sure, just leave that line in and add another line after it:
Code: [Select]
Dummy1 join Grpnull
Title: Re: Airstrike without clicking
Post by: terran4999 on 11 May 2008, 09:22:58
the command
Code: [Select]
Dummy1 join Grpnulldoes not do anything. The strikeplane still is joining my group when he is ordered to attack
any ideas???
Title: Re: Airstrike without clicking
Post by: Mandoble on 11 May 2008, 09:35:21
might be it is case sensitive, use [Dummy1] join grpNull.