Closed marcosvf132 closed 3 years ago
Charm runes doesnt work on game.
yep, a couple of things of this system is still needtobedone;
Be free if u want to contribute =)
I've manage to make some charm runes to work, but some of them are diferent from what it should be. I will post here what i've done so far.
1
\data\events\scripts\player.lua
-- Start of player.lua
local Numbe = createConditionObject(CONDITION_PARALYZE)
setConditionParam(Numbe, CONDITION_PARAM_TICKS, 10000)
setConditionParam(Numbe, CONDITION_PARAM_BUFF, TRUE)
local Crit = Condition(CONDITION_ATTRIBUTES)
Crit:setParameter(CONDITION_PARAM_TICKS, 3000)
Crit:setParameter(CONDITION_PARAM_SKILL_CRITICAL_HIT_CHANCE, 8)
local canGut = 42352535
...
end
end
end
end
end
if Player.getCharmFromTarget(self, target) then
math.randomseed(math.random(primaryDamage))
chanceTo = math.random(1,10)
if(chanceTo == 1)then
if Player.getCharmFromTarget(self, target).name == "Wound" then
doTargetCharmDamage(COMBAT_PHYSICALDAMAGE, CONST_ME_HITAREA, "wound charm", "wounded", self, target)
elseif Player.getCharmFromTarget(self, target).name == "Enflame" then
doTargetCharmDamage(COMBAT_FIREDAMAGE, CONST_ME_HITBYFIRE, "enflame charm", "enflame", self, target)
elseif Player.getCharmFromTarget(self, target).name == "Poison" then
doTargetCharmDamage(COMBAT_EARTHDAMAGE, CONST_ME_GREEN_RINGS, "poison charm", "poisoned", self, target)
elseif Player.getCharmFromTarget(self, target).name == "Freeze" then
doTargetCharmDamage(COMBAT_ICEDAMAGE, CONST_ME_ICEATTACK, "freeze charm", "frozen", self, target)
elseif Player.getCharmFromTarget(self, target).name == "Zap" then
doTargetCharmDamage(COMBAT_ENERGYDAMAGE, CONST_ME_ENERGYHIT, "zap charm", "electrocuted", self, target)
elseif Player.getCharmFromTarget(self, target).name == "Curse" then
doTargetCharmDamage(COMBAT_DEATHDAMAGE, CONST_ME_SMALLCLOUDS, "curse charm", "curse", self, target)
elseif Player.getCharmFromTarget(self, target).name == "Cripple" then
setConditionParam(Numbe, CONDITION_PARAM_SPEED, -((target:getBaseSpeed())/2))
target:addCondition(Numbe)
doPlayerSendTextMessage(self, 21, "You paralyze the monster. (cripple charm)")
doSendMagicEffect(target:getPosition(),CONST_ME_MAGIC_RED) end end
if Player.getCharmFromTarget(self, target).name == "Low Blow" then
setConditionParam(Crit, 1000)
self:addCondition(Crit)
elseif Player.getCharmFromTarget(self, target).name == "Scavenge" then
if not(getPlayerStorageValue(self, canGut) == 1) then setPlayerStorageValue(self, canGut, 1)
addEvent(function() setPlayerStorageValue(self, canGut, 0) end, 60000) end end
end
return primaryDamage, primaryType, secondaryDamage, secondaryType end
function doTargetCharmDamage(charmdmgtype, charmeffect, logmsg, infomsg, attacker, mnster) bestiaryDamage = string.format("%.0f",-(mnster:getMaxHealth()*((5)/100))) doTargetCombatHealth(attacker, mnster, charmdmgtype, -bestiaryDamage, -bestiaryDamage, charmeffect) doPlayerSendTextMessage(attacker, MESSAGE_DAMAGE_DEALT, "A " .. mnster:getName() .. " loses " .. -bestiaryDamage .. " hitpoints due to your attack. (" .. logmsg .. ")") doPlayerSendTextMessage(attacker, 21, "You " .. infomsg .. " the monster.") end -- End of archive player.lua
At this point we have offensive charm runes working, like **freezy**, **enflame**, **poison**, **zap** and **curse**. **Cripple** rune is working pretty good too.
The problem now is with **scavenge** rune, i've manage to make it work through a player storage system that we will add on the monster file, but the problem is that, when you attack a monster that is selected on the charm runes with scavenge on it, this script will grant you a condition for one minute that you will have more 'lucky' when you try to skin the corpse, but the problem on this script is that you will have lucky to scavenge **all corpse**, not only the selected creature corpse. If you know how to fix it, please post it here. (maybe when you kill a selected creature it will add some actionID on the creature corpse or something like that!)
Other **big problem** here is on the **low blow** rune. With this script, when you attack a selected creature with low blow rune, it will grant you a 8% buff on the critical hit chance to you for 3 seconds, but when you trigger this rune, the buff works for **ALL MONSTER**, i can't find a way to make this buff individual only to the selected creature with low blow rune.
> 2 `\data\creaturescripts\scripts\others\login_events.lua`
```LUA
...
"BestiaryDefensiveHP",
"BestiaryDefensiveMP",
...
3
\data\creaturescripts\creaturescripts.xml
... <event type="healthchange" name="BestiaryDefensiveHP" script="others/BestiaryDefensive.lua"/> <event type="manachange" name="BestiaryDefensiveMP" script="others/BestiaryDefensive.lua"/> ...
4
\data\creaturescripts\scripts\others\BestiaryDefensive.lua
local Burst = createConditionObject(CONDITION_HASTE) setConditionParam(Burst, CONDITION_PARAM_TICKS, 10000) setConditionParam(Burst, CONDITION_PARAM_BUFF, TRUE)
local Numbe = createConditionObject(CONDITION_PARALYZE) setConditionParam(Numbe, CONDITION_PARAM_TICKS, 10000) setConditionParam(Numbe, CONDITION_PARAM_BUFF, TRUE) local canCleanse = 42352534
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
if not(attacker) then return primaryDamage, primaryType, secondaryDamage, secondaryType end
if not(attacker:isMonster()) then return primaryDamage, primaryType, secondaryDamage, secondaryType end
if ((Player.getCharmFromTarget(creature, attacker)) == nil) then return primaryDamage, primaryType, secondaryDamage, secondaryType end
local bixo = Monster(attacker)
local gente = Player(creature)
if Player.getCharmFromTarget(creature, attacker) then
math.randomseed(os.time())
chanceTo = math.random(1,10)
if(chanceTo == 1)then
if Player.getCharmFromTarget(creature, attacker).name == "Dodge" then
doPlayerSendTextMessage(creature, 21, "You dodged an attack. (dodge charm)")
doSendMagicEffect(creature:getPosition(),CONST_ME_POFF) return 0, 0, 0, 0
elseif Player.getCharmFromTarget(creature, attacker).name == "Parry" then
doPlayerSendTextMessage(creature, 21, "You reflected an attack. (parry charm)")
doPlayerSendTextMessage(gente, MESSAGE_DAMAGE_DEALT, "You reflected a damage from " .. bixo:getName() .. ". (parry charm)")
doTargetCombatHealth(gente, bixo, COMBAT_PHYSICALDAMAGE, 2(primaryDamage + secondaryDamage), 2(primaryDamage + secondaryDamage), CONST_ME_EXPLOSIONAREA)
elseif Player.getCharmFromTarget(creature, attacker).name == "Adrenaline Burst" then
setConditionParam(Burst, CONDITION_PARAM_SPEED, (creature:getBaseSpeed()*(3/2)))
creature:addCondition(Burst)
doPlayerSendTextMessage(creature, 21, "You are hasted. (adrenaline burst charm)")
doSendMagicEffect(creature:getPosition(),CONST_ME_MAGIC_BLUE)
elseif Player.getCharmFromTarget(creature, attacker).name == "Numb" then
setConditionParam(Numbe, CONDITION_PARAM_SPEED, -((attacker:getBaseSpeed())/2))
attacker:addCondition(Numbe)
doPlayerSendTextMessage(creature, 21, "You paralyze the creature. (numb charm)")
doSendMagicEffect(attacker:getPosition(),CONST_ME_MAGIC_RED)
end end
if Player.getCharmFromTarget(creature, attacker).name == "Bless" then
-- doPlayerSendTextMessage(creature, MESSAGE_DAMAGE_DEALT, "Falta fazer esta runa.")
-- Need to do this part
elseif Player.getCharmFromTarget(creature, attacker).name == "Cleanse" then
if not(getPlayerStorageValue(creature, canCleanse) == 1) then
doPlayerSendTextMessage(creature, 21, "You are now purified. (cleanse charm)")
setPlayerStorageValue(creature, canCleanse, 1)
cleanAllConditions(creature)
end
end
end
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
function onManaChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
if not(attacker) then return primaryDamage, primaryType, secondaryDamage, secondaryType end
if not(attacker:isMonster()) then return primaryDamage, primaryType, secondaryDamage, secondaryType end
if ((Player.getCharmFromTarget(creature, attacker)) == nil) then return primaryDamage, primaryType, secondaryDamage, secondaryType end
local bixo = Monster(attacker)
local gente = Player(creature)
if Player.getCharmFromTarget(creature, attacker) then
math.randomseed(primaryDamage + secondaryDamage)
chanceTo = math.random(1,10)
if(chanceTo == 1)then
if Player.getCharmFromTarget(creature, attacker).name == "Dodge" then
doPlayerSendTextMessage(creature, 21, "You dodged an attack. (dodge charm)")
doSendMagicEffect(creature:getPosition(),CONST_ME_POFF) return 0, 0, 0, 0
elseif Player.getCharmFromTarget(creature, attacker).name == "Parry" then
doPlayerSendTextMessage(creature, 21, "You reflected an attack. (parry charm)")
doPlayerSendTextMessage(gente, MESSAGE_DAMAGE_DEALT, "You reflected a damage from " .. bixo:getName() .. ". (parry charm)")
doTargetCombatHealth(gente, bixo, COMBAT_PHYSICALDAMAGE, 2(primaryDamage + secondaryDamage), 2(primaryDamage + secondaryDamage), CONST_ME_EXPLOSIONAREA)
elseif Player.getCharmFromTarget(creature, attacker).name == "Adrenaline Burst" then
setConditionParam(Burst, CONDITION_PARAM_SPEED, (creature:getBaseSpeed()*(3/2)))
creature:addCondition(Burst)
doPlayerSendTextMessage(creature, 21, "You are hasted. (adrenaline burst charm)")
doSendMagicEffect(creature:getPosition(),CONST_ME_MAGIC_BLUE)
elseif Player.getCharmFromTarget(creature, attacker).name == "Numb" then
setConditionParam(Numbe, CONDITION_PARAM_SPEED, -((attacker:getBaseSpeed())/2))
attacker:addCondition(Numbe)
doPlayerSendTextMessage(creature, 21, "You paralyze the creature. (numb charm)")
doSendMagicEffect(attacker:getPosition(),CONST_ME_MAGIC_RED)
end end
if Player.getCharmFromTarget(creature, attacker).name == "Bless" then
-- doPlayerSendTextMessage(creature, MESSAGE_DAMAGE_DEALT, "Falta fazer esta runa.")
-- Need to do this part
elseif Player.getCharmFromTarget(creature, attacker).name == "Cleanse" then
if not(getPlayerStorageValue(creature, canCleanse) == 1) then
doPlayerSendTextMessage(creature, 21, "You are now purified. (cleanse charm)")
setPlayerStorageValue(creature, canCleanse, 1)
cleanAllConditions(creature)
end
end
end
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
function cleanAllConditions(pplayer) local conditions = { CONDITION_POISON, CONDITION_FIRE, CONDITION_ENERGY, CONDITION_BLEEDING, CONDITION_PARALYZE, CONDITION_DRUNK, CONDITION_DROWN, CONDITION_FREEZING, CONDITION_DAZZLED, CONDITIONCURSED } for , conditionType in pairs(conditions) do if pplayer:getCondition(conditionType) then pplayer:removeCondition(conditionType) end end end
Now this part, **dodge**, **parry**, **adrenaline burst** and **numb** is working fine, the only problem is that **dodge** rune is not blocking the creature condition, need to check it more.
If you see, **cleanse** rune script part is very, very strange, but this is the only way i've done to make it work, and other big problem here is that it won't clean one atrribute from you and give you imunity to this condition, this script is cleaning **ALL THE CONDITIONS** and is **repeating** this process for 5 seconds with 250ms delay betwen the process. (Probably this will overload a bit you system, need to check it).
To make it lighter, you can try to merge the onManaChange and onHealthChange. I don't know if you can do a onStatsChange, dont know if its possible, if it is, tell me please :)
**NOTE: Bless rune is not working, i can't find a way to grant the player more protection when you die to the selected creature, i'm trying to create a new bless, and grant this bless if you die to creature.**
> 5 `\data\events\scripts\monster.lua`
```LUA
...
if not player or player:getStamina() > 840 then
local monsterLoot = mType:getLoot()
for i = 1, #monsterLoot do
------------------->Loot<------------------------
local item = corpse:createLootItem(monsterLoot[i])
--------------->Charm Rune<----------------------
if Player.getCharmFromTarget(player, self) then
local itemType = ItemType(monsterLoot[i].itemId)
if (itemType:getLootCategory() == 24) and (Player.getCharmFromTarget(player, self).name == "Gut") then
local item1 = corpse:createLootItem(monsterLoot[i])
-- To add more chance, only copy and paste the 'local item1' line
player:sendTextMessage(21, "You dropped boosted loot. (gut charm)")
end
end
-------------------------------------------------
if not item then
print('[Warning] DropLoot:', 'Could not add loot item to corpse.')
...
This part is to activate the gut charm rune, you will double your chance to drop more creature products items, to add more chance only add more 'corpse:createlootitem' on the -- line.
6
\data\actions\scripts\tools\skinning.lua
-- Start of skinning.lua local canGut = 42352535 ...
01 At:
... local random, effect, transform = math.random(1, 100000), CONST_ME_MAGIC_GREEN, true ...
01 Replace to:
...
local user1 = Player(player) if (getPlayerStorageValue(user1, canGut) == 1) then local chanceTo = 50000 else local chanceTo = 100000 end local random, effect, transform = math.random(1, chanceTo), CONST_ME_MAGIC_GREEN, true ...
**02** At:
```LUA
...
for i = 1, #skin do
_skin = skin[i]
if random <= _skin.value then
...
02 Replace to:
...
for i = 1, #skin do
_skin = skin[i]
if random <= _skin.value then
if (getPlayerStorageValue(user1, canGut) == 1) then
doPlayerSendTextMessage(user1, 21, "You scavange the creature. (scavange charm)")
addEvent(function() setPlayerStorageValue(user1, canGut, 0) end, 20000)
user1:getPosition():sendMagicEffect(CONST_ME_YELLOWENERGY)
end
...
03 At:
...
effect = CONST_ME_POFF
transform = false
target:remove()
end
elseif random <= skin.value then
...
03 Replace to:
...
effect = CONST_ME_POFF
transform = false
target:remove()
end
elseif random <= skin.value then
if (getPlayerStorageValue(user1, canGut) == 1) then
doPlayerSendTextMessage(user1, 21, "You scavange the creature. (scavange charm)")
addEvent(function() setPlayerStorageValue(user1, canGut, 0) end, 20000)
user1:getPosition():sendMagicEffect(CONST_ME_YELLOWENERGY)
end
...
I've manage to make some charm runes to work, but some of them are diferent from what it should be. I will post here what i've done so far.
NOTE: The values are not exactly what it should be on the original tibia, so please, if you find some diferente values, i'm all ears.
1
\data\events\scripts\player.lua
-- Start of player.lua local Numbe = createConditionObject(CONDITION_PARALYZE) setConditionParam(Numbe, CONDITION_PARAM_TICKS, 10000) setConditionParam(Numbe, CONDITION_PARAM_BUFF, TRUE) local Crit = Condition(CONDITION_ATTRIBUTES) Crit:setParameter(CONDITION_PARAM_TICKS, 3000) Crit:setParameter(CONDITION_PARAM_SKILL_CRITICAL_HIT_CHANCE, 8) local canGut = 42352535
- Now we go at the end of the script, on Player:onCombat(
... end end end end end if Player.getCharmFromTarget(self, target) then math.randomseed(math.random(primaryDamage)) chanceTo = math.random(1,10) if(chanceTo == 1)then if Player.getCharmFromTarget(self, target).name == "Wound" then doTargetCharmDamage(COMBAT_PHYSICALDAMAGE, CONST_ME_HITAREA, "wound charm", "wounded", self, target) elseif Player.getCharmFromTarget(self, target).name == "Enflame" then doTargetCharmDamage(COMBAT_FIREDAMAGE, CONST_ME_HITBYFIRE, "enflame charm", "enflame", self, target) elseif Player.getCharmFromTarget(self, target).name == "Poison" then doTargetCharmDamage(COMBAT_EARTHDAMAGE, CONST_ME_GREEN_RINGS, "poison charm", "poisoned", self, target) elseif Player.getCharmFromTarget(self, target).name == "Freeze" then doTargetCharmDamage(COMBAT_ICEDAMAGE, CONST_ME_ICEATTACK, "freeze charm", "frozen", self, target) elseif Player.getCharmFromTarget(self, target).name == "Zap" then doTargetCharmDamage(COMBAT_ENERGYDAMAGE, CONST_ME_ENERGYHIT, "zap charm", "electrocuted", self, target) elseif Player.getCharmFromTarget(self, target).name == "Curse" then doTargetCharmDamage(COMBAT_DEATHDAMAGE, CONST_ME_SMALLCLOUDS, "curse charm", "curse", self, target) elseif Player.getCharmFromTarget(self, target).name == "Cripple" then setConditionParam(Numbe, CONDITION_PARAM_SPEED, -((target:getBaseSpeed())/2)) target:addCondition(Numbe) doPlayerSendTextMessage(self, 21, "You paralyze the monster. (cripple charm)") doSendMagicEffect(target:getPosition(),CONST_ME_MAGIC_RED) end end if Player.getCharmFromTarget(self, target).name == "Low Blow" then setConditionParam(Crit, 1000) self:addCondition(Crit) elseif Player.getCharmFromTarget(self, target).name == "Scavenge" then if not(getPlayerStorageValue(self, canGut) == 1) then setPlayerStorageValue(self, canGut, 1) addEvent(function() setPlayerStorageValue(self, canGut, 0) end, 60000) end end end return primaryDamage, primaryType, secondaryDamage, secondaryType end function doTargetCharmDamage(charmdmgtype, charmeffect, logmsg, infomsg, attacker, mnster) bestiaryDamage = string.format("%.0f",-(mnster:getMaxHealth()*((5)/100))) doTargetCombatHealth(attacker, mnster, charmdmgtype, -bestiaryDamage, -bestiaryDamage, charmeffect) doPlayerSendTextMessage(attacker, MESSAGE_DAMAGE_DEALT, "A " .. mnster:getName() .. " loses " .. -bestiaryDamage .. " hitpoints due to your attack. (" .. logmsg .. ")") doPlayerSendTextMessage(attacker, 21, "You " .. infomsg .. " the monster.") end -- End of archive player.lua
At this point we have offensive charm runes working, like freezy, enflame, poison, zap and curse. Cripple rune is working pretty good too. The problem now is with scavenge rune, i've manage to make it work through a player storage system that we will add on the monster file, but the problem is that, when you attack a monster that is selected on the charm runes with scavenge on it, this script will grant you a condition for one minute that you will have more 'lucky' when you try to skin the corpse, but the problem on this script is that you will have lucky to scavenge all corpse, not only the selected creature corpse. If you know how to fix it, please post it here. (maybe when you kill a selected creature it will add some actionID on the creature corpse or something like that!) Other big problem here is on the low blow rune. With this script, when you attack a selected creature with low blow rune, it will grant you a 8% buff on the critical hit chance to you for 3 seconds, but when you trigger this rune, the buff works for ALL MONSTER, i can't find a way to make this buff individual only to the selected creature with low blow rune.
2
\data\creaturescripts\scripts\others\login_events.lua
... "BestiaryDefensiveHP", "BestiaryDefensiveMP", ...
3
\data\creaturescripts\creaturescripts.xml
... <event type="healthchange" name="BestiaryDefensiveHP" script="others/BestiaryDefensive.lua"/> <event type="manachange" name="BestiaryDefensiveMP" script="others/BestiaryDefensive.lua"/> ...
4
\data\creaturescripts\scripts\others\BestiaryDefensive.lua
local Burst = createConditionObject(CONDITION_HASTE) setConditionParam(Burst, CONDITION_PARAM_TICKS, 10000) setConditionParam(Burst, CONDITION_PARAM_BUFF, TRUE) local Numbe = createConditionObject(CONDITION_PARALYZE) setConditionParam(Numbe, CONDITION_PARAM_TICKS, 10000) setConditionParam(Numbe, CONDITION_PARAM_BUFF, TRUE) local canCleanse = 42352534 function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin) if not(attacker) then return primaryDamage, primaryType, secondaryDamage, secondaryType end if not(attacker:isMonster()) then return primaryDamage, primaryType, secondaryDamage, secondaryType end if ((Player.getCharmFromTarget(creature, attacker)) == nil) then return primaryDamage, primaryType, secondaryDamage, secondaryType end local bixo = Monster(attacker) local gente = Player(creature) if Player.getCharmFromTarget(creature, attacker) then math.randomseed(os.time()) chanceTo = math.random(1,10) if(chanceTo == 1)then if Player.getCharmFromTarget(creature, attacker).name == "Dodge" then doPlayerSendTextMessage(creature, 21, "You dodged an attack. (dodge charm)") doSendMagicEffect(creature:getPosition(),CONST_ME_POFF) return 0, 0, 0, 0 elseif Player.getCharmFromTarget(creature, attacker).name == "Parry" then doPlayerSendTextMessage(creature, 21, "You reflected an attack. (parry charm)") doPlayerSendTextMessage(gente, MESSAGE_DAMAGE_DEALT, "You reflected a damage from " .. bixo:getName() .. ". (parry charm)") doTargetCombatHealth(gente, bixo, COMBAT_PHYSICALDAMAGE, 2*(primaryDamage + secondaryDamage), 2*(primaryDamage + secondaryDamage), CONST_ME_EXPLOSIONAREA) elseif Player.getCharmFromTarget(creature, attacker).name == "Adrenaline Burst" then setConditionParam(Burst, CONDITION_PARAM_SPEED, (creature:getBaseSpeed()*(3/2))) creature:addCondition(Burst) doPlayerSendTextMessage(creature, 21, "You are hasted. (adrenaline burst charm)") doSendMagicEffect(creature:getPosition(),CONST_ME_MAGIC_BLUE) elseif Player.getCharmFromTarget(creature, attacker).name == "Numb" then setConditionParam(Numbe, CONDITION_PARAM_SPEED, -((attacker:getBaseSpeed())/2)) attacker:addCondition(Numbe) doPlayerSendTextMessage(creature, 21, "You paralyze the creature. (numb charm)") doSendMagicEffect(attacker:getPosition(),CONST_ME_MAGIC_RED) end end if Player.getCharmFromTarget(creature, attacker).name == "Bless" then doPlayerSendTextMessage(creature, MESSAGE_DAMAGE_DEALT, "Falta fazer esta runa.") -- Need to do this part elseif Player.getCharmFromTarget(creature, attacker).name == "Cleanse" then if not(getPlayerStorageValue(creature, canCleanse) == 1) then doPlayerSendTextMessage(creature, 21, "You are now purified. (cleanse charm)") setPlayerStorageValue(creature, canCleanse, 1) cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) setPlayerStorageValue(creature, canCleanse, 0) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end end end return primaryDamage, primaryType, secondaryDamage, secondaryType end function onManaChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin) if not(attacker) then return primaryDamage, primaryType, secondaryDamage, secondaryType end if not(attacker:isMonster()) then return primaryDamage, primaryType, secondaryDamage, secondaryType end if ((Player.getCharmFromTarget(creature, attacker)) == nil) then return primaryDamage, primaryType, secondaryDamage, secondaryType end local bixo = Monster(attacker) local gente = Player(creature) if Player.getCharmFromTarget(creature, attacker) then math.randomseed(primaryDamage + secondaryDamage) chanceTo = math.random(1,10) if(chanceTo == 1)then if Player.getCharmFromTarget(creature, attacker).name == "Dodge" then doPlayerSendTextMessage(creature, 21, "You dodged an attack. (dodge charm)") doSendMagicEffect(creature:getPosition(),CONST_ME_POFF) return 0, 0, 0, 0 elseif Player.getCharmFromTarget(creature, attacker).name == "Parry" then doPlayerSendTextMessage(creature, 21, "You reflected an attack. (parry charm)") doPlayerSendTextMessage(gente, MESSAGE_DAMAGE_DEALT, "You reflected a damage from " .. bixo:getName() .. ". (parry charm)") doTargetCombatHealth(gente, bixo, COMBAT_PHYSICALDAMAGE, 2*(primaryDamage + secondaryDamage), 2*(primaryDamage + secondaryDamage), CONST_ME_EXPLOSIONAREA) elseif Player.getCharmFromTarget(creature, attacker).name == "Adrenaline Burst" then setConditionParam(Burst, CONDITION_PARAM_SPEED, (creature:getBaseSpeed()*(3/2))) creature:addCondition(Burst) doPlayerSendTextMessage(creature, 21, "You are hasted. (adrenaline burst charm)") doSendMagicEffect(creature:getPosition(),CONST_ME_MAGIC_BLUE) elseif Player.getCharmFromTarget(creature, attacker).name == "Numb" then setConditionParam(Numbe, CONDITION_PARAM_SPEED, -((attacker:getBaseSpeed())/2)) attacker:addCondition(Numbe) doPlayerSendTextMessage(creature, 21, "You paralyze the creature. (numb charm)") doSendMagicEffect(attacker:getPosition(),CONST_ME_MAGIC_RED) end end if Player.getCharmFromTarget(creature, attacker).name == "Bless" then doPlayerSendTextMessage(creature, MESSAGE_DAMAGE_DEALT, "Falta fazer esta runa.") -- Need to do this part elseif Player.getCharmFromTarget(creature, attacker).name == "Cleanse" then if not(getPlayerStorageValue(creature, canCleanse) == 1) then doPlayerSendTextMessage(creature, 21, "You are now purified. (cleanse charm)") setPlayerStorageValue(creature, canCleanse, 1) cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) addEvent(function() cleanAllConditions(creature) setPlayerStorageValue(creature, canCleanse, 0) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end, 250) end end end return primaryDamage, primaryType, secondaryDamage, secondaryType end function cleanAllConditions(pplayer) local conditions = { CONDITION_POISON, CONDITION_FIRE, CONDITION_ENERGY, CONDITION_BLEEDING, CONDITION_PARALYZE, CONDITION_DRUNK, CONDITION_DROWN, CONDITION_FREEZING, CONDITION_DAZZLED, CONDITION_CURSED } for _, conditionType in pairs(conditions) do if pplayer:getCondition(conditionType) then pplayer:removeCondition(conditionType) end end end
Now this part, dodge, parry, adrenaline burst and numb is working fine, the only problem is that dodge rune is not blocking the creature condition, need to check it more. If you see, cleanse rune script part is very, very strange, but this is the only way i've done to make it work, and other big problem here is that it won't clean one atrribute from you and give you imunity to this condition, this script is cleaning ALL THE CONDITIONS and is repeating this process for 5 seconds with 250ms delay betwen the process. (Probably this will overload a bit you system, need to check it). To make it lighter, you can try to merge the onManaChange and onHealthChange. I don't know if you can do a onStatsChange, dont know if its possible, if it is, tell me please :) NOTE: Bless rune is not working, i can't find a way to grant the player more protection when you die to the selected creature, i'm trying to create a new bless, and grant this bless if you die to creature.
5
\data\events\scripts\monster.lua
... if not player or player:getStamina() > 840 then local monsterLoot = mType:getLoot() for i = 1, #monsterLoot do ------------------->Loot<------------------------ local item = corpse:createLootItem(monsterLoot[i]) --------------->Charm Rune<---------------------- if Player.getCharmFromTarget(player, self) then local itemType = ItemType(monsterLoot[i].itemId) if (itemType:getLootCategory() == 24) and (Player.getCharmFromTarget(player, self).name == "Gut") then local item1 = corpse:createLootItem(monsterLoot[i]) -- To add more chance, only copy and paste the 'local item1' line player:sendTextMessage(21, "You dropped boosted loot. (gut charm)") end end ------------------------------------------------- if not item then print('[Warning] DropLoot:', 'Could not add loot item to corpse.') ...
- This part is to activate the gut charm rune, you will double your chance to drop more creature products items, to add more chance only add more 'corpse:createlootitem' on the -- line.
6
\data\actions\scripts\tools\skinning.lua
-- Start of skinning.lua local canGut = 42352535 ...
01 At:
... local random, effect, transform = math.random(1, 100000), CONST_ME_MAGIC_GREEN, true ...
01 Replace to:
... local user1 = Player(player) if (getPlayerStorageValue(user1, canGut) == 1) then local chanceTo = 50000 else local chanceTo = 100000 end local random, effect, transform = math.random(1, chanceTo), CONST_ME_MAGIC_GREEN, true ...
02 At:
... for i = 1, #skin do _skin = skin[i] if random <= _skin.value then ...
02 Replace to:
... for i = 1, #skin do _skin = skin[i] if random <= _skin.value then if (getPlayerStorageValue(user1, canGut) == 1) then doPlayerSendTextMessage(user1, 21, "You scavange the creature. (scavange charm)") addEvent(function() setPlayerStorageValue(user1, canGut, 0) end, 20000) user1:getPosition():sendMagicEffect(CONST_ME_YELLOWENERGY) end ...
03 At:
... effect = CONST_ME_POFF transform = false target:remove() end elseif random <= skin.value then ...
03 Replace to:
... effect = CONST_ME_POFF transform = false target:remove() end elseif random <= skin.value then if (getPlayerStorageValue(user1, canGut) == 1) then doPlayerSendTextMessage(user1, 21, "You scavange the creature. (scavange charm)") addEvent(function() setPlayerStorageValue(user1, canGut, 0) end, 20000) user1:getPosition():sendMagicEffect(CONST_ME_YELLOWENERGY) end ...
- This part was already explained, this is the scavenge charm rune.
As you can see, i'm not a pro on programing, my scripts are far from perfect, if you can help me making it lighter and better, please i'm here to learn. If you find a way to make BLESS charm rune working, just post it here and i will try.
Need to check for bugs in game, i tested it on my offline server, try it on your server first before implementing this online for your players.
- I hope i can contribute with otserverbr with my script, i know i'm newbie on this but maybe it can help someone!. cya
Seens good, =)
Charm runes doesnt work on game.