Hello
I'm tying to get an Actor (a hen) to randomly walk around within a bounded region.
I have a script that does this by using Random and PolyPaths, but I wonder if there is a simpler way to do this. In English, the script picks a new x,y coordinate, sends the Actor to that coordinate using PolyPath, then repeats.
(method (changeState newState &tmp nextHenX nextHenY)
(= state newState)
(= nextHenX (Random 75 75))
(= nextHenY (Random 140 140))
(switch state
(0
(if (== gKeyholePic CABIN_KEYHOLE_PIC_SLEEP) (self cue:))
)
(1
(ogre init: setCycle: Forward setSpeed: 60)
(self cue:)
)
(2
(if (not (gEgo has: INV_HEN))
(hen posn: 87 159 init: ignoreActors: FALSE setSpeed: 3 setCycle: StopWalk -1)
(self cue:)
)
)
(3
(hen setMotion: PolyPath nextHenX nextHenY self)
)
(4
(= seconds 1)
)
(5
(self changeState: 3)
)
)
)
I'm aware of the Wander class, but this class ignores polygons (I'm using SCI 1.1). Is there a similar class where I can pass in a polygon and only that Actor is affected by the polygon and thus will wander within the specific polygon? Or is what I've implemented the way to "wander" within a bounded region?
Thanks.