dewral
Veteran OT User
- Joined
- Dec 4, 2019
- Messages
- 343
- Solutions
- 10
- Reaction score
- 351
Hello i have this script from some time ago but now have some issues with with getting this worked
I already registered it in events like this :
But it's not working and when im using this one it's only changing the melee damage and healing but i have to register it to every monsters.
Spells are not working in both scripts so i don't really know what im doing wrong here xD
Lua:
local pvpvocs = {
[1] = {
pvp = {weapon = 40.2, spells = 45.0, defense = 1.0},
pve = {weapon = 40.2, spells = 45.0, defense = 50.0},
healing = 50.0
},
[2] = {
pvp = {weapon = 1.2, spells = 1.3, defense = 1.2},
pve = {weapon = 1.2, spells = 1.3, defense = 1.2},
healing = 1.8
},
[3] = {
pvp = {weapon = 1.8, spells = 1.2, defense = 1.2},
pve = {weapon = 1.8, spells = 1.2, defense = 1.2},
healing = 1.4
},
[4] = {
pvp = {weapon = 1.2, spells = 1.0, defense = 1.6},
pve = {weapon = 0.8, spells = 1.0, defense = 1.6},
healing = 1.1
},
[5] = {
pvp = {weapon = 1.0, spells = 1.0, defense = 1.0},
pve = {weapon = 1.0, spells = 1.0, defense = 1.0},
healing = 1.0
},
[6] = {
pvp = {weapon = 1.0, spells = 1.0, defense = 1.0},
pve = {weapon = 1.0, spells = 1.0, defense = 1.0},
healing = 1.0
},
[7] = {
pvp = {weapon = 1.0, spells = 1.0, defense = 1.0},
pve = {weapon = 1.0, spells = 1.0, defense = 1.0},
healing = 1.0
},
[8] = {
pvp = {weapon = 1.3, spells = 1.1, defense = 1.7},
pve = {weapon = 0.7, spells = 1.1, defense = 1.7},
healing = 1.1
},
}
function onHealthChange(creature, attacker, primaryType, primaryDamage, origin)
if attacker:isMonster() then attacker:registerEvent("vocations") end
if attacker and attacker:isPlayer() then
local base = attacker:getVocation():getId()
if primaryType == COMBAT_HEALING then
primaryDamage = primaryDamage * pvpvocs[base].healing
elseif creature:isPlayer() then
local form = pvpvocs[base].pvp
if origin == ORIGIN_SPELLS then
primaryDamage = primaryDamage * form.spells
elseif origin == ORIGIN_MELEE or origin == ORIGIN_CONDITION or origin == ORIGIN_RANGED then
primaryDamage = primaryDamage * form.weapon
end
elseif creature:isMonster() then
local form = pvpvocs[base].pve
if origin == ORIGIN_SPELLS then
primaryDamage = primaryDamage * form.spells
elseif origin == ORIGIN_MELEE or origin == ORIGIN_CONDITION or origin == ORIGIN_RANGED then
primaryDamage = primaryDamage * form.weapon
end
end
elseif creature and creature:isPlayer() then
local base = creature:getVocation():getId()
if primaryType == COMBAT_HEALING then
primaryDamage = primaryDamage * pvpvocs[base].healing
elseif attacker:isPlayer() then
local form = pvpvocs[base].pvp
if origin == ORIGIN_SPELLS then
primaryDamage = primaryDamage * form.spells
elseif origin == ORIGIN_MELEE or origin == ORIGIN_CONDITION or origin == ORIGIN_RANGED then
primaryDamage = primaryDamage * form.weapon
end
elseif attacker:isMonster() then
local form = pvpvocs[base].pve
if origin == ORIGIN_SPELLS then
primaryDamage = primaryDamage * form.spells
elseif origin == ORIGIN_MELEE or origin == ORIGIN_CONDITION or origin == ORIGIN_RANGED then
primaryDamage = primaryDamage * form.weapon
end
end
end
return primaryType, primaryDamage, origin
end
I already registered it in events like this :
Lua:
function Creature:onTargetCombat(target)
if hasEventCallback(EVENT_CALLBACK_ONTARGETCOMBAT) then
return EventCallback(EVENT_CALLBACK_ONTARGETCOMBAT, self, target)
else
target:registerEvent("Vocations")
self:registerEvent("Vocations")
return RETURNVALUE_NOERROR
end
end
But it's not working and when im using this one it's only changing the melee damage and healing but i have to register it to every monsters.
Spells are not working in both scripts so i don't really know what im doing wrong here xD
Lua:
local pvpvocs = {
[1] = {
pvp = {weapon = 40.2, spells = 45.0, defense = 1.0},
pve = {weapon = 40.2, spells = 45.0, defense = 50.0},
healing = 50.0
},
[2] = {
pvp = {weapon = 1.2, spells = 1.3, defense = 1.2},
pve = {weapon = 1.2, spells = 1.3, defense = 1.2},
healing = 1.8
},
[3] = {
pvp = {weapon = 1.8, spells = 1.2, defense = 1.2},
pve = {weapon = 1.8, spells = 1.2, defense = 1.2},
healing = 1.4
},
[4] = {
pvp = {weapon = 1.2, spells = 1.0, defense = 1.6},
pve = {weapon = 0.8, spells = 1.0, defense = 1.6},
healing = 1.1
},
[5] = {
pvp = {weapon = 1.0, spells = 1.0, defense = 1.0},
pve = {weapon = 1.0, spells = 1.0, defense = 1.0},
healing = 1.0
},
[6] = {
pvp = {weapon = 1.0, spells = 1.0, defense = 1.0},
pve = {weapon = 1.0, spells = 1.0, defense = 1.0},
healing = 1.0
},
[7] = {
pvp = {weapon = 1.0, spells = 1.0, defense = 1.0},
pve = {weapon = 1.0, spells = 1.0, defense = 1.0},
healing = 1.0
},
[8] = {
pvp = {weapon = 1.3, spells = 1.1, defense = 1.7},
pve = {weapon = 0.7, spells = 1.1, defense = 1.7},
healing = 1.1
},
}
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
if attacker and attacker:isPlayer() then
local base = attacker:getVocation():getId()
if primaryType == COMBAT_HEALING then
primaryDamage = primaryDamage * pvpvocs[base].healing
elseif creature:isPlayer() then
local form = pvpvocs[base].pvp
if origin == ORIGIN_SPELLS then
primaryDamage = primaryDamage * form.spells
elseif origin == ORIGIN_MELEE or origin == ORIGIN_CONDITION or origin == ORIGIN_RANGED then
primaryDamage = primaryDamage * form.weapon
end
elseif creature:isMonster() then
local form = pvpvocs[base].pve
if origin == ORIGIN_SPELLS then
primaryDamage = primaryDamage * form.spells
elseif origin == ORIGIN_MELEE or origin == ORIGIN_CONDITION or origin == ORIGIN_RANGED then
primaryDamage = primaryDamage * form.weapon
end
end
elseif creature and creature:isPlayer() then
local base = creature:getVocation():getId()
if primaryType == COMBAT_HEALING then
primaryDamage = primaryDamage * pvpvocs[base].healing
elseif attacker:isPlayer() then
local form = pvpvocs[base].pvp
if origin == ORIGIN_SPELLS then
primaryDamage = primaryDamage * form.spells
elseif origin == ORIGIN_MELEE or origin == ORIGIN_CONDITION or origin == ORIGIN_RANGED then
primaryDamage = primaryDamage * form.weapon
end
elseif attacker:isMonster() then
local form = pvpvocs[base].pve
if origin == ORIGIN_SPELLS then
primaryDamage = primaryDamage * form.spells
elseif origin == ORIGIN_MELEE or origin == ORIGIN_CONDITION or origin == ORIGIN_RANGED then
primaryDamage = primaryDamage * form.weapon
end
end
end
return primaryDamage, primaryType, secondaryDamage, secondaryType, origin
end
Last edited: