FANDOM


Created by Taz.

Using "RC_Core.rcm"
; By Tazco
 ;Pet test ability
Function Main()

Player = Actor()
Target = ContextActor()


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


PetID$ = ActorID("Gremlin", "") ;pet id
Petname$ = "Gremlin"  ;Pet Name
PetFound% = 0 ;Used for repeat if = 1 end repeat

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



   If (Target = 0) ; Check target is valid

  		Output(Player, "Select a target for your pet to attack!")
 		Return
    EndIf
 ;--------------------------------------------------------------------------------------------------------


;Look for actor pet
;Repeat
 
 PetToFind# = FindActor(Petname, 2) ;type 2 search through NPCs
 NpcName$ = Name(PetToFind) ;found actor name
 
 	If (NpcName = Petname) ;If npc found is a gremlin pet
 
 
 			Result% = ActorDistance(PetToFind, Target)
 			 If (Result > 30)  ;check distance of target.
 					Output(Player, "Your pet is to far away!")
 					PetFound = 1
 					Return
 				
 			 EndIf
 			
 		PetOwnerName$ = ActorGlobal(PetToFind, 1) ;check for pet owner name.
 
 		If (PetOwnerName = PName) ;see if pet found is players pet. Check stored name to player name.
 		
 		     PetFound = 1
 		     BubbleOutPut(PetToFind, "CHARGE!!")
 			 SetActorAIState(PetToFind, 5) ;set pet attack	
 			 
 		EndIf
 
 
 
 	EndIf
 DoEvents(10)
 
 	If (PetOwnerName = "")
 		OutPut(Player, "You must have a summoned pet, to use this ability.")
 		PetFound = 1
 		Return	
 	EndIf
 
 ;Until (PetFound = 1)


End Function