ryandometal
Guitarist!
Hello everyone, this is my first script that post here in the community, I am not very good at it, but after a while I got to make it work 100%.
-----------------------------------------
Description:
Killing in the Name of... Quest - TibiaWiki - Quests, Items, Spells, and more
Distro tested:
The Forgotten Server 0.2.2/0.2.3/0.2.4
First, let's do the NPC.
Go on a data/NPC and create a file .xml with the name of Raymond Striker. Copy this into the file and save:
Now, on data/NPC/scripts, create a file called killing_quest.lua and copy this inside:
Change only what is in red, in the words of the NPC, and storagevalue of the quest.
You can also modify the reward of quest, rather than doPlayerAddExp (cid, amount), put doPlayerAddItem (cid, IDDOITEM, QUANTITY).
Now go to the folder data/creaturescripts/scripts and create a file with the name kill_counter.lua, then add this in it:
You can change the names of the monsters to be faced, if you have a different quest. In this example we used pirates: P
Ahh, to change the amount of monsters that the player must kill, here where change is in red:
if getPlayerStorageValue (cid, 45004)> = 1200
1200 = number of monsters
If the quantity change, do not forget to change the messages highlighted in red for the correct number of monsters to be faced!
Also in the folder creaturescripts/scripts, open the file login.lua and add the following command under "onLogin function (cid)":
Open the file Onkill.lua and add the same command:
Now go on data/creaturescripts and open the file creaturescripts.xml, add the following tag:
Finally, go to data/actions/scripts, create a file called piratedoor.lua and add this:
Open the file actions.xml, and add the tag:
Change only what is in red, reminding that in the end, 8735 is the UniqueID you put in the door on your map editor, 5290 is the id of the door, both can be changed!
Create an area similar to that of the screenshot, and do not forget to add the NPC on the map!
Thanks to Slawkens to create part of the script, Zakius and to Val(xtibia) for taking a course
If it helps you, give rep++
Report bugs here, and have fun!
PS:Sorry for english, using translator
-----------------------------------------
Description:
Killing in the Name of... Quest - TibiaWiki - Quests, Items, Spells, and more
Distro tested:
The Forgotten Server 0.2.2/0.2.3/0.2.4
First, let's do the NPC.
Go on a data/NPC and create a file .xml with the name of Raymond Striker. Copy this into the file and save:
PHP:
<?xml version="1.0"?>
<npc name="Raymond Striker" script="data/npc/scripts/killing_quest.lua" access="3" lookdir="2" walkinterval="2000">
<mana now="800" max="800"/>
<health now="200" max="200"/>
<look type="151" head="115" body="76" legs="35" feet="117" addons="1" corpse="6080"/>
<parameters>
<parameter key="message_greet" value="Hello, what do you do here? Want something? "/>
</parameters>
</npc>
Now, on data/NPC/scripts, create a file called killing_quest.lua and copy this inside:
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid)
npcHandler:onCreatureAppear(cid)
end
function onCreatureDisappear(cid)
npcHandler:onCreatureDisappear(cid)
end
function onCreatureSay(cid, type, msg)
npcHandler:onCreatureSay(cid, type, msg)
end
function onThink()
npcHandler:onThink()
end
function say(param)
npcHandler:say(param.text,param.cid)
end
function delayedSay(text, delay, cid)
if(not npcHandler:isFocused(cid)) then
return FALSE
else
local param = {cid = cid, text = text}
local delay = delay or 0
local cid = cid or 0
local nid = getNpcCid()
addEvent(say, delay, param)
end
end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local quest = 86669
local reward = 90000
local TALKDELAY_ONTHINK = 1
if msgcontains(msg, 'task') then
delayedSay("The pirates on Nargor are becoming more and more of a threat to us each day. I wish someone could get rid of them once and for all, but unfortunately they just keep coming! ...", 100, cid)
delayedSay("Only a dead pirate is a good pirate. I think killing a large number of them would definitely help us to make Sabrehaven a safer place. ...", 12000, cid)
delayedSay("It doesn't matter how long it takes, but... would you be willing to kill 1200 pirates for us?", 23000, cid)
talkState[talkUser] = 2
elseif(getPlayerStorageValue(cid, quest) == 2) then
delayedSay("Come back here when you finish your mission.", 10, cid)
elseif(getPlayerStorageValue(cid, quest) == 3) then --pirates
delayedSay("Hey, great. You've done well! As a small reward I give you some coins from our treasure box. Also, let me tell you an interesting piece of information. ...", 100, cid)
delayedSay("One our of spies told us about a secret hideout somewhere on Nargor. Supposedly, one of the four pirate leaders can be found there sometimes. If you dare go there, you might be able to face him or her in one on one combat. ...", 12000, cid)
delayedSay("Beware though - prepare yourself well and only flee if you must. This might be your only chance to get into there, so be careful and don't die!", 23000, cid)
doPlayerAddExp(cid, 300000)
setPlayerStorageValue(cid, quest, 4)
setPlayerStorageValue(cid, 696969, 1) ---questdoor storage---
elseif(getPlayerStorageValue(cid, quest) == 4) or (getPlayerStorageValue(cid, 696969) == 2) then
delayedSay("Hm... you already helped me a lot, do not need more of you here, thanks! You expect more missions!", 100, cid)
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then
delayedSay("Perfect. I know it sounds like a lot, but really, take your time. You won't do it for nothing, I promise, {ok}?.", 100, cid)
talkState[talkUser]= 3
elseif msgcontains(msg, 'ok') and talkState[talkUser] == 3 then
delayedSay("Okay, now go and kill pirates. And after that go back and report!", 100, cid)
setPlayerStorageValue(cid, quest, 2)
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Change only what is in red, in the words of the NPC, and storagevalue of the quest.
You can also modify the reward of quest, rather than doPlayerAddExp (cid, amount), put doPlayerAddItem (cid, IDDOITEM, QUANTITY).
Now go to the folder data/creaturescripts/scripts and create a file with the name kill_counter.lua, then add this in it:
PHP:
local monsters = {
--name = storage
["pirate buccaneer"] = 45004,
["pirate corsair"] = 45004,
["pirate cutthroat"] = 45004,
["pirate marauder"] = 45004,
["pirate ghost"] = 45004
}
function onKill(cid, target)
if(isPlayer(target) ~= TRUE) then
local name = getCreatureName(target)
local monster = monsters[string.lower(name)]
if(monster) then
local killedMonsters = getPlayerStorageValue(cid, monster)
if(killedMonsters == -1) then
killedMonsters = 1
end
if(name == "pirate buccaneer" or name == "pirate corsair" or name == "pirate cutthroat" or name == "pirate marauder" or name == "pirate ghost") and getPlayerStorageValue(cid, 86669) == 2 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have killed " .. killedMonsters .. " of 1200 pirate's.")
setPlayerStorageValue(cid, monster, killedMonsters + 1)
if getPlayerStorageValue(cid, 45004)>=1200 then
setPlayerStorageValue(cid, 86669, 3)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have killed enought pirate's.")
end
end
end
return TRUE
end
end
You can change the names of the monsters to be faced, if you have a different quest. In this example we used pirates: P
Ahh, to change the amount of monsters that the player must kill, here where change is in red:
if getPlayerStorageValue (cid, 45004)> = 1200
1200 = number of monsters
If the quantity change, do not forget to change the messages highlighted in red for the correct number of monsters to be faced!
Also in the folder creaturescripts/scripts, open the file login.lua and add the following command under "onLogin function (cid)":
PHP:
registerCreatureEvent(cid, "KillingInTheNameOf")
Open the file Onkill.lua and add the same command:
PHP:
registerCreatureEvent(cid, "KillingInTheNameOf")
Now go on data/creaturescripts and open the file creaturescripts.xml, add the following tag:
PHP:
<event type="kill" name="KillingInTheNameOf" script="kill_counter.lua"/>
Finally, go to data/actions/scripts, create a file called piratedoor.lua and add this:
PHP:
local bossroom = {x=880, y=617, z=2} ---coordenadas da sala onde o jogador será teleportado ao clicar na porta
local spawn = {x=886, y=608, z=2} ---coordenadas de onde irá nascer o boss
function onUse(cid, item, pos, frompos, item2, topos)
local randommonsters = {"brutus bloodbeard", "deadeye devious", "lethal lissy", "ron the ripper"}
local randomboss = math.random(1,4)
if getPlayerStorageValue(cid,696969) == 1 then
doTeleportThing(cid, bossroom)
doSendMagicEffect(bossroom,10)
doSummonCreature(randommonsters[randomboss], spawn)
setPlayerStorageValue(cid, 696969, 2)
else
if item.uid == 8735 and item.itemid == 5290 then
if getPlayerStorageValue(cid,696969) <= 0 or getPlayerStorageValue(cid,696969) >= 2 then
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'The door seems to be sealed against unwanted intruders.')
end
end
end
end
Open the file actions.xml, and add the tag:
PHP:
<action uniqueid="8735" script="piratedoor.lua" />
Change only what is in red, reminding that in the end, 8735 is the UniqueID you put in the door on your map editor, 5290 is the id of the door, both can be changed!
Create an area similar to that of the screenshot, and do not forget to add the NPC on the map!
Thanks to Slawkens to create part of the script, Zakius and to Val(xtibia) for taking a course
If it helps you, give rep++
Report bugs here, and have fun!
PS:Sorry for english, using translator
Last edited: