FANDOM


Created by Taz.

Using "RC_Core.rcm"
; Morgance Online Verson 2
; Date/Time: 5:58:18 AM on 6/8/2012
; By Naddaz on NADCO
;low attack play sound and flash screen
;called from attack.
;Updated june 12 2012 added the second flash screen if health gets lower.
Function Main()
Player = Actor()
PLvl% = ActorLevel(Player)
;There will be no context actor
Pname$ = Name(Player)
ScriptLog("Sound heartbeat script running by " + Pname)

HasEffect% = ActorHasEffect(Player, "Low Health")
    
 Keeprunning% = 1
 Ticks% = 38 ;time before sound sould restart
 PlaySound(Player, 8)
 ScreenFlash(Player, 255, 0, 0, 156, 1000, 261)
 Repeat
 AddActorEffect(Target, "Low Health", "", 0, 13, 1)
 ;Play heart beat sound and flash screen
        PhP% = Attribute(Player, "Health")
        PhPMax% = MaxAttribute(Player, "Health")
        
         
       If (PLvl < 10)
        PhPTotal% = PhpMax * .35 ;get amount of health as a % should equal 35% for level under leevel 10
      Else
         PhPTotal% = PhpMax * .25 ;get amount of health as a % should equal 25% for level 10 and over
      EndIf
       
 PhPTotal2% = PhpMax * .10  ;If amount goes bellow 10% then change screen flash
            
 If (PhP <= PhPTotal2) ;if player is less then 10% change screen and sound speed.
 
         IsVamp% = ActorId("Vampire", "Form")
        PRace$ = Race(Player)     
        PClass$ = Class(Player)
        PlayerID% =ActorID(PRace, PClass)
        IsVampfly% = ActorHasEffect(Player, "Vampire Fly") 
                        
       If (IsVampfly = 1) ; if vamp flying allow blood bar to stay.
           PlayerID% = ActorId("Vampire", "Form")
       EndIf
                                                                    
        If(IsVamp = PlayerID) ;if player is a vampire
                Ticks% = Ticks - 3 ;Change tick amount to speed up heartbeat sound when lower health   
            PlaySound(Player, 47) ;playe vamp low health
            ScreenFlash(Player, 255, 0, 0, 185, 1000, 540)


            DoEvents(700)
            If (Ticks <= 0)
                Ticks% = 38 ;time before sound sould restart
                PlaySound(Player, 47) ;playe vamp low health
            EndIf
                 PlaySound(Player, 47) ;playe vamp low health  
            ScreenFlash(Player, 255, 0, 0, 175, 1000, 540)


        Else ;not vamp play normal flash screen and sound
            Ticks% = Ticks - 3 ;Change tick amount to speed up heartbeat sound when lower health   
            PlaySound(Player, 8)
            ScreenFlash(Player, 255, 0, 0, 185, 1000, 363)


            DoEvents(700)
            If (Ticks <= 0)
                Ticks% = 38 ;time before sound sould restart
                PlaySound(Player, 8)
            EndIf
                 PlaySound(Player, 8)   
            ScreenFlash(Player, 255, 0, 0, 175, 1000, 363)
        EndIf
        
 Else  ;play normal heartbeat and flash if lvl 10 and under is 35% health or less or lvl 10 or higher at 25% health 
 
         IsVamp% = ActorId("Vampire", "Form")
        PRace$ = Race(Player)     
        PClass$ = Class(Player)
        PlayerID% =ActorID(PRace, PClass)
        IsVampfly% = ActorHasEffect(Player, "Vampire Fly") 
                        
       If (IsVampfly = 1) ; if vamp flying allow blood bar to stay.
           PlayerID% = ActorId("Vampire", "Form")
       EndIf
                                                                    
    If(IsVamp = PlayerID) ;if player is a vampire
            
         PlaySound(Player, 47) ;playe vamp low health
        ScreenFlash(Player, 255, 0, 0, 185, 1000, 541)

        DoEvents(1200)
        If (Ticks <= 0)
            Ticks% = 38 ;time before sound sould restart
            PlaySound(Player, 47) ;playe vamp low health
        EndIf
          PlaySound(Player, 47) ;playe vamp low health  
        ScreenFlash(Player, 255, 0, 0, 175, 1000, 541)
    
         
     Else ;not vamp play normal flash screen and sound
	Ticks% = Ticks - 1 ;keep tick speed and normal.
        PlaySound(Player, 8)
        ScreenFlash(Player, 255, 0, 0, 185, 1000, 261)


        DoEvents(1200)
        If (Ticks <= 0)
            Ticks% = 38 ;time before sound sould restart
            PlaySound(Player, 8)
        EndIf
              PlaySound(Player, 8)   
        ScreenFlash(Player, 255, 0, 0, 175, 1000, 261)
     EndIf
 
 
 
 
         If (PhP >= PhPTotal) ;if player health goes above the % end script
            DeleteActorEffect(Player, "Low Health")
            Keeprunning% = 0
        EndIf
 EndIf        
         
 Until(Keeprunning = 0)
 
 DoEvents(1200)
 
 
 
 
 End Function