gettog get
New Member
- Joined
- Dec 18, 2007
- Messages
- 54
- Reaction score
- 0
Sounds good
--[[
** Monster weapon upgrader by slawkens **
** extra stats added by Cocoamonkey **
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
extraDefense - how much extraDefense points will this weapon get
extraDefenseLimit - you can set limit of extraDefense points added
fireDamage - amount of fire damage the weapon will receive
fireDamageLimit - limit to the amount of fire damage the weapon will receive
energyDamage - amount of energy damage the weapon will receive
energyDamageLimit - limit to the amount of energy damage the weapon will receive
poisonDamage - amount of poison damage the weapon will receive
poisonDammageLimit - limit to the amount of poison damage the weapon will receive
earthDamage - amount of earth damage the weapon will receive
earthDamageLimit - limit to the amount of earth damage the weapon will receive
iceDamage - amount of ice damage the weapon will receive
iceDamageLimit - limit to the amount of ice damage the weapon will receive
holyDamage - amount of holy damage the weapon will receive
holyDamageLimit - limit to the amount of ice damage the weapon will receive
deathDamage - amount of death damage the weapon will receive
deathDamageLimit - limit to the amount of death damage the weapon will receive
]]--
local monsters = {
["demon"] = {
[7382] = {
kills = 5,
extraAttack = 1,
extraAttackLimit = 20,
extraDefense = 1,
extraDefenseLimit = 20,
storage = 34000
},
[2400] = {
kills = 1,
extraAttack = 1,
extraAttackLimit = 25,
extraDefense = 2,
extraDefenseLimit = 40,
fireDamage = 1,
fireDamageLimit = 10,
energyDamage = 1,
energyDamageLimit = 10,
poisonDamage = 1,
poisonDamageLimit = 10,
earthDamage = 1,
earthDamageLimit = 10,
iceDamage = 1,
iceDamageLimit = 10,
holyDamage = 1,
holyDamageLimit = 10,
deathDamage = 1,
deathDamageLimit = 10,
storage = 34005
}
},
["dragon"] = {
[7407] = {
kills = 2,
extraAttack = 2,
extraAttackLimit = 20,
extraDefense = 2,
extraDefenseLimit = 30,
storage = 34003
}
}
}
function onKill(cid, target)
if(isPlayer(target) == TRUE) then
return TRUE
end
local monster = monsters[string.lower(getCreatureName(target))]
if(not monster) then
return TRUE
end
local playerWeapon = getPlayerWeapon(cid, TRUE)
if(playerWeapon.itemid == 0) then
return TRUE
end
local weapon = monster[playerWeapon.itemid]
if(not weapon) then
return TRUE
end
local killedMonsters = getPlayerStorageValue(cid, weapon.storage)
if(killedMonsters == -1) then
killedMonsters = 1
end
local currentExtraAttack = getItemExtraAttack(playerWeapon.uid)
if(killedMonsters % weapon.kills == 0 and currentExtraAttack < weapon.extraAttackLimit) then
setItemExtraAttack(playerWeapon.uid, currentExtraAttack + weapon.extraAttack)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! Your weapon received +" .. weapon.extraAttack .. " attack points and now has a total extra damage of +" .. getItemExtraAttack(playerWeapon.uid) .. " points!")
end
local currentExtraDefense = getItemExtraDefense(playerWeapon.uid)
if(killedMonsters % weapon.kills == 0 and currentExtraDefense < weapon.extraDefenseLimit) then
setItemExtraDefense(playerWeapon.uid, currentExtraDefense + weapon.extraDefense)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! Your weapon received +" .. weapon.extraDefense .. " defense points and now has a total extra defense of +" .. getItemExtraDefense(playerWeapon.uid) .. " points!")
end
local currentFireDamage = getItemElementFire(playerWeapon.uid)
if(killedMonsters % weapon.kills == 0 and currentFireDamage < weapon.fireDamageLimit) then
setItemElementFire(playerWeapon.uid, currentFireDamage + weapon.fireDamage)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! Your weapon received +" .. weapon.fireDamage .. " fire damage points and now has total of +" .. getItemElementFire(playerWeapon.uid) .. " fire damage points!")
end
local currentEnergyDamage = getItemElementEnergy(playerWeapon.uid)
if(killedMonsters % weapon.kills == 0 and currentEnergyDamage < weapon.energyDamageLimit) then
setItemElementEnergy(playerWeapon.uid, currentEnergyDamage + weapon.energyDamage)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! Your weapon received +" .. weapon.energyDamage .. " energy damage points and now has total of +" .. getItemElementEnergy(playerWeapon.uid) .. " energy damage points!")
end
local currentPoisonDamage = getItemElementPoison(playerWeapon.uid)
if(killedMonsters % weapon.kills == 0 and currentPoisonDamage < weapon.poisonDamageLimit) then
setItemElementPoison(playerWeapon.uid, currentPoisonDamage + weapon.poisonDamage)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! Your weapon received +" .. weapon.poisonDamage .. " poison damage points and now has total of +" .. getItemElementPoison(playerWeapon.uid) .. " poison damage points!")
end
local currentEarthDamage = getItemElementEarth(playerWeapon.uid)
if(killedMonsters % weapon.kills == 0 and currentEarthDamage < weapon.earthDamageLimit) then
setItemElementEarth(playerWeapon.uid, currentEarthDamage + weapon.earthDamage)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! Your weapon received +" .. weapon.earthDamage .. " earth damage points and now has total of +" .. getItemElementEarth(playerWeapon.uid) .. " earth damage points!")
end
local currentIceDamage = getItemElementIce(playerWeapon.uid)
if(killedMonsters % weapon.kills == 0 and currentIceDamage < weapon.iceDamageLimit) then
setItemElementIce(playerWeapon.uid, currentIceDamage + weapon.iceDamage)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! Your weapon received +" .. weapon.iceDamage .. " ice damage points and now has total of +" .. getItemElementIce(playerWeapon.uid) .. " ice damage points!")
end
local currentHolyDamage = getItemElementHoly(playerWeapon.uid)
if(killedMonsters % weapon.kills == 0 and currentHolyDamage < weapon.holyDamageLimit) then
setItemElementHoly(playerWeapon.uid, currentHolyDamage + weapon.holyDamage)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! Your weapon received +" .. weapon.holyDamage .. " holy damage points and now has total of +" .. getItemElementHoly(playerWeapon.uid) .. " holy damage points!")
end
local currentDeathDamage = getItemElementDeath(playerWeapon.uid)
if(killedMonsters % weapon.kills == 0 and currentDeathDamage < weapon.deathDamageLimit) then
setItemElementDeath(playerWeapon.uid, currentDeathDamage + weapon.deathDamage)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! Your weapon received +" .. weapon.deathDamage .. " death damage points and now has total of +" .. getItemElementDeath(playerWeapon.uid) .. " death damage points!")
end
setPlayerStorageValue(cid, weapon.storage, killedMonsters + 1)
return TRUE
end
[01/07/2009 18:59:21] Warning: [Event::loadScript] Can not load script. data/creaturescripts/scripts/monster_weapon_upgrade.lua
[01/07/2009 18:59:21] data/creaturescripts/scripts/monster_weapon_upgrade.lua:1: unexpected symbol near '{'
It does not work:S
--[[
** Monster weapon upgrader by slawkens **
** Extra Defense added by Cocoamonkey **
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
extraDefense - how much extraDefense points will this weapon get
extraDefenseLimit - you can set limit of extraDefense points added
monsterExp - Amount of exp a monster must have
]]--
local monsters = {
["demon"] = {
[7382] = {
kills = 1,
extraAttack = 50,
extraAttackLimit = 800,
extraDefense = 50,
extraDefenseLimit = 800,
storage = 34000
},
[2400] = {
kills = 30,
extraAttack = 1,
extraAttackLimit = 25,
extraDefense = 50,
extraDefenseLimit = 800,
storage = 34001
}
},
["dragon"] = {
[7407] = {
kills = 2,
extraAttack = 2,
extraAttackLimit = 20,
extraDefense = 2,
extraDefenseLimit = 30,
storage = 34003
}
}
}
local monstersExp = {
["1000"] = {
[7382] = {
kills = 1,
extraAttack = 1,
extraAttackLimit = 25,
extraDefense = 2,
extraDefenseLimit = 20,
storage = 34005
},
[2400] = {
kills = 30,
extraAttack = 1,
extraAttackLimit = 25,
extraDefense = 1,
extraDefenseLimit = 25,
storage = 34006
}
},
["5000"] = {
[7407] = {
kills = 2,
extraAttack = 2,
extraAttackLimit = 20,
extraDefense = 2,
extraDefenseLimit = 30,
storage = 34007
}
}
}
function onKill(cid, target)
if(isPlayer(target) == TRUE) then
return TRUE
end
local monster = monsters[string.lower(getCreatureName(target))]
if(not monster) then
return TRUE
end
local monsterExp = monstersExp[string.lower(getCreatureExperience(target))]
if(not monster) then
if getCreatureExperience < (monsterExp) then
return TRUE
end
local playerWeapon = getPlayerWeapon(cid, TRUE)
if(playerWeapon.itemid == 0) then
return TRUE
end
local weapon = monster[playerWeapon.itemid]
if(not weapon) then
return TRUE
end
local weapon = monsterExp[playerWeapon.itemid]
if(not weapon) then
return TRUE
end
local killedMonsters = getPlayerStorageValue(cid, weapon.storage)
if(killedMonsters == -1) then
killedMonsters = 1
end
local currentExtraAttack = getItemExtraAttack(playerWeapon.uid)
if(killedMonsters % weapon.kills == 0 and currentExtraAttack < weapon.extraAttackLimit) then
setItemExtraAttack(playerWeapon.uid, currentExtraAttack + weapon.extraAttack)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! Your weapon received +" .. weapon.extraAttack .. " attack points and now have total extra damage of +" .. getItemExtraAttack(playerWeapon.uid) .. " points!")
end
local currentExtraDefense = getItemExtraDefense(playerWeapon.uid)
if(killedMonsters % weapon.kills == 0 and currentExtraDefense < weapon.extraDefenseLimit) then
setItemExtraDefense(playerWeapon.uid, currentExtraDefense + weapon.extraDefense)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! Your weapon received +" .. weapon.extraDefense .. " defense points and now have total extra defense of +" .. getItemExtraDefense(playerWeapon.uid) .. " points!")
end
setPlayerStorageValue(cid, weapon.storage, killedMonsters + 1)
return TRUE
end