• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

CreatureEvent PVE Balancing (Monsters VS Players)

Shadow_

Veteran OT User
Joined
Jun 2, 2018
Messages
922
Solutions
30
Reaction score
342
Hey there,
I was thinking about that testing sometimes be pain in ass when am alone and i need to do the monster exactly dies with XX count of spells or a team boss that dies exactly with 3-4 players so i decided to make that code so if i want to monster to die by 2 players just say !pvebalance 2 and then try if it died easily I then can to decrease it to be like !pvebalance 1.6 and that 0.4 difference multiply it to the monster health and defenses so it is exactly as i want it, i can be very useful for PVE balancing and it offers much time.

RED NOTE : Don't add this on a released server (it should be added only for admin testing and balancing shit)

Talkactions/talkactions.xml
Code:
    <talkaction words="!pvebalance" separator=" " script="pvebalance.lua"/>
Talkactions/scripts
pvebalance.lua
Lua:
function onSay(player, words, param)
    local storage = 68935
    local multiplier = tonumber(param)
    player:setStorageValue(storage, multiplier)
    return false
end
creaturescripts.xml
Code:
<event type="healthchange" name="pvebalance" script="pvebalance.lua" />
creaturescripts/scripts
pvebalance.lua
Lua:
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
  if not creature or not attacker or creature == attacker then
    return primaryDamage, primaryType, secondaryDamage, secondaryType
  end
  if primaryType == COMBAT_HEALING or secondaryType == COMBAT_HEALING or primaryType == COMBAT_MANADRAIN or secondaryType == COMBAT_MANADRAIN then
    return primaryDamage, primaryType, secondaryDamage, secondaryType
  end
  local storage = player:getStorageValue(68935)
      if attacker:isPlayer() and creature:isMonster() and storage > 0 then
            primaryDamage = math.floor(primaryDamage - (primaryDamage * storage))
            secondaryDamage = math.floor(secondaryDamage - (secondaryDamage * storage))
        return primaryDamage, primaryType, secondaryDamage, secondaryType
      end
  return primaryDamage, primaryType, secondaryDamage, secondaryType
end
login.lua
Code:
    player:registerEvent("pvebalance")
events/scripts
creature.lua
under the function VV at the end of it add
Code:
function Creature:onTargetCombat(target)
Code:
target:registerEvent("pvebalance")
self:registerEvent("pvebalance")
PS: i might have added more registry than needed, because i didn't test it yet but im sure it will work with those bunch of registry, sorry for not using revscripts i didn't take a look on it yet + i didn't update my sources to when it was added

updates in mind : to add like id or another command with another storage to increase the monsters DMG for the player as this do the opposite.
 
Last edited:

Codinablack

Dreamer
Content Editor
Premium User
Joined
Dec 26, 2013
Messages
1,383
Solutions
7
Reaction score
512
This is a very interesting idea! There are many ways one could go about it, but for barebones testing and balancing this is perfect!

I have been considering making custom monster ai, and if I go that route, I will definitely implement the inspiration I found in this post.
 
Top