RealmCrafter Wiki
Advertisement

Created by Taz.

Using "RC_Core.rcm"
;Bounty hunter script
;By Tazco june 13 2012
Function Main()

Player = Actor()
Target = ContextActor()

PName$ = Name(Player)
ScriptLog("Bounty listings running by " + Pname)
	ChatBox$ = OpenDialog(Player, Target, "Bounty Hunter", 521) ;added default textre
	DialogOutPut(Player, ChatBox, "----- Please wait while list is retrived. -----")
	
	;Open bounty master list to get names.
			BML$ = "Bounty Master List.Txt"
			Bountylist% = OpenFile(BML)
				If (BountyList = 0) ;write file if it is not there. avoid a server invalid steam crash
				WriteBM$ = WriteFile(BML)
				CloseFile(WriteBM)
				CloseFile(Bountylist)
				CloseDialog(Player, ChatBox)
					ChatBox$ = OpenDialog(Player, Target, "Bounty Hunter", 521) ;added default textre
					DialogOutPut(Player, ChatBox, "There is no bountys avalible at this moment. Please try back later.")
					DialogInput(Player, ChatBox, "Close")
					CloseDialog(Player, ChatBOx)
					Return
				EndIf
			CloseFile(Bountylist) ;close file
			
;------------------------------------------------------------------------------------------			
		;Count players in list.	
		BML$ = "Bounty Master List.Txt"
		MasterBountylist% = OpenFile(BML)
			ListCount% = 0
			
			Repeat
			DoEvents(10)
			ListCount% = ListCount + 1
			ReadLine(MasterBountylist)
			EndOfFile% = Eof(MasterBountylist)
			
			
			Until(EndOfFile = 1)
			
			CloseFile(MasterBountylist) ;close file
			
;------------------------------------------------------------------------------------------			
			
			CloseDialog(Player, ChatBox)
			ChatBox$ = OpenDialog(Player, Target, "Bounty Hunter", 521) ;added default textre
			DialogOutPut(Player, ChatBox, "----- Writing bounty list. -----")
				
			If (ListCount <= 10) ;if bountys is under 10.
			  ChatBox1$ = OpenDialog(Player, Target, "Bounty Hunter", 521) ;added default textre
			  			BML$ = "Bounty Master List.Txt"
						MasterBountylist1% = OpenFile(BML)
						NewListCount% = ListCount
			  
			  		Repeat ;write list of bountys
			  			DoEvents(10)
			  			NewListCount% = NewListCount - 1
			  			NewRead$ = ReadLine(MasterBountylist1)
			  			DialogOutPut(Player, ChatBox1, + NewRead)
			  		
			  		
			  		
			  		Until (NewListCount = 0)
			  
			  	CloseFile(MasterBountylist1) ;close file
				CloseDialog(Player, ChatBox)
			EndIf
			
		
			
			
			If (ListCount >= 11) ;if bounty list is 11 or more.
			
					    ChatBox1$ = OpenDialog(Player, Target, "Bounty Hunter", 521) ;added default textre
			  			BML$ = "Bounty Master List.Txt"
						MasterBountylist1% = OpenFile(BML)
						NewListCount% = ListCount
						CountTimes% = 0	
						
						Repeat
						DoEvents(10)
						CountTimes% = CountTimes + 1
						NewListCount% = NewListCount - 1
			  			NewRead$ = ReadLine(MasterBountylist1)
			  			DialogOutPut(Player, ChatBox1, + NewRead)
			  		
			  		   		If (CountTimes = 9) ; give option to add name or continue with list.
			  		   			CloseDialog(Player, ChaBox)
			  		   			ChatBox$ = OpenDialog(Player, Target, "Bounty Hunter", 521) ;added default textre
			  		   			DialogOutPut(Player, ChatBox, "Would you like to enter one of these names or keep looking?")
			  		   			POption% = DialogInput(Player, ChatBox, "Enter name,Keep looking")
			  		   			
			  		   				If (POption = 2) ;Close and reopen chatbox1 to display the next page of names.
			  		   					CloseDialog(Player, ChatBox1)
			  		   					ChatBox1$ = OpenDialog(Player, Target, "Bounty Hunter", 521) ;added default textre
			  		   								  		   				
			  		   				EndIf
			  		   				
			  		   				
			  		   				If (POption = 1) ;open input so player can type name.
			  		   					CloseDialog(Player, ChaBox)
			  		   					ChatBox$ = OpenDialog(Player, Target, "Bounty Hunter", 521) ;added default textre
			  		   					DialogOutPut(Player, ChatBox, "Please input the name of player from the list behind this one.")
			  		   				EndIf
			  		   				
			  		   		
			  		   		EndIf
			
							EndOfFile% = Eof(MasterBountylist1)
								If (EndOfFile = 1)
								;at end of list give option to add name or cancel.
								EndIf
			
						Until(NewListCount = 0)
			
			EndIf
	
;-----------------------------------------------------------------------------------------------------------------------------------------	
		;Continue with bounty list.
		
		ChatBox$ = OpenDialog(Player, Target, "Bounty Hunter", 521) ;added default textre
		DialogOutPut(Player, ChatBox, "Enter a name from the list, Note move the window to see list if need be.")
		NamePick$ = Input(Player, "Listed name", "", 0)
	
			;Check if name entered has a bounty
				Namelisted1$ = + NamePick + " Bounty.Txt"
				Bountylist21% = OpenFile(Namelisted1)
	
					If (Bountylist21 = 0)
						CloseFile(Bountylist21)
						CloseDialog(Player, ChatBox)
						ChatBox$ = OpenDialog(Player, Target, "Bounty Hunter", 521) ;added default textre
						DialogOutPut(Player, ChatbOx, "Name entered was not found, please try again.")
						DialogInput(Player, ChatBox, "Close")
						CloseDialog(Player, ChatBox)
						CloseDialog(Player, ChatBox1)
						Return						
					EndIf
				
;---------------------------------------------------------------------------------------------------------------------------------
  					;Check Actor
							    Repeat
							     
							        ActorFound$ = FindActor(NamePick, 3) ;find actor set to find npc as well
							        Doevents(10)
							    ;  OutPut(Player, "name finding is " + ActorFound)
							        
							             If (ActorFound = 0) ;end loop if player not found
							               CloseDialog(Player, ChatBox)
							               ChatBox$ = OpenDialog(Player, Target, "Bounty Hunter", 521) ;added default textre
							               DialogOutPut(Player, ChatBox, "Player name not found.")  
							               DialogInPut(Player, ChatBox, "Close")
							         	   CloseDialog(Player, ChatBox)  
							         	   CloseDialog(Player, ChatBox1)            
							               PlayerFound = 1
							               
										   Return	
							             EndIf 
							            
							     Until (ActorFound >= 1) 
;---------------------------------------------------------------------------------------------------------------------------------							     
				CloseDialog(player, ChatBox)
				CloseDialog(player, ChatBox1)
				ChatBox$ = OpenDialog(Player, Target, "Bounty Hunter", 521) ;added default textre
				DialogOUtpUt(Player, ChatBox, "----- Please wait while some info on the bounty is collected.-----")

					BountyZone$ = ActorZone(ActorFound)

				BountyOnline% = PlayerInGame(ActorFound) ;Check if bounty is online.
					If (BountyOnline = 1) ;bounty online
							BountyIsOnline$ = "Online" ;set to one for bounty online
					
					EndIf
					
					If (BountyOnline = 0) ;bounty online
					 IsHuman1% = ActorIsHuman(ActorFound)
						If (IsHuman1 = 1)
							BountyIsOnline$ = "Offline" ;bounty is offline	
						Else
							BountyIsOnline$ = "NPC" ;bounty is an NPC	
						EndIf					
					EndIf	
					
				;get bounty current zone
				BountyZone$ = ActorZone(ActorFound)	
				
				;get bounty faction check
				Bountyfaction$ = HomeFaction(ActorFound)
			
				;get player facton
				InfoPlayerfaction$ = HomeFaction(Player)
				
				
				;Faction Calc
				  If (Bountyfaction = InfoPlayerfaction) ;if player and bounty are same faction
				  	NewFactionHum$ = "Humans"
				  	NewFactionEv$ = "Evil Humans"
				  	GmFaction$ = "GmOn" 
				  		If (Bountyfaction = NewFactionHum)	
				  			If (InfoPlayerfaction = NewFactionHum)
				  				FactionMsg$ = "You are the same faction and will take a rep loss, if you complete this bounty."	
				  			EndIf
				  			
				  		   If (InfoPlayerfaction = NewFactionEv)
				  				FactionMsg$ = "You are not the same faction and will take a rep gain to your faction, if you complete this bounty."
				  			EndIf
				  		 
				  		    If (InfoPlayerfaction = GmFaction)
				  		    	FactionMsg$ = "Your a gm leave the normal players alone, or take a gm bounty quest."				  		
				  			EndIf			  		
				  		EndIf
				  						  		
				  						  		
				  						  		
				  EndIf
				  		
				  		If (Bountyfaction = NewFactionEv)
				  			If (InfoPlayerfaction = NewFactionEv)	
				  				FactionMsg$ = "You are the same faction and will take a rep gain, if you complete this bounty."
				  			EndIf
				  			
				  			If (InfoPlayerfaction = NewFactionHum)
				  				FactionMsg$ = "You are not the same faction and will take a rep gain to your faction, if you complete this bounty."
				  			EndIf
				  				
				  		    If (InfoPlayerfaction = GmFaction)
				  		    	FactionMsg$ = "Your a gm leave the normal players alone, or take a gm bounty quest."				  		
				  			EndIf			  		
				  		EndIf
				  
				  
				  		If (Bountyfaction = GmFaction)	
				  		  If (InfoPlayerfaction = NewFactionHum)
				  			FactionMsg$ = "Bounty is on a gm and you will be unable to kill them."	
				  		 EndIf		
				  		 
				  		 If (InfoPlayerfaction = NewFactionEv)
				  			FactionMsg$ = "Bounty is on a gm and you will be unable to kill them."	
				  		 EndIf		
				  		 		 
				  		  If (InfoPlayerfaction = GmFaction)
				  			FactionMsg$ = "Bounty is on a gm and you will be able to kill them."	
				  		 EndIf	 
				  		 		  		
				  		 		  		
				    	EndIf
				  
				
				

				Namelisted1$ = + NamePick + " Bounty.Txt"
				Bountylist1% = OpenFile(Namelisted1)
					
					Repeat
					
				    New1Read$ = ReadLine(Bountylist1) ;Bounty name
					NewRead1$ = New1Read
					
					New2Read$ = ReadLine(Bountylist1) ;title
					NewRead2$ = New2Read
					
					New3Read$ = ReadLine(Bountylist1) ;reward
					NewRead3% = New3Read
					
					New4Read$ = ReadLine(Bountylist1) ;date issued
					NewRead4$ = New4Read
					
					New5Read$ = ReadLine(Bountylist1) ;reason for bounty
					NewRead5$ = New5Read
					
					New6Read$ = ReadLine(Bountylist1) ;Player name that posted bounty
					NewRead6$ = New6Read
					
					
					DoEvents(10)
					EndOfFile% = Eof(Bountylist1)
					Until (EndOfFile = 1)
					
			;Flash printing a few times	
			FlashAmount% = 7	
			  Repeat
			  FlashAmount% = FlashAmount - 1	
				CloseDialog(player, ChatBox)
				ChatBox$ = OpenDialog(Player, Target, "Bounty Hunter", 521) ;added default textre
				DialogOUtpUt(Player, ChatBox, "----- Printing info. -----")
				Doevents(900)
			  Until (FlashAmount <= 0)
			  	
				;output info to player abounty bounty
				CloseDialog(Player, ChatBox)
				ChatBox$ = OpenDialog(Player, Target, "Bounty Hunter", 521) ;added default textre
				DialogOutPut(Player, ChatBox, "---------- Bounty Info ---------- ")
				DialogOutPut(Player, ChatBox, "Name: " + NewRead1 +      "  Reward: " + NewRead3)				
				DialogOutPut(Player, ChatBox, "Title: " + NewRead2)
				DialogOutPut(Player, ChatBox, "Date Issued: " + NewRead4)
				DialogOutPut(Player, ChatBox, "Poster Name: " + NewRead6)
				DialogOutPut(Player, ChatBox, "Bounty Reason: " + NewRead5)
				DialogOutPut(Player, ChatBox, "------ Check page 2 next window ------")
			
				ChatBox1$ = OpenDialog(Player, Target, "Bounty Hunter", 521) ;added default textre
				DialogOutPut(Player, ChatBox1, "Curr zone of bounty: " + BountyZone)
				DialogOutPut(Player, ChatBox1, "Bounty Online status : " + BountyIsOnline)
				DialogOutPut(Player, ChatBox1, "Bounty Faction: " + Bountyfaction)
				DialogOutPut(Player, ChatBox1, "Your Faction: " + InfoPlayerfaction)
				DialogOutPut(Player, ChatBox1, "Faction Info: " + FactionMsg)
				DialogOutPut(Player, ChatBox1, "-------- End Bounty Info -------- ")
				DialogInput(Player, ChatBox1, "Close both windows")
				CloseDialog(Player, ChatBox)
				CloseDialog(Player, ChatBox1)
				
				
Return
End Function
Advertisement