S
Shadow_
Guest
don't forget to register it in login.lua and creaturescripts.xml if you don't know how don't use it.
this script will upgrade the weapon you add in its lua script these lines to another weapon after killing specific count of monsters.
to use in quests log you can do it like this :
in your weapon file (weapons/scripts) you should add this
this script will upgrade the weapon you add in its lua script these lines to another weapon after killing specific count of monsters.
to use in quests log you can do it like this :
XML:
<quest name="Grimfrost Upgrading" startstorageid="73913" startstoragevalue="3">
<mission name="Magical Energy Consuming" storageid="73913" startvalue="3" endvalue="5">
<missionstate id="3" description="You need to consume 50 terrorsleep energy in order to upgrade your weapon, the only way to consume their energy is to kill them." />
<missionstate id="4" description="Your weapon is ready to be upgraded successfully! By using your weapon one more time it will be upgraded automatically." />
<missionstate id="5" description="Your weapon is already upgraded" />
</mission>
</quest>
Lua:
local config = {
['terrorsleep'] = {amount = 50, storage = 89273, startstorage = 73913},
}
function onKill(player, target)
local monster = config[target:getName():lower()]
if target:isPlayer() or not monster or target:getMaster() then
return true
end
local stor = player:getStorageValue(monster.storage) + 1
if stor < monster.amount and player:getStorageValue(monster.startstorage) == 3 then
player:setStorageValue(monster.storage, stor)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, '[GrimFrost Upgrade]: '..(stor +1)..' of '..monster.amount..' '..target:getName()..'s killed.')
end
if (stor +1) == monster.amount then
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations, you have killed '..(stor +1)..' '..target:getName()..'s and completed the '..target:getName()..'s mission.')
player:setStorageValue(monster.storage, stor +1)
player:setStorageValue(monster.startstorage, 4)
end
return true
end
in your weapon file (weapons/scripts) you should add this
Lua:
player = Player(cid)
if player:getStorageValue(73913) < 3 then
player:setStorageValue(73913, 3)
end
if player:getStorageValue(73913) == 4 then
if player:removeItem(22415, 1) then
player:addItem(26449, 1)
player:setStorageValue(73913, 5)
player:setStorageValue(89273, 51) -- if in onKill function you made the monster die for 100 times set this to 101 instead of 51 you should get it.
player:say(TALKTYPE_MONSTER_SAY, "GRIMFROST")
player:getPosition():SendMagicEffect(40)
end
end