Jfrye
Mapper, trying to learn scripting
This script doesnt seem to work. I am trying to make it set a storage value (which should update the questlog), but it does not work.
script.lua
creaturescripts.xml
Added this to login.lua (inside creaturescripts.lua)
Basically, they have to kill a creature to loot an item. I would like the quest log to update after the creature has been killed. After creature has been killed, it finishes Mission 1, and I hope it can start Mission 2 at the same time. So does it need to add a second storage value of 20002 in this script as well?
HalfAway helped me get the main part of the quest log working for this last night, but here is the quest.xml for this quest
So, they find the ring by killing "creature". Once killed, "Finding the Ring" should be complete. Once "Finding the Ring" is completed, "Returning the Ring" should pop up in the quest log. I hope I have been clear in what I am trying to do here. Im not sure if all of this is possible in this one onKill script or not. (The script may not be completed all the way for what I am looking for)
script.lua
Code:
function onKill(cid, target)
local monsters = {
["creature"] = {storage = 20001, value = 2}
}
for i,v in pairs(monsters) do
if getCreatureName(target) == i then
doPlayerSetStorageValue(cid, v.storage,v.value)
end
return true
end
end
creaturescripts.xml
Code:
<event type="kill" name="creature" script="script.lua"/>
Added this to login.lua (inside creaturescripts.lua)
Code:
registerCreatureEvent(cid, "creature")
Basically, they have to kill a creature to loot an item. I would like the quest log to update after the creature has been killed. After creature has been killed, it finishes Mission 1, and I hope it can start Mission 2 at the same time. So does it need to add a second storage value of 20002 in this script as well?
HalfAway helped me get the main part of the quest log working for this last night, but here is the quest.xml for this quest
Code:
<quest name="The Lost Ring" startstorageid="20001" startstoragevalue="1">
<mission name="Finding the Ring" storageid="20001" startvalue="1" endvalue="2">
<missionstate id="1" description="You are trying to help find a lost ring. The NPC told you to check near a water vortex in the swimming area in town." />
</mission>
<mission name="Returning the Ring" storageid="20002" startvalue="1" endvalue="1">
<missionstate id="1" description="You have found the ring. You should return it to the NPC." />
</mission>
</quest>
So, they find the ring by killing "creature". Once killed, "Finding the Ring" should be complete. Once "Finding the Ring" is completed, "Returning the Ring" should pop up in the quest log. I hope I have been clear in what I am trying to do here. Im not sure if all of this is possible in this one onKill script or not. (The script may not be completed all the way for what I am looking for)
Last edited: