Difference between revisions of "LUA:AddQuestPrereqQuest"

 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
'''Syntax'''<br>
+
{{LUAFunction
AddQuestPrereqQuest(Quest, QuestID)<br>
+
|Name = AddQuestPrereqQuest
 
+
|Description = Adds a quest prerequisite to the given quest.
'''Explination'''<br>
+
|Param1 = Quest
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.
+
|Param1Desc = is the quest we are adding a prerequisite to
 
+
|Param2 = int32
----
+
|Param2Desc = is the id of the prerequisite quest
 
+
|Example =
  function Init(Quest)<br>
+
<pre>
    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>
+
function Init(Quest)
    -- Brood Matron's Private Reserve<br>
+
    -- can only do this quest if you have completed quest 2
    -- Kunark Krisps<br>
+
    AddQuestPrereqQuest(Quest, 2)
    AddQuestRewardItem(Quest, 43957, 10)<br>
+
end
    AddQuestRewardItem(Quest, 44779, 10)<br>
+
</pre>
    AddQuestRewardCoin(Quest, 2, 1, 0, 0)<br>
+
|ExampleDesc = Only a player who has completed the quest with id 2 can do this quest.
    SetQuestRewardExp(Quest, 100)<br>
+
|Notes = While this function should still work it is now prefered to add quest prerequisite data into the DB.
    SetQuestPrereqLevel(Quest, 2)<br>
+
}}
    '''AddQuestPrereqQuest(Quest, 142)'''<br>
 
    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>
 
    AddQuestStepCompleteAction(Quest, 1, "Step1_Complete_Tristan") <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.
 
 
 
 
 
 
 
 
 
[http://www.eq2emulator.net/wiki/index.php/Developer:LUA_Functions Back to LUA Functions]
 

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.