Get your own free workspace
View
 

FirstActorInZone

Page history last edited by Gamemaster 3 years, 11 months ago

 

FirstActorInZone

Usage:

                FirstActorInZone(Zone, Instance)

Description:

The FirstActorInZone command returns a handle to the first actor in a given zone and instance. This is useful to begin a loop through all actors in the zone using NextActorInZone.

Example:

                Function Main()
                        // Send a message to every human actor in the "forest" zone
                        FirstActor = FirstActorInZone("Forest", 0)
                        If (FirstActor)
                                .Loop
                                Actor = NextActorInZone(FirstActor)
                                If (Actor == FirstActor)
                                        Return()
                                EndIf
                                
                                If (ActorIsHuman(Actor))
                                        Output(Actor, "Hello there!")
                                EndIf
                                GoTo(Loop)
                        EndIf
                        Return()
                End Function

Comments (0)

You don't have permission to comment on this page.