Difference between revisions of "LUA:AddQuestPrereqQuest"

Line 1: Line 1:
'''Syntax'''<br>
+
= LUA Functions: AddQuestPrereqQuest() =
AddQuestPrereqQuest(Quest, QuestID)<br>
+
Adds a quest prerequisite to the given quest.
  
'''Explination'''<br>
 
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.
 
  
----
+
==== Syntax ====
 +
AddQuestPrereqQuest(param1, param2)
  
  function Init(Quest)<br>
 
    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>
 
    -- Brood Matron's Private Reserve<br>
 
    -- Kunark Krisps<br>
 
    AddQuestRewardItem(Quest, 43957, 10)<br>
 
    AddQuestRewardItem(Quest, 44779, 10)<br>
 
    AddQuestRewardCoin(Quest, 2, 1, 0, 0)<br>
 
    SetQuestRewardExp(Quest, 100)<br>
 
    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>
 
  
----
+
==== Parameters ====
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.
+
; Required - ''param1'' (Quest), ''param2'' (int32)
 +
: ''param1'' is the quest we are adding a prerequisite to
 +
: ''param2'' is the id of the prerequisite quest
  
 +
==== Usage ====
 +
<pre>
 +
function Init(Quest)
 +
    -- can only do this quest if you have completed quest 2
 +
    AddQuestPrereqQuest(Quest, 2)
 +
end
 +
</pre>
  
 
+
Only a player who has completed the quest with id 2 can do this quest.
 
 
[http://www.eq2emulator.net/wiki/index.php/Developer:LUA_Functions Back to LUA Functions]
 

Revision as of 15:11, 11 October 2012

LUA Functions: AddQuestPrereqQuest()

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

Usage

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.