OK Ched, this was a bit of a struggle but I got it working fairly reliably. Sorry it took so long, but I've been testing and beating on this thing for a while to make it work as well as I could. If anyone else has any suggestions for how to improve this, please feel free to chime in. I'm still somewhat of a noob at scripting.
OK, enough of an intro. Here's the script itself:
;// Anigma's Rail Shooter Controller v0.1 (beta)
;// This still needs work, might be buggy.
;//---------------------------------------------------------
;// Requires an invisible entity called RailController to work (included)
;// Notes - Add Rail Controller Entity to scene, and set params as follows:
;// Physics Weight: 200000 - gives it enough oomph to move the player around
;// Physics Force Damage: 0 - keeps it from hurting the player when it moves around.
;// Note: I tried to set these in the FPE file but they don't work. Suggestions welcome here.
;// Ideally I'd like to be able to just drop the entity on a map and it works with no fiddling.
;// Initialization - move player to rail controller and point in initial direction.
:state=0:state=1,plrmoveto=RailController,plrpointatobject=10
;// Keep player associated with this entity at all times.
:always:associateplayer
;//Note - to prevent the player from being able to break free from the controller, set the player's speed to 1
;// Travel waypoints until end, then stop.
:state=1,waypointstate=0:waypointstart
:state=1,waypointstate=3:waypointnext
:state=1,waypointstate=4:waypointrandom
:state=1,waypointstate=5:waypointstop
;// Todo - stop rail controller at a waypoint if enemies are present, then resume when enemies eliminated.
;// Todo - find a way to keep the shadow from showing up under the controller - looks weird.
;// Known Bugs - If the player jumps or crouches, they can still break free. Will need to disable these during movement.
And here's the associated FPE file for the controller entity:
;header
desc = RailController
;ai
aiinit = appear1.fpi
aimain = railcontroller.fpi
aidestroy = destroy\fadecorpse.fpi
aishoot =
soundset = male
;spawn
spawnmax = 0
spawndelay = 0
spawnqty = 0
;orientation
model = none.X
offx = 0
offy = 0
offz = 0
rotx = 0
roty = 0
rotz = 0
scale = 1000
fixnewy = 180
;cone of sight
coneheight = 53
coneangle = 50
;visualinfo
textured = invisible.dds
effect = effectbank\cubemap\cubemap.fx
castshadow = 0
;decals
decalmax = 2
decal0 = red
decal1 = blood
;identity details
strength = 0
ischaracter = 1
hasweapon =
isobjective = 0
cantakeweapon = 1
phyweight = 200000
phyforcedamage= 0
;bodypartslimbinfo (1=head/2=body/3+4=armslr/5+6=legslr)
limbmax = 0
I'm sure you already know this, but for anyone else who may wonder: Copy the script into notepad and save as railcontroller.fpi in the scriptbank folder and copy the entity into notepad and save as RailController.fpe in the entitybank folder. Finally download and save the attached invisible.dds to your texturebank folder and then you'll be all set to use this.
This still has a ways to go but should serve as a starting point for rail shooter controls. Again, please feel free to chime in with any improvements to this, and hopefully this will help with what you needed.
OK, time for one of these:
and then bed.