Difference between revisions of "LUA:AddQuestPrereqQuest"

(New page: Used whithin the "function Init(Quest)" function to set a required level for the quest. Here is an example from the quest, "He said, he said." in the Scale Yard. ---- function Init(Quest...)
 
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Used whithin the "function Init(Quest)" function to set a required level for the quest. Here is an example from the quest, "He said, he said." in the Scale Yard.
+
{{LUAFunction
 
+
|Name = AddQuestPrereqQuest
----
+
|Description = Adds a quest prerequisite to the given quest.
 
+
|Param1 = Quest
function Init(Quest)<br>
+
|Param1Desc = is the quest we are adding a prerequisite to
<br>
+
|Param2 = int32
RegisterQuest(Quest, "He said, he said", "Miscellaneous", "Scale Yard", 4, "Vrim tells me that Barbarians can be easily manipulated by the power of suggestion. I am to deceive two particular Barbarians and turn them agaist one another.")<br>
+
|Param2Desc = is the id of the prerequisite quest
-- Brood Matron's Private Reserve<br>
+
|Example =
-- Kunark Krisps<br>
+
<pre>
AddQuestRewardItem(Quest, 43957, 10)<br>
+
function Init(Quest)
AddQuestRewardItem(Quest, 44779, 10)<br>
+
    -- can only do this quest if you have completed quest 2
AddQuestRewardCoin(Quest, 2, 1, 0, 0)<br>
+
    AddQuestPrereqQuest(Quest, 2)
SetQuestRewardExp(Quest, 100)<br>
+
end
SetQuestPrereqLevel(Quest, 2)<br>
+
</pre>
'''AddQuestPrereqQuest(Quest, 142)'''<br>
+
|ExampleDesc = Only a player who has completed the quest with id 2 can do this quest.
<br>
+
|Notes = While this function should still work it is now prefered to add quest prerequisite data into the DB.
AddQuestStepChat(Quest, 1, "I must speak with Tristan. He is standing near the Heated Stone Inn.", 1, "I need to manipulate two Barbarians into hating each other.", 0, 1390036)<br>
+
}}
<br>
 
AddQuestStepCompleteAction(Quest, 1, "Step1_Complete_Tristan") <br>
 
<br>
 
SetCompletedDescription(Quest, "Success! I have fooled the Barbarians and turned them agaisnt one another.")<br>
 
QuestReturnNPC(Quest, 1390091)<br>
 
end<br>
 
 
 
----
 
This will call the "AddQuestPrereqQuest" function so that if the player has NOT completed quest 142 they will not have the option to get this quest. If you do not add a "AddQuestPrereqQuest" in the quest script an NPC that offers more than one quest will continue to have a feather over their head and try to offer you another quest.
 
 
 
--[[User:Xanibunib|Xanibunib]] 16:56, 3 April 2009 (CDT)
 

Latest revision as of 12:18, 30 January 2021


LUA:AllFunctions - AddQuestPrereqQuest

Return to: LUA:AllFunctions | Tutorials | Portal | Forum | Project Manager | Bug Tracker


Adds a quest prerequisite to the given quest.

Syntax

AddQuestPrereqQuest(param1, param2)

Parameters

Required - param1 (Quest), param2 (int32)
param1 is the quest we are adding a prerequisite to
param2 is the id of the prerequisite quest


Example

function Init(Quest)
    -- can only do this quest if you have completed quest 2
    AddQuestPrereqQuest(Quest, 2)
end

Only a player who has completed the quest with id 2 can do this quest.

Notes

While this function should still work it is now prefered to add quest prerequisite data into the DB.