Hello, I'm using TFS 1.5 the Nekiro downgraded version 8.60. And I managed to get the questlog working perfectly, but I'm trying to get the player an update eachtime a rotworm gets killed.
For now, I'm not getting the missionstate updated when the rotworm is getting killed, and I use a "print" to check if the script is being trigerred but it is not.
Here it is my script when killing a rotworm, I added it on creaturescripts.xml as an "kill" event type.
And here it is my quests.xml to be easier to understand the missionstates id.
My npc is working excellent, so it is just that I cant manage to storage the monster killing count
Thank you so much, I'm very rusty with scripting so I imagine I made some mistakes. I don't remember too so much how to call some functions as I used to work with tfs .3 and .4
For now, I'm not getting the missionstate updated when the rotworm is getting killed, and I use a "print" to check if the script is being trigerred but it is not.
Here it is my script when killing a rotworm, I added it on creaturescripts.xml as an "kill" event type.
Lua:
function onKill(player, target)
print("onKill function triggered") -- Debugging line
if target:getName():lower() ~= "rotworm" then
print("Target is not a rotworm") -- Debugging line
return true
end
local cid = player:getId()
local mission1DirtyBeginning = 25003
local currentCount = player:getStorageValue(mission1DirtyBeginning)
print("Rotworm killed by player ID: " .. cid) -- Debugging line
if currentCount >= 0 and currentCount < 16 then
player:setStorageValue(mission1DirtyBeginning, currentCount + 1)
print("Player ID: " .. cid .. " has killed a rotworm. Count: " .. (currentCount + 1))
end
return true
end
And here it is my quests.xml to be easier to understand the missionstates id.
XML:
<?xml version="1.0" encoding="UTF-8"?>
<quests>
<quest name="Questing, the chest" startstorageid="80555" startstoragevalue="1">
<mission name="A Dirty Beginning" storageid="25003" startvalue="0" endvalue="17">
<missionstate id="0" description="Questing has been cursed and is trapped in a chest. He asked you to kill 15 rotworms below the city to see if you can handle yourself. 0 of 15 rotworms killed."/>
<missionstate id="1" description="Questing has been cursed and is trapped in a chest. He asked you to kill 15 rotworms below the city to see if you can handle yourself. 1 of 15 rotworms killed."/>
<missionstate id="2" description="Questing has been cursed and is trapped in a chest. He asked you to kill 15 rotworms below the city to see if you can handle yourself. 2 of 15 rotworms killed."/>
<missionstate id="3" description="Questing has been cursed and is trapped in a chest. He asked you to kill 15 rotworms below the city to see if you can handle yourself. 3 of 15 rotworms killed."/>
<missionstate id="4" description="Questing has been cursed and is trapped in a chest. He asked you to kill 15 rotworms below the city to see if you can handle yourself. 4 of 15 rotworms killed."/>
<missionstate id="5" description="Questing has been cursed and is trapped in a chest. He asked you to kill 15 rotworms below the city to see if you can handle yourself. 5 of 15 rotworms killed."/>
<missionstate id="6" description="Questing has been cursed and is trapped in a chest. He asked you to kill 15 rotworms below the city to see if you can handle yourself. 6 of 15 rotworms killed."/>
<missionstate id="7" description="Questing has been cursed and is trapped in a chest. He asked you to kill 15 rotworms below the city to see if you can handle yourself. 7 of 15 rotworms killed."/>
<missionstate id="8" description="Questing has been cursed and is trapped in a chest. He asked you to kill 15 rotworms below the city to see if you can handle yourself. 8 of 15 rotworms killed."/>
<missionstate id="9" description="Questing has been cursed and is trapped in a chest. He asked you to kill 15 rotworms below the city to see if you can handle yourself. 9 of 15 rotworms killed."/>
<missionstate id="10" description="Questing has been cursed and is trapped in a chest. He asked you to kill 15 rotworms below the city to see if you can handle yourself. 10 of 15 rotworms killed."/>
<missionstate id="11" description="Questing has been cursed and is trapped in a chest. He asked you to kill 15 rotworms below the city to see if you can handle yourself. 11 of 15 rotworms killed."/>
<missionstate id="12" description="Questing has been cursed and is trapped in a chest. He asked you to kill 15 rotworms below the city to see if you can handle yourself. 12 of 15 rotworms killed."/>
<missionstate id="13" description="Questing has been cursed and is trapped in a chest. He asked you to kill 15 rotworms below the city to see if you can handle yourself. 13 of 15 rotworms killed."/>
<missionstate id="14" description="Questing has been cursed and is trapped in a chest. He asked you to kill 15 rotworms below the city to see if you can handle yourself. 14 of 15 rotworms killed."/>
<missionstate id="15" description="Questing has been cursed and is trapped in a chest. He asked you to kill 15 rotworms below the city to see if you can handle yourself. 15 of 15 rotworms killed."/>
<missionstate id="16" description="You killed all the dirty beasts. You should probably go and talk to Questing now."/>
<missionstate id="17" description="You proved yourself to Questing. If you help unlock him from the chest and his curse, you will be trully rewarded."/>
</mission>
</quest>
</quests>
My npc is working excellent, so it is just that I cant manage to storage the monster killing count
Thank you so much, I'm very rusty with scripting so I imagine I made some mistakes. I don't remember too so much how to call some functions as I used to work with tfs .3 and .4