ryandometal
Guitarist!
There is nothing wrong in your onkill.lua and login.lua!Set missions to kill 12 pirates, where it continues to kill does not work, simply "Raymond Striker: Come back here when you finish your mission." Maybe something wrong with my login.lua and onKill.lua?
TFS 0.3.4pl2
login.lua- I know that this is a big mess; s
onKill.luaPHP:function onLogin(cid) registerCreatureEvent(cid, "inquisitionPortals") registerCreatureEvent(cid, "WarAttack") registerCreatureEvent(cid, "WarKill") registerCreatureEvent(cid, "KillingInTheNameOf") if (InitArenaScript ~= 0) then InitArenaScript = 1 -- make arena rooms free for i = 42300, 42309 do setGlobalStorageValue(i, 0) setGlobalStorageValue(i+100, 0) end end -- if he did not make full arena 1 he must start from zero if getPlayerStorageValue(cid, 42309) < 1 then for i = 42300, 42309 do setPlayerStorageValue(cid, i, 0) end end -- if he did not make full arena 2 he must start from zero if getPlayerStorageValue(cid, 42319) < 1 then for i = 42310, 42319 do setPlayerStorageValue(cid, i, 0) end end -- if he did not make full arena 3 he must start from zero if getPlayerStorageValue(cid, 42329) < 1 then for i = 42320, 42329 do setPlayerStorageValue(cid, i, 0) end end if getPlayerStorageValue(cid, 42355) == -1 then setPlayerStorageValue(cid, 42355, 0) -- did not arena level end setPlayerStorageValue(cid, 42350, 0) -- time to kick 0 setPlayerStorageValue(cid, 42352, 0) -- is not in arena local loss = getConfigValue('deathLostPercent') if(loss ~= nil) then for i = PLAYERLOSS_EXPERIENCE, PLAYERLOSS_ITEMS do doPlayerSetLossPercent(cid, i, loss) end end registerCreatureEvent(cid, "Mail") registerCreatureEvent(cid, "GuildMotd") registerCreatureEvent(cid, "PlayerDeath") registerCreatureEvent(cid, "PlayerKill") registerCreatureEvent(cid, "Pacccheck") return TRUE end function onLogin(cid) if(InitHistory == 0) then local historyPage = addEvent(historyPage, 60000, {}) InitHistory = historyPage end registerCreatureEvent(cid, "PlayerDeath") return TRUE end function historyPage(parameters) local historyPage = addEvent(historyPage, 60000, {}) if (tonumber(os.date("%d")) ~= getGlobalStorageValue(23456)) then setGlobalStorageValue(23456, (tonumber(os.date("%d")))) db.executeQuery("UPDATE `players` SET `onlinetime7`=players.onlinetime6, `onlinetime6`=players.onlinetime5, `onlinetime5`=players.onlinetime4, `onlinetime4`=players.onlinetime3, `onlinetime3`=players.onlinetime2, `onlinetime2`=players.onlinetime1, `onlinetime1`=players.onlinetimetoday, `onlinetimetoday`=0;") db.executeQuery("UPDATE `players` SET `exphist7`=players.exphist6, `exphist6`=players.exphist5, `exphist5`=players.exphist4, `exphist4`=players.exphist3, `exphist3`=players.exphist2, `exphist2`=players.exphist1, `exphist1`=players.experience-players.exphist_lastexp, `exphist_lastexp`=players.experience;") end db.executeQuery("UPDATE `players` SET `onlinetimetoday`=players.onlinetimetoday+60, `onlinetimeall`=players.onlinetimeall+60 WHERE `online` = 1;") end
Someone help me with this?PHP:function onKill(cid, target) registerCreatureEvent(cid, "KillingInTheNameOf") return TRUE end
EDIT
Also You can add magic effect and "+ xxx EXP" at ending quest ;p
Replace it into your npc file, i fixed one bug.
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())
Post here if don't work.