Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Random Target
#3
Code:
If NpcNum > 0 Then
                        ' If the npc is a attack on sight, search for a player on the Room
                        If Npc(NpcNum).Behavior = NPC_BEHAVIOR_ATTACKONSIGHT Or Npc(NpcNum).Behavior = NPC_BEHAVIOR_GUARD Then
                            For i = 1 To MAX_PLAYERS
                                If IsPlaying(i) Then
                                    If GetPlayerRoom(i) = y Then
                                        If RoomNpc(y, x).Target = 0 Then
                                            If Npc(NpcNum).Behavior = NPC_BEHAVIOR_ATTACKONSIGHT Or GetPlayerPK(i) = YES Then
                                                If LenB(Trim$(Npc(NpcNum).AttackSay)) Then
                                                    PlayerMsg i, "A " & Trim$(Npc(NpcNum).Name) & " says, '" & Trim$(Npc(NpcNum).AttackSay) & "' to you."
                                                End If
                                                Insert Array here that holds the results
                                            End If
                                        End If
                                    End If
                                End If
                            Next i
                                   Using the array you inserted above, randomize for 0 to the Ubound of the array, select a target, and attack it
                        End If
                    End If
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)