PVP Spawn Flag Script

*Created by Taz.*

```
Using "RC_Core.rcm"
; testingrc1 1.26
; Date/Time: 8:53:59 PM on 11/11/2011
; By Naddaz on NADCO
;Flag Fight

 ;Spawn flag for the first time.
;SuperGlobal 12 Used to see if PVP_battle check script is running. If it is then there is a player holding the flag.

;MGO setup this needs to be added to the zone entry for annakay town and the coords needs to be changed as well as the
;zone name needs to be changed.

Function Main()
Player = Actor()
Target = ContextActor()
;will need to chage inctance of flag spawn to inctance of players
ZoneNumSpawn% = 1

;------------------------------------------------------------------------------------
;------------------------------------------------------------------------------------
;----------------------------Count players in zone-----------------------------------
;------------------------------------------------------------------------------------
;------------------------------------------------------------------------------------
;NOTE: should count actors and when working will only allow a certain amount of players in each zone.

 ;    FirstActor1$ = FirstActorInZone("Pvp battleground1", 0) ;first actor for count.
;    FirstPName$ = Name(FirstActor1)
;    ZoneCount% = 0
;    NextActorInZone(0)

;    Repeat

 ;        ZoneCount% = ZoneCount + 1
;        DoEvents(500)

         ;CurrentPlayer$ = NextActor()
;        ActorName$ = Name(NextActor())

 ;        OutPut(Player, "Zone Count is " + ActorName)

 ;    Until (ActorName = FirstPName)

;------------------------------------------------------------------------------------
;------------------------------------------------------------------------------------
;----------------------------End player in zone count----------------------------------
;------------------------------------------------------------------------------------
;------------------------------------------------------------------------------------

DoEvents(5000) ;Use when done testing so flag will not spawn right away. Add a rand time

;SetSuperGlobal(12, 0)
;need to fix for multibale battle grounds
    FlagHeld% = SuperGlobal(12)

        If (FlagHeld >= 5)
            Return
        EndIf

     ;flag name
 NameOfFlag$ = "Pvp Flag"
         FlagIsSpawned% = FindActor(NameOfFlag, 2)
        FlagZone$ = ActorZone(FlagIsSpawned)
        PZone$ = "Pvp Zone" ;1 vs 5 cap flag
        PHoldPvp$ = "pvpholdflag"

If (NameOfFlag = FlagZone) ; if flag is in this zone end script
Return
Endif

If (NameOfFlag = PHoldPvp) ; if flag is in this zone end script
Return
Endif

     If (NameOfFlag = PHoldPvp)  ;if cap and hold flag pvp zone spawn flag here
            ; Pick random flag spawn
            FlagSpawn% = Rand(1, 6)
            PZone$ = "pvpholdflag"
        If (FlagSpawn = 1)
           NewFlagSpawn$ = Spawn(FlagID, PZone, 203.353, 77.7768, 18.1667, "Pvp_Flag_Right Click", "", ZoneNumSpawn) ;Spawn pvp flag in 1 of 3 places.
        ElseIf (FlagSpawn = 2)
          NewFlagSpawn$ = Spawn(FlagID, PZone, 11.3225, 110.022, 48.7636, "Pvp_Flag_Right Click", "", ZoneNumSpawn) ;Spawn pvp flag in 1 of 3 places.
        ElseIf(FlagSpawn = 3)
          NewFlagSpawn$ = Spawn(FlagID, PZone, 508.802, 99.0043, 409.793, "Pvp_Flag_Right Click", "", ZoneNumSpawn) ;Spawn pvp flag in 1 of 3 places.
        ElseIf(FlagSpawn = 4)
          NewFlagSpawn$ = Spawn(FlagID, PZone, 79.5606, 89.8855, 459.374, "Pvp_Flag_Right Click", "", ZoneNumSpawn) ;Spawn pvp flag in 1 of 3 places.
        ElseIf(FlagSpawn = 5)
          NewFlagSpawn$ = Spawn(FlagID, PZone, - 76.009, 91.3214, 563.521, "Pvp_Flag_Right Click", "", ZoneNumSpawn) ;Spawn pvp flag in 1 of 3 places.
        ElseIf(FlagSpawn = 6)
          NewFlagSpawn$ = Spawn(FlagID, PZone, 465.644, 46.9174, 35.4374, "Pvp_Flag_Right Click", "", ZoneNumSpawn) ;Spawn pvp flag in 1 of 3 places.
        EndIf

     Else ; 1 vs 4 pvp battle ground

         ; Pick random flag spawn
        FlagSpawn% = Rand(1, 1)
        PZone$ = "pvp zone"
        If (FlagSpawn = 1)
           NewFlagSpawn$ = Spawn(FlagID, PZone, 349.381, 86.3859, 35.021, "Pvp_Flag_Right Click", "", ZoneNumSpawn) ;Spawn pvp flag in 1 of 3 places.
        ElseIf (FlagSpawn = 2)
         ;  NewFlagSpawn$ = Spawn(FlagID, PZone, - 194.895, 14.0905, 626.291, "Pvp_Flag_Right Click", "", ZoneNumSpawn) ;Spawn pvp flag in 1 of 3 places.
       ; ElseIf(FlagSpawn = 3)
       ;    NewFlagSpawn$ = Spawn(FlagID, PZone, - 112.562, 24.3904, 535.134, "Pvp_Flag_Right Click", "", ZoneNumSpawn) ;Spawn pvp flag in 1 of 3 places.
        EndIf

     Endif

 Doevents(1000)

 End Function

```