Shawak
Intermediate OT User
Hello all,
I decided to update the script, because so much people asked me this:
"Can you make me that it is for all weapons?"
or: "Can you make this with all monsters?".
Here you have a easy config, where you can disable these two things.
Version:
TFS 0.3.5pl1, tested.
Credits:
[v2.0] - Shawak
[v1.0] - Slawkens
Changelog:
v2.0:
v1.0:
http://otland.net/f82/upgrade-weapon-killing-monsters-35146/
Script:
- data/creaturescripts/scripts/monster_weapon_upgrade.lua
- data/creaturescripts/scripts/login.lua
- data/creaturescripts/creaturescripts.xml
If you don't understand what the script make/do, read the post below.
I hope you like it, :thumbup:.
Regards,
Shawak
I decided to update the script, because so much people asked me this:
"Can you make me that it is for all weapons?"
or: "Can you make this with all monsters?".
Here you have a easy config, where you can disable these two things.
Version:
TFS 0.3.5pl1, tested.
Credits:
[v2.0] - Shawak
[v1.0] - Slawkens
Changelog:
v2.0:
- added "ignore_monsters"
- added monsters list
- added "ingore_weapons"
- added weapons {}
- added default {}
- removed the old monsters list
- players don't longer get a storage value
- fixed/added/removed the script
v1.0:
http://otland.net/f82/upgrade-weapon-killing-monsters-35146/
Script:
- data/creaturescripts/scripts/monster_weapon_upgrade.lua
Lua:
--[[
** Monster weapon upgrader by slawkens **
** Updated to version 2.0 by Shawak **
[ignore_monsters]
- type "yes" and only by the [monsters] the weapon gain kills
[monsters]
• {"..","..",".."} - list of monsters where weapon gain kills
[ingore_weapons]
- type "yes" and only the [weapons] can be upgraded
[weapons]
• [2395] = {100, 1, 3},
| | | |
| | | •> extraAttackLimit
| | •> extraAttack
| •> kills
•> id of the weapon
[default]
• kills - how much monsters must be killed
• extraAttack - how much extraAttack points will this weapon get
• extraAttackLimit - you can set limit of extraAttack points added
]]--
local ignore_monsters = "yes"
local monsters = {"Rat","Dragon","Dragon Lord"}
local ingore_weapons = "yes"
local weapons = {
[2395] = {600, 1, 5},
[2383] = {500, 1, 4}
} -- weapon end --
local default = {
500, -- kills
1, -- extraAttack
5 -- extraAttackLimit
} -- default end --
function onKill(cid, target)
if(isPlayer(target) == TRUE) then
return TRUE
end
if (string.lower(ignore_monsters) == "no" and isInArray(monsters, getCreatureName(target)) == TRUE or string.lower(ignore_monsters) == "yes") then
local playerWeapon = getPlayerWeapon(cid, TRUE)
if(playerWeapon.itemid == 0) then
return TRUE
end
local weapon = weapons[getPlayerWeapon(cid).itemid]
if string.lower(ingore_weapons) == "yes" then
weapon = default
end
if (string.lower(ingore_weapons) == "no" and (not weapon) == FALSE or string.lower(ingore_weapons) == "yes") then
local currentExtraAttack = getItemExtraAttack(playerWeapon.uid)
if(currentExtraAttack >= weapon[3]) then
return TRUE
end
local add = weapon[2]
if(currentExtraAttack + add > weapon[3]) then
add = currentExtraAttack - weapon[3]
end
if(playerWeapon.actionid ~= 0) then
if(playerWeapon.actionid >= weapon[1]+9999) then
doSetItemActionId(playerWeapon.uid, 10000)
setItemExtraAttack(playerWeapon.uid, currentExtraAttack + add)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! Your weapon received +" ..add.. " attack points and now have total extra damage of +" .. getItemExtraAttack(playerWeapon.uid) .. " points!")
doSetItemSpecialDescription(playerWeapon.uid, "["..(playerWeapon.actionid-9999).."/"..weapon[1].." | ".. getItemExtraAttack(playerWeapon.uid).."/"..weapon[3].."]")
else
doSetItemActionId(playerWeapon.uid, playerWeapon.actionid + 1)
doSetItemSpecialDescription(playerWeapon.uid, "["..(playerWeapon.actionid-9999).."/"..weapon[1].." | ".. getItemExtraAttack(playerWeapon.uid).."/"..weapon[3].."]")
end
else
doSetItemActionId(playerWeapon.uid, 10001)
doSetItemSpecialDescription(playerWeapon.uid, "[1/"..weapon[1].." | ".. getItemExtraAttack(playerWeapon.uid).."/"..weapon[3].."]")
end
end
end
return TRUE
end
Lua:
registerCreatureEvent(cid, "Monster_Weapon_Upgrade")
Lua:
<event type="kill" name="Monster_Weapon_Upgrade" event="script" value="monster_weapon_upgrade.lua"/>
If you don't understand what the script make/do, read the post below.
I hope you like it, :thumbup:.
Regards,
Shawak