It's working but tackman tell me what i need to do when i wanna add 3 or 5 this events like: demon hunter, dragon lords hunter etc?
monstername = [b]"demon"[/b], -- monster name
storage = [b]10001[/b], -- storage of kills
hunterstorage = [b]10002[/b], -- storage of completed quest
idk how it works...when I kill 100 demon after i got the reward?Where I got the reward?Please reply
-- Copyright to teckman
function onKill(cid, target)
local config = {
monstername = "akno", -- monster name
needeedkills = 1, -- kills needed to complete quest
reward1 = 2641, -- first reward id
reward1count = 1, -- first reward count
wrightablereward = 5785, -- second reward id
effect = 15, -- effect used after completing quest
storage = 10006, -- storage of kills
hunterstorage = 10007, -- storage of completed quest
pos = getPlayerPosition(cid) -- replacement for cid is target
}
if(isMonster(target) == TRUE) then
if getCreatureName(target) == config.monstername then
if getPlayerStorageValue(cid, config.storage) == config.needeedkills-1 and getPlayerStorageValue(cid,config.hunterstorage) == -1 then
doCreatureSay(cid, "You killed "..config.needeedkills.." "..config.monstername..", you're a real "..config.monstername.." hunter. Here is your reward.", TALKTYPE_ORANGE_1)
setPlayerStorageValue(cid,config.hunterstorage,1)
doSendMagicEffect(config.pos, config.effect)
doPlayerAddItem(cid,config.reward1,config.reward1count)
medal = doPlayerAddItem(cid,config.wrightablereward,1)
doSetItemSpecialDescription(medal, "This medal was given to "..getPlayerName(cid).." for killing "..config.needeedkills.." "..config.monstername.." and becoming a real "..config.monstername.." hunter.")
elseif getPlayerStorageValue(cid, config.storage) < config.needeedkills-1 then
setPlayerStorageValue(cid, config.storage,(getPlayerStorageValue(cid, config.storage))+1)
doCreatureSay(cid, "You need to kill "..config.needeedkills-getPlayerStorageValue(cid, config.storage).." "..config.monstername.." to become a "..config.monstername.." hunter.", TALKTYPE_ORANGE_1)
end
end
end
return TRUE
end
<creaturescripts>
<event type="login" name="PlayerLogin" event="script" value="login.lua"/>
<event type="login" name="FirstItems" event="script" value="firstitems.lua"/>
<event type="death" name="PlayerDeath" event="script" value="playerdeath.lua"/>
<event type="joinchannel" name="GuildMotd" event="script" value="guildmotd.lua"/>
<event type="receivemail" name="Mail" event="script" value="mail.lua"/>
<event type="death" name="inquisitionPortals" script="Inquisition/teleports_inquisition.lua"/>
<event type="kill" name="Monsterhunter" event="script" value="monsterhunter.lua"/>
<event type="kill" name="Aknohunt" event="script" value="aknohunt.lua"/>
<event type="kill" name="Apochunt" event="script" value="apochunt.lua"/>
</creaturescripts>
function onLogin(cid)
local loss = getConfigValue('deathLostPercent')
if(loss ~= nil) then
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
end
registerCreatureEvent(cid, "Mail")
registerCreatureEvent(cid, "GuildMotd")
registerCreatureEvent(cid, "PlayerDeath")
registerCreatureEvent(cid, "inquisitionPortals")
registerCreatureEvent(cid, "Monsterhunter")
registerCreatureEvent(cid, "Aknohunt")
registerCreatureEvent(cid, "Apochunt")
return TRUE
end
I have an issue, i made a few extra one's and for some reason it wont work.
creaturescripts/scripts/aknohunt.lua
Code:-- Copyright to teckman function onKill(cid, target) local config = { monstername = "akno", -- monster name needeedkills = 1, -- kills needed to complete quest reward1 = 2641, -- first reward id reward1count = 1, -- first reward count wrightablereward = 5785, -- second reward id effect = 15, -- effect used after completing quest storage = 10006, -- storage of kills hunterstorage = 10007, -- storage of completed quest pos = getPlayerPosition(cid) -- replacement for cid is target } if(isMonster(target) == TRUE) then if getCreatureName(target) == config.monstername then if getPlayerStorageValue(cid, config.storage) == config.needeedkills-1 and getPlayerStorageValue(cid,config.hunterstorage) == -1 then doCreatureSay(cid, "You killed "..config.needeedkills.." "..config.monstername..", you're a real "..config.monstername.." hunter. Here is your reward.", TALKTYPE_ORANGE_1) setPlayerStorageValue(cid,config.hunterstorage,1) doSendMagicEffect(config.pos, config.effect) doPlayerAddItem(cid,config.reward1,config.reward1count) medal = doPlayerAddItem(cid,config.wrightablereward,1) doSetItemSpecialDescription(medal, "This medal was given to "..getPlayerName(cid).." for killing "..config.needeedkills.." "..config.monstername.." and becoming a real "..config.monstername.." hunter.") elseif getPlayerStorageValue(cid, config.storage) < config.needeedkills-1 then setPlayerStorageValue(cid, config.storage,(getPlayerStorageValue(cid, config.storage))+1) doCreatureSay(cid, "You need to kill "..config.needeedkills-getPlayerStorageValue(cid, config.storage).." "..config.monstername.." to become a "..config.monstername.." hunter.", TALKTYPE_ORANGE_1) end end end return TRUE end
data/creaturescripts.xml
Code:<creaturescripts> <event type="login" name="PlayerLogin" event="script" value="login.lua"/> <event type="login" name="FirstItems" event="script" value="firstitems.lua"/> <event type="death" name="PlayerDeath" event="script" value="playerdeath.lua"/> <event type="joinchannel" name="GuildMotd" event="script" value="guildmotd.lua"/> <event type="receivemail" name="Mail" event="script" value="mail.lua"/> <event type="death" name="inquisitionPortals" script="Inquisition/teleports_inquisition.lua"/> <event type="kill" name="Monsterhunter" event="script" value="monsterhunter.lua"/> <event type="kill" name="Aknohunt" event="script" value="aknohunt.lua"/> <event type="kill" name="Apochunt" event="script" value="apochunt.lua"/> </creaturescripts>
creaturescripts/scripts/login.lua
Code:function onLogin(cid) local loss = getConfigValue('deathLostPercent') if(loss ~= nil) then doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10) end registerCreatureEvent(cid, "Mail") registerCreatureEvent(cid, "GuildMotd") registerCreatureEvent(cid, "PlayerDeath") registerCreatureEvent(cid, "inquisitionPortals") registerCreatureEvent(cid, "Monsterhunter") registerCreatureEvent(cid, "Aknohunt") registerCreatureEvent(cid, "Apochunt") return TRUE end
When i go ingame, for some reason when i kill the creature nothing happens at all, but all the normal one works including the original / default one.