Swij
Active Member
Demon helmet quest!
In this tutorial i will be showing you how to make a functioning DHQ,
to begin with i didn't write the entire script myself that credits goes to Oxious,
I did write some parts to make the quest a little bit better.
but he didn't explain how to install it so i'll do that.
This script allows players to enter the Quest room until somebody throws the switch,
after 40 seconds the room will be opened again and during that time the players inside will be able to take the reward and leave the room.
1) Create your own map. Looking like the one on the picture. and add the reward of your choice in the 3 chests. dont forget to make a teleport into the quest room .
chests - Action id 2000
chest 1 - Unique id 30017
chest 2 - Unique id 30018
chest 3 - Unique id 30019
lever - Unique ID 30016
2) Create a text file and paste the script below, and enter your own coordinates. Save this as DHQ.lua in your "data\actions\scripts\quests" directory.
PHP:
local pinkstonepos1 = {x=XXXX, y=YYYY, z=Z} -- Blocking stone position.
local TeleportToPos = { x = XXXX, y = YYYY, z = Z} -- Position the player will be ported to when leaving the DHQ, like the Temple...
local TeleportInPos = { x = XXXX, y = YYYY, z = Z} -- Position In DHQ.
local LeverPos = { x = XXXX, y = YYYY, z = Z} -- Lever Position
local TeleportoutPos = { x = XXXX, y = YYYY, z = Z} -- Telporter out pos
local timeToRemove = 40 -- Time before quest reset
function onUse(cid, item, frompos, item2, topos)
local pinkstone1 = getTileItemById(pinkstonepos1, 1355) -- You can change the ID to any other kind of blocking item
local teleport = getTileItemById(TeleportInPos, 1387)
if item.itemid == 1945 then
doRemoveItem(pinkstone1.uid, 1)
doCreateTeleport(1387, TeleportToPos, TeleportOutPos)
doSendMagicEffect(TeleportInPos, CONST_ME_TELEPORT)
doPlayerSendTextMessage(cid,22,"The stone is removed, get the reward before the time runs out!") -- Message when the lever is pulled
addEvent(doRemoveTeleport, timeToRemove * 1000)
else if item.itemid == 1946 then
doPlayerSendCancel(cid,"Sorry, not possible.") -- message if the lever is pulled again.
return 1
end
end
end
function doRemoveTeleport()
local teleport = getTileItemById(TeleportInPos, 1387)
local Lever = getTileItemById(LeverPos, 1946)
if teleport.uid > 0 then
doCreateItem(1355, 1, pinkstonepos1)
doRemoveItem(teleport.uid)
doSendMagicEffect(TeleportInPos, CONST_ME_POFF)
doTransformItem(Lever.uid, 1945)
end
end
3) Now open your Actions.xml and add this line somwere after <Actions>
This one works on TFS 0.3.1 <-
PHP:
<action uniqueid="30016" script="quests/DHQ.lua"/>
This one works on the TFS 0.3.2 ->
PHP:
<action uniqueid="30016" event="script" value="quests/DHQ.lua"/>
4) Now your Quest should be working, just reload your server and try it . Give me Rep++ if this tutorial helped you.
This scripts works perfectly on TFS 0.3.1, if your using the newer TFS you will have to add the second actions line.
//Swij
Last edited: