Taz's Quest Template

*Part of the script pack made free by Taz.*

```
Using "RC_Core.rcm"
; Date/Time: 8:52:45 PM on 10/7/2010
; By Naddaz on TAZCO

Function Main()
Player = Actor()
Target = ContextActor()
PLvl% = ActorLevel(Player) ;Player Level
PName$ = Name(Player) ;Player Name
TargetName$ = Name(Target) ;target name
QuestReturn$ = "Return to " + TargetName + " to complete this quest." ; quest return status
Persistent(1)
;TotalQuestPoints% = Attribute(Player, "Quest Points") ;if using quest points uncommented and attribute added. Be sure to uncomment quest point check bellow.
ChatBox% = OpenDialog(Player, ChatBox, "Quest Giver")

;-------------------------------------------------------------------------------------------------------------------------------------------------
                    ;Start quest chain
;--------------------------------------------------------------------------------------------------------------------------------------------------
        If (Plvl <= 6) ;Output different chat for player level.
            DialogOutPut(Player, ChatBox, "Hello there newcomer", 200, 155, 175)
        Else
             DialogOutPut(Player, ChatBox, "Hello there " + PName, 200, 155, 175)
        Endif

 PlayerOption% = DialogInput(Player, ChatBox, "Lets Talk, Abandon Quests, Nothing") ;Give player options

 If (PlayerOption = 1) ;lets talk option

 ;-----------------------------------------------------------------------------------------------------------------------------------------------
            ;Check Quest points
;        If (TotalQuestPoints <= 7) ; quest points need to be 8 or higher
;            DialogOutPut(Player, ChatBox, "You need 8 or more quest points to do some quests for me, Sorry not my rules.", 200, 155, 175)
;            DoEvents(1500)
;            DialogOutPut(Player, ChatBox, "You have " + TotalQuestPoints + " Total quest points.", 200, 155, 175)
;            DialogInput(Player, ChatBox, "I will come back.")
;            DoEvents(500)
;            CloseDialog(Player, ChatBox)
;        Endif

             ;End QuestPoint Check
;------------------------------------------------------------------------------------------------------------------------------------------------

;------------------------------------------------------------
            ;Start quest Get some wood
;------------------------------------------------------------
    RewardMoney% = 3500 ; amount of money to be rewarded
	RewardXp% = 410 ;Amount of xp to be rewarded
	RewardItem$ = "Arrows" ;item to be rewarded
	RewardItemQuantity% = 200 ;amount of item to be given
	RewardFaction$ = "Humans" ;faction name for reward to be given to.
	RewardFactionValue% = 4 ;amount of faction to give

	QuestName$ = "Get Some Wood!!" ;Name of quest
	QuestResults$ = QuestStatus(Player, QuestName)
	QuestStatusText$ = "Collect 7 Oak Logs." ;text to add to in-game quest log.

     If (QuestResults = "")
		; The quest needs to be started
        ;Output text to player when quest is being started.
		DialogOutput(Player, ChatBox, "I am in need of Oak Logs, could you cut some oak trees for me?", 255, 255, 255)
		POption% = DialogInput(Player, ChatBox, "Sure thing, No way") ; Option to start quest

         If (POption = 1)
                ;Make new quest
                NewQuest(Player, QuestName, QuestStatusText, 255, 255, 255)
                Itemcheck% = HasItem(Player, "WoodCutting Axe")
                If (Itemcheck = 0)
                    GiveItem(Player, "WoodCutting Axe")
                    OutPut(Player, "You have recived a Woodcutting Axe", 200, 155, 175)
                Endif
            SaveState()

             WaitItemName$ = "Oak Logs"
            WaitItemQuantity% = 7
             DoEvents(500)
             CloseDialog(Player, ChatBox)

     		WaitItem(Player, WaitItemName, WaitItemQuantity)
            DoEvents(1400)
                If (HasItem(Player, WaitItemName, WaitItemQuantity) > 0)

                EndIf
            OutPut(Player, "All items aquired, return to " + TargetName + " to complete this quest.", 200, 123, 123)
			UpdateQuest(Player, QuestName, QuestReturn, 255, 255, 255)
            Return
        ElseIf (POption = 2)
        CloseDialog(Player, Chatbox)
        ChatBox% = 0
        EndIf
     Endif

 ;--------------------------------------------------------------
                ;End Quest start section
;--------------------------------------------------------------

 ;-------------------------------------------------------------------
         ; The quest has been completed, assign rewards
;-------------------------------------------------------------------
   If (QuestResults = QuestReturn)
		DialogOutPut(Player, ChatBox, "Thank you for collecting oak logs for me, you can keep the Woodcutting Axe. Talk to me again I may have something else for you.", 125, 45, 34)
        DialogInput(Player, ChatBox, "Close")
        CompleteQuest(Player, QuestName)
		; Item reward for Step/Quest
		GiveItem(Player, RewardItem, RewardItemQuantity)
        GiveItem(Player, "Oak Logs", - 7) ;Take Quest Item from player
        ; Give quest point amount to player for completeing the quest
        TotQuestPoints% = Attribute(Player, "Quest Points") + 2 ;change to the number of quest points given to the player.
        SetAttribute(Player, "Quest Points", Totquestpoints)
        OutPut(Player, "You have recived " + TotQuestPoints + " total quest points", 125, 45, 34)

		; XP reward for Step/Quest
		GiveXp(Player, RewardXp)

		; Money reward for Step/Quest
		ChangeGold(Player, RewardMoney)

		; Faction change
		ChangeFactionRating(Player, RewardFaction, RewardFactionValue)

		Output(Player, "You take " + RewardItemQuantity + " " + RewardItem + " and " + RewardMoney + "gp and " + RewardXp + "xp you have earnt it!")
		CloseDialog(Player, ChatBox)

    ElseIf (QuestComplete(Player, QuestName) = 1) ; The quest has been completed
;ADDED OTHER QUEST IN THE CHAIN HERE
        DialogOutput(Player, ChatBox, "Thanks for helping me out with " + QuestName + "" + CHR(44) + " I have no other quests for you at this time ... good day !", 255, 0, 0)
        DialogInput(Player, ChatBox, "Close")
		DoEvents (1000)
        CloseDialog(Player, ChatBox)

    Endif

 ;-------------------------------------------------------------------
            ; End Reward, quest complete collect 7 oak logs
;-------------------------------------------------------------------

 ;---------------------------------------------------------------
                ;Abandon quest section
;---------------------------------------------------------------
ElseIf(PlayerOption = 2) ;abandon quests options
DialogOutPut(Player, ChatBox, "Are you sure you want to abandon quests ", 124, 56, 76)

AbandonOptions% = DialogInPut(Player, ChatBox, "Get Some Wood!!,Bow crafting,Nevermind")

        If (AbandonOptions = 1) ;option "Get Some Wood!!"
            QuestName$ = "Get Some Wood!!"
           If (QuestComplete(Player, QuestName) = 0)
            DeleteQuest(Player, "Get Some Wood!!")
            DoEvents(1000)
            DialogOutPut(Player, Chatbox, "Quest removed", 255, 0, 0)
            DialogInPut(Player, ChatBox, "Ok")
            CloseDialog(Player, ChatBox)
            Return
           Else
              OutPut(Player, "You can not abandon a completed quest", 255, 0, 0)
             CloseDialog(Player, ChatBox)
             Return
           EndIf
        ElseIf (AbandonOptions = 2) ;option "Get Some Wood!!"
            QuestName$ = "Bow crafting"
           If (QuestComplete(Player, QuestName) = 0)
            DeleteQuest(Player, "Bow crafting")
            DoEvents(1000)
            DialogOutPut(Player, Chatbox, "Quest removed", 255, 0, 0)
            DialogInPut(Player, ChatBox, "Ok")
            CloseDialog(Player, ChatBox)
            Return
          Else
              OutPut(Player, "You can not abandon a completed quest", 255, 0, 0)
             CloseDialog(Player, ChatBox)
             Return
          EndIf

         ElseIf (AbandonOptions = 3) ;Option nevermind

             DialogOutPut(Player, ChatBox, "Take a second to rethink.!", 255, 125, 5)
            DoEvents(2000)
            CloseDialog(Player, ChatBox)
        Endif
 ;---------------------------------------------------------
            ;End Abandon Quest section
;---------------------------------------------------------

ElseIf (PlayerOption = 3)
    DialogOutPUt(PLayer, ChatBox, "Ok then come back later.", 200, 155, 175)
    DialogInput(Player, ChatBox, "Close")
    DoEvents(1000)
    CloseDialog(Player, ChatBox)
Endif

 ;-----------------------------
End Function

```