PDA

View Full Version : [Lua]Kerp's and Wolferine's Sample Escort Quest



Wolferine
15-11-09, 01:33 PM
--[[
This sample escort quest is scripted by Wolferine and Kerp.
Do not claim this to be yours.
Do not re-release without my permission.
Do not remove these credits.
]]

local NPC_ID = Npc ID here
local QUEST_ID = Quest ID here
local NPC_ID2 = Npc ID Spawn 2
local NPC_ID3 = Npc ID Spawn 3
local NPC_ID4 = NPC ID Spawn 4


function OnQuestAccept(event, pPlayer, pQuestGiver, questId)
if(pQuestGiver == NPC_ID) and (questId == QUEST_ID) then
pUnit:SendChatMessage(12, 0, "We better be going else they will notice I left!")
pUnit:RegisterEvent("Escort_Move", 1000, 1)
end
end

function Escort_Move(pUnit, Event)
pUnit:GetX()
pUnit:GetY()
pUnit:GetZ()
pUnit:MoveTo(0, x+10, y, z)
pUnit:RegisterEvent("Escort_Move2", 5000, 1)
end

function Escort_Move2(pUnit, Event)
pUnit:GetX()
pUnit:GetY()
pUnit:GetZ()
pUnit:MoveTo(0, x+10, y, z)
pUnit:RegisterEvent("Escort_Move3", 10000, 1)
end

function Escort_Move3(pUnit, Event)
pUnit:SendChatMessage(12, 0, "I really need to catch breath...")
pUnit:RegisterEvent("Escort_Spawn", 5000, 1)
end

function Escort_Spawn(pUnit, Event)
pUnit:SendChatMessage(12, 0, "Watch out!")
pUnit:GetX()
pUnit:GetY()
pUnit:GetZ()
pUnit:SpawnCreature(NPC_ID2, x+5, z+5, y, 0)
pUnit:SpawnCreature(NPC_ID3, x+10, z+5, y, 0)
pUnit:SpawnCreature(NPC_ID4, x+7, z+7, y, 0)
pUnit:RegisterEvent("Escort_Move4", 40000, 1)
end

function Escort_Move4(pUnit, Event)
pUnit:SendChatMessage(12, 0, "Phew, that was close.")
pUnit:GetX()
pUnit:GetY()
pUnit:GetZ()
pUnit:MoveTo(1, x+10, z, y, 0)
pUnit:RegisterEvent("Escort_Complete", 10000, 1)
end

function Escort_Complete(pUnit, Event)
pUnit:SendChatMessage(12, 0, "Thanks for helping me man!")
player:QuestComplete(QUEST_ID)
pUnit:Despawn()
end

RegisterServerHook(14, "OnQuestAccept")

This is scripted as a sample for further use by Lua scripters.

This scripts will trigger with an additional server hook( added in LuaHypArc) if you accept the quest the npc will begin to move.
Do notice this will not work without LuaHypArc.
If you have any questions about the script, add my msn, [email protected]
Feel free to add me for just a chat also.

Dimman
15-11-09, 01:45 PM
1. try to use normal words not "phew" ... etc..etc
2. "Thanks for helping me man!"... what if it is a female ? ...
3. Goodluck and keep up the good work

Regards, Dimman (axel)

Wolferine
15-11-09, 02:06 PM
It's a sample script, read for once.

Dimman
15-11-09, 02:30 PM
It's a sample script, read for once.
But if you are making more scripts just think about what i said, people will like it more :)

StickyIcky
15-11-09, 09:26 PM
+repx3, nice job

enegue
16-11-09, 03:58 AM
Bah, Dinman said what I wanted to..

Wolferine
16-11-09, 09:57 AM
Thanks for your comments =)

enegue
17-11-09, 03:30 AM
Improve it a bit more and release a 2nd version :)

Wolferine
17-11-09, 09:06 AM
I'll if I have time.

enegue
18-11-09, 03:29 AM
Buy more time x)