System file
# initial waypoint
kThis = App.Waypoint_Create("start way", sSetName, None)
kThis.SetStatic(1)
kThis.SetNavPoint(0)
kThis.SetTranslateXYZ(x, y, z)
kForward = App.TGPoint3()
kForward.SetXYZ(0, 0, 0)
kUp = App.TGPoint3()
kUp.SetXYZ(0, 0, 0)
kThis.AlignToVectors(kForward, kUp)
kThis.SetSpeed(25.000000)
kThis.Update(0)
kThis = None
# 1st stop
kThis = App.Waypoint_Create("wp1", sSetName, None)
kThis.SetStatic(0)
kThis.SetNavPoint(0)
kThis.SetTranslateXYZ(x, y, z)
kForward = App.TGPoint3()
kForward.SetXYZ(0, 0 ,0)
kUp = App.TGPoint3()
kUp.SetXYZ(0, 0, 0)
kThis.AlignToVectors(kForward, kUp)
kThis.SetSpeed(25.000000)
kThis.Update(0)
kThis = None
# 2nd stop
kThis = App.Waypoint_Create("wp2", sSetName, None)
kThis.SetStatic(0)
kThis.SetNavPoint(0)
kThis.SetTranslateXYZ(x, y, z)
kForward = App.TGPoint3()
kForward.SetXYZ(0, 0 ,0)
kUp = App.TGPoint3()
kUp.SetXYZ(0, 0, 0)
kThis.AlignToVectors(kForward, kUp)
kThis.SetSpeed(25.000000)
kThis.Update(0)
kThis = None
# and so on
# Bind waypoints
kThis = App.Waypoint_Cast( App.PlacementObject_GetObjectBySetName(sSetName, "start way") )
kPrevious = App.Waypoint_Cast( App.PlacementObject_GetObjectBySetName(sSetName, "wp1") )
kThis.InsertAfterObj( kPrevious )
kThis = kPrevious = None
kThis = App.Waypoint_Cast( App.PlacementObject_GetObjectBySetName(sSetName, "wp1") )
kPrevious = App.Waypoint_Cast( App.PlacementObject_GetObjectBySetName(sSetName, "wp2") )
kThis.InsertAfterObj( kPrevious )
kThis = kPrevious = None
# and so on
AI
import App
def CreateAI(pShip):
#########################################
# Creating PlainAI Cruise at (288, 109)
pCruise = App.PlainAI_Create(pShip, "Cruise")
pCruise.SetScriptModule("FollowWaypoints")
pCruise.SetInterruptable(1)
pScript = pCruise.GetScriptInstance()
pScript.SetTargetWaypointName("start way")
# Done creating PlainAI Cruise
#########################################
#########################################
# Creating SequenceAI Sequence at (294, 258)
pSequence = App.SequenceAI_Create(pShip, "Sequence")
pSequence.SetInterruptable(1)
pSequence.SetLoopCount(-1)
pSequence.SetResetIfInterrupted(1)
pSequence.SetDoubleCheckAllDone(1)
pSequence.SetSkipDormant(1)
# SeqBlock is at (320, 192)
pSequence.AddAI(pCruise)
# Done creating SequenceAI Sequence
#########################################
return pSequence