For anyone who might be searching the forums in the future:
There's a much slimmer way to do all this. After walking away for a few minutes, of coure, it hit me like a truck.
If you add a targeting laser to you weapons--say, making targetlaser-wep.tbm--make sure you make it a homing weapon, and make sure you have the "no dumbfire" flag. In fact I already had these and just didn't realize that the simplest answer was right in front of me. Witness the benefits of going outside now and again.
With that and the script I mentioned above--which I'm trying to make into something more flexible--all you really need in terms of SEXPs to get the same result is this:
No Turrets [This is just if you want to keep the GOD sat from opening up with missiles]
-when
--true
--turret-lock-all
---[name of your GOD sat]
Get Target
-every-time
--not
---string-equals
----ptarget(none)
----none
---modify-variable
----ptarget-x(0)
----get-object-x
-----ptarget(none)
---modify-variable
----ptarget-y(0)
----get-object-y
-----ptarget(none)
---modify-variable
----ptarget-z(0)
----get-object-z
-----ptarget(none)
Align GOD
-every-time
--and
---not
----string-equals
-----ptarget(none)
-----none
---not
----string-equals
-----ptarget(none)
-----[name of your GOD sat]
--set-object-facing
---[name of your GOD sat]
---ptarget-x(0)
---ptarget-y(0)
---ptarget-z(0)
---20000
Recharge Check
-every-time
--true
---when
----=
----- -
------mission-time
------time-fired(0)
-----15 [or however long you want the recharge delay to be]
----modify-variable
-----recharge-check(0)
-----1
----training-msg
-----ready [optional, in fact I'm going to use subtitles in my final version]
----key-reset-multiple
-----Spacebar
----set-secondary-ammo
-----Gamma 2 [see note below]
-----0
-----1
Lock Stop
-every-time
--true
--when
---and
----not
-----missile-locked
------0
----key-pressed
-----Spacebar
---key-reset-multiple
----Spacebar
Fire Beam
-every-time
--true
--when
---and
----=
-----recharge-check(0)
-----(0)
----key-pressed
-----Spacebar
----missile-locked
-----0
---key-reset-multiple
----Spacebar
---fire-beam
----[name of your GOD sat]
----turret01a
----ptarget(none)
---modify-variable
----time-fired(0)
----mission-time
As regards using Gamma 2: The script I wrote is specifically for a campaign I'm working on. In this campaign, the player is Gamma 2. This can be changed in the script, but I'm also trying to figure out (with my pitiable LUA abilities) a way to make that more flexible, so that the script will work with any given name for the player.
If you're still reading, you might be as new to this as I was when I wrote this, so I'll go into some detail. Experienced modders may skip the following.
You may wonder why I used set-object-facing and then the coordinates of the variable ptarget, rather than just set-object-facing-object and pointing the GOD sat at ptarget. Well, set-object-facing-object seems to also align the object you're setting with the object you're point it at, and just for visual effect I didn't want my GOD sat spinning on its (relative) Z axis, just rotating about its X and Y to face its target.
If you read the previous SEXPs, you might have noticed that I eliminated the all-important IFF check. Well, when I put this into action I realized pretty quickly that it, like so many other things I was doing, was unnecessary. The GOD sat won't fire on friendlies--or in fact anything but hostiles--because it requires a missile lock to fire, and your weapons will not lock onto anything but hostiles. The "no dumbfire" tag in your weapons table prevented you from using up your one-at-a-time targeting laser ammo on a shot that the GOD sat won't take.
And if you are indeed new to this whole thing, I know the hardest part for me was learning the scripting. I'll go really quickly through the script I used and how it works, so you can have some place to start from. You will still want to read about scripting some to get some definitions. The definitions you'll need are here:
http://www.hard-light.net/wiki/index.php/FS2_Open_Lua_Scripting#What_You_Need#Global Hooks
$Simulation
;;read about these here:
http://www.hard-light.net/wiki/index.php/Scripting.tbl[
ship = Mission.Ships['Gamma 2']
;;This sets the handle "ship" to 'Gamma 2.' It calls up the library "Mission" and retrieves the ship 'Gamma 2' for future reference. This part, until I learn a better way, dictates that for the script to work, the player ship must be Gamma 2. Of course, if you want to play as something else, just change Gamma 2 to Alpha 1 or whatever. Don't forget the single quotation marks around the name of the ship.
starget = ship.Target
;;This creates the variable 'starget' and sets it to the target selected by the handle 'ship.' And because of the line above it, the handle 'ship' currently refers to Gamma 2.
if starget:isValid()then
;;Basic preventative debugging. The script doesn't try to do anything within the "If-then-end" statement if there's something wrong with starget. This prevents your script from crashing the game.
mn.SEXPVariables['ptarget'] = tostring(ship.Target)
;;"mn" is the short version for "Mission," so it's going into the Mission library again. mn.SEXPVariables does exactly what it sounds like--it sets a SEXP variable to a value that you come up with in LUA scripting. "tostring" is necessary for this to work, because it changes the object data "ship.Target" to a string. SEXP variables can only do strings and numbers. Instead of LUA stuff that SEXPs can't understand, you just get the name of whatever happens to be ship.Target at that time. And, again, the handle 'ship' is still referring to 'Gamma 2.'
end
;;ends the if-then statement.
]
#End
Hopefully that did some small part to make your learning process a little less painful than mine.