Difference between revisions of "LUA:Accepted"

Line 1: Line 1:
Calls up this function only if the offered quest is accepted. This function is usualy placed after a "function Init(Quest)" in your quest scripts. Here is an example...<br>
+
'''Syntax'''<br>
----
+
 
<br>
+
'''Explanation'''<br>
'''function Accepted(Quest, QuestGiver, Player)'''<br>
+
Calls up this function only if the offered quest is accepted. This function is placed in your "function Init(Quest)" in your quest scripts.<br>
if QuestGiver ~= nil then<br>
+
 
if GetDistance (Player, QuestGiver) < 30 then<br>
+
 
FaceTarget (QuestGiver, Player)<br>
+
'''Example'''<br>
conversation = CreateConversation()<br>
+
  function Accepted(Quest, QuestGiver, Player)<br>
<br>
+
    if QuestGiver ~= nil then
AddConversationOption(conversation, "Blah blah blah")<br>
+
      if GetDistance (Player, QuestGiver) < 30 then
StartConversation(conversation, QuestGiver, Player, "blah blah blah")<br>
+
          FaceTarget (QuestGiver, Player)
end<br>
+
          conversation = CreateConversation()
end<br>
+
         
end<br>
+
          AddConversationOption(conversation, "Blah blah blah")
 +
          StartConversation(conversation, QuestGiver, Player, "blah blah blah")
 +
          end
 +
        end
 +
  end
 +
 
  
----
 
 
In this example when the quest offered is accepted it will start the conversation.
 
In this example when the quest offered is accepted it will start the conversation.
  
--[[User:Xanibunib|Xanibunib]] 17:01, 3 April 2009 (CDT)
+
 
  
  
  
 
[http://www.eq2emulator.net/wiki/index.php/Developer:LUA_Functions Back to LUA Functions]
 
[http://www.eq2emulator.net/wiki/index.php/Developer:LUA_Functions Back to LUA Functions]

Revision as of 17:27, 3 April 2009

Syntax

Explanation
Calls up this function only if the offered quest is accepted. This function is placed in your "function Init(Quest)" in your quest scripts.


Example

 function Accepted(Quest, QuestGiver, Player)
if QuestGiver ~= nil then if GetDistance (Player, QuestGiver) < 30 then FaceTarget (QuestGiver, Player) conversation = CreateConversation() AddConversationOption(conversation, "Blah blah blah") StartConversation(conversation, QuestGiver, Player, "blah blah blah") end end end


In this example when the quest offered is accepted it will start the conversation.



Back to LUA Functions