FANDOM


Created by Taz.

Using "RC_Core.rcm"
; Define entry function 'Main'
;Kill pet that is summoned.
;Must add a new repeat section for each new pet.


Function Main()

Player = Actor()
Target = ContextActor()


PName$ = Name(Player)
TName$ = Name(Target)


;------------------------------------------------------------------------------------------------
;Kill tamed pet.

StoredTamedID% = Split(ActorGlobal(Player, 3), 21, "|")
    If (StoredTamedID > 0)
        ;Check Tamed Pet Health see if its still alive.
        TamedHP% = Attribute(StoredTamedID, "Health")
            If (TamedHP > 0) ;tamed npc is alive so kill it.                
                    SetAttribute(StoredTamedID, "Health", 0)
                    Return
            Else
                OutPut(Player, "You dont have a pet out.", 255, 127, 21)
                Return
            Endif
    Endif
 ;End Kill tamed pet.
;------------------------------------------------------------------------------------------------


;------------------------------------------------------------------------------------------------
;------------------------------------------------------------------------------------------------

;Kill Gremlin Pet
PetID$ = ActorID("Gremlin", "") ;pet id
Petname$ = "Gremlin"  ;Pet Name

PetFound% = 0 ;Used for repeat if = 1 end repeat


;Look for actor pet
;Repeat
 
 
 PetToFind$ = FindActor(Petname, 2) ;type 2 search through NPCs
 PetTag$ = Tag(PetToFind)
 NpcName$ = Name(PetToFind) ;found actor name
 PetOwnerName$ = ActorGlobal(PetToFind, 1) ;check for pet owner name.
 FirstPet$ = PetTag ;Tag of first pet in zone found.
 
 ;Look for actor pet
Repeat ;check if player has a pet already

;OutPut(Player, "Stored pet name " + PetOwnerName)
   If (PetOwnerName = Pname)
    EndRepeat% = 1
   Else
 	If Not (PetTag = + PName + "s Pet") ;If npc found is a gremlin pet			
 
             PetToFind$ = NextActorInZone(PetToFind)
            NpcName$ = Name(PetToFind) ;found actor name
            PetTag$ = Tag(PetToFind)
            PetOwnerName$ = ActorGlobal(PetToFind, 1) ;check for pet owner name.

	EndIf
  Endif  
 DoEvents(1)
 
 
     
 Until (PetTag = + PName + "s Pet") or (PetTag = FirstPet) or (EndRepeat = 1) ;end if pet is out check
 
     If (PetOwnerName = Pname)
		     ;do pet suicide if pet is gremlin
			 AnimateActor(PetToFind, "Suicide", .5, 2)
			 
			 Doevents(5000)
			 AddActorEffect(PetToFind, "Dead", "", 0, 1220, 13) ;give effct so death scipt will not run death animation.
             PetFound = 1
             SetActorGlobal(PetToFind, 9, "PetDead") ;used in death scrip so death animation does not play
             SetAttribute(PetToFind, "Health", 0) ;kill pet

    Else
         OutPut(Player, "You do not have a pet spawned.")
    
     Endif
 
 
 
 End Function