I have as part of a NPC mission line this creature script which should enable you to kill 20 goblins, and change your storage value (count) with each until 20.
Everytime you kill a goblin the player should receive a message "you have killed 1 of 20 goblins" or something like this. The problem is it's not registering with each kill.
In creaturescripts.xml I have:
In MiningQuestKills.lua I have:
I do not understand what's wrong here... any help/guidance would be appreciated!
Everytime you kill a goblin the player should receive a message "you have killed 1 of 20 goblins" or something like this. The problem is it's not registering with each kill.
In creaturescripts.xml I have:
XML:
<event type="kill" name="MiningQuestkills" script="MiningQuestkills.lua" />
Lua:
local config = {
["goblin"] = {questStarted = 9105, questStorage = 9105, creatureStorage = 15007, killsRequired = 20, raceName = "Goblins"},
}
local msgType = MESSAGE_STATUS_CONSOLE_ORANGE
function onKill(cid, target, lastHit)
local creature = questCreatures[getCreatureName(target):lower()]
if creature then
if isPlayer(target) or isSummon(target) then return true end
if getCreatureStorage(cid, creature.questStarted) > 0 then
if getCreatureStorage(cid, creature.questStorage) < creature.killsRequired then
if getCreatureStorage(cid, creature.questStorage) < 0 then
doCreatureSetStorage(cid, creature.questStorage, 0)
end
if getCreatureStorage(cid, creature.creatureStorage) < 0 then
doCreatureSetStorage(cid, creature.creatureStorage, 0)
end
doCreatureSetStorage(cid, creature.questStorage, getCreatureStorage(cid, creature.questStorage) + 1)
doCreatureSetStorage(cid, creature.creatureStorage, getCreatureStorage(cid, creature.creatureStorage) + 1)
doPlayerSendTextMessage(cid, msgType, getCreatureStorage(cid, creature.creatureStorage) .. " " .. getCreatureName(target) .. " defeated. Total [" .. getCreatureStorage(cid, creature.questStorage) .. "/" .. creature.killsRequired .. "] " .. creature.raceName .. ".")
end
end
end
return true
end
I do not understand what's wrong here... any help/guidance would be appreciated!