• 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!

RevScripts boss damage

alcapone

Member
Joined
Jan 13, 2021
Messages
76
Reaction score
8
good night i'm learning and i'm trying to make a script for all the damage that the weak spot monster receives the boss the pale worm receives the same damage


Lua:
local effects = {
    [COMBAT_PHYSICALDAMAGE] = CONST_ME_DRAWBLOOD,
    [COMBAT_ENERGYDAMAGE] = CONST_ME_ENERGYAREA,
    [COMBAT_EARTHDAMAGE] = CONST_ME_POISONAREA,
    [COMBAT_FIREDAMAGE] = CONST_ME_FIREAREA,
    [COMBAT_ICEDAMAGE] = CONST_ME_ICEAREA,
    [COMBAT_HOLYDAMAGE] = CONST_ME_HOLYAREA,
    [COMBAT_DEATHDAMAGE] = CONST_ME_MORTAREA,
    [COMBAT_HEALING] = CONST_ME_MAGIC_GREEN
}


local ThePaleWorm = CreatureEvent("ThePaleWorm")
function ThePaleWorm.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if not attacker or not creature:isMonster() then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
  if creature:getName():lower() == 'the pale worm' then
        local spectators = Game.getSpectators(Position(23735, 21562, 13), false, false, 20, 20, 20, 20)
        for i = 1, #spectators do
            local spectator = spectators[i]
        
 
            if spectator:getName():lower() == 'a weak spot' then
            
            spectator:addHealth(-primaryDamage, effects[primaryType])
        
            
            
    
            
            
                 return creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin
            end
        end
    
    
        
        
    end
  return creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin
end

ThePaleWorm:register()
 

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
5,612
Solutions
395
Reaction score
3,729
What is the question?
I understand you want help, but I'm not sure what you want help with.
 
OP
OP
A

alcapone

Member
Joined
Jan 13, 2021
Messages
76
Reaction score
8
What is the question?
I understand you want help, but I'm not sure what you want help with.
the 'monster 1' is on the first floor the 'monster 2' is on the second floor all the damage the monster on the second floor takes the monster on the first floor will take the same damage
 

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
5,612
Solutions
395
Reaction score
3,729
the 'monster 1' is on the first floor the 'monster 2' is on the second floor all the damage the monster on the second floor takes the monster on the first floor will take the same damage
I must be exceptionally dense tonight.

Your current script appears to be doing that.

Is it not working?
Are you getting errors?
 
OP
OP
A

alcapone

Member
Joined
Jan 13, 2021
Messages
76
Reaction score
8
I must be exceptionally dense tonight.

Your current script appears to be doing that.

Is it not working?
Are you getting errors?
is working in parts the boss on the first floor is the boss who should drop the loot more as the player does not hit it but the second boss the player does not receive loot
 

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
5,612
Solutions
395
Reaction score
3,729
is working in parts the boss on the first floor is the boss who should drop the loot more as the player does not hit it but the second boss the player does not receive loot
Ah, because you are damaging the creature with the system, instead of with the player.

Instead of using
Lua:
spectator:addHealth(-primaryDamage, effects[primaryType])
use
Lua:
doTargetCombat(attacker, spectator, primaryType, -primaryDamage, -primaryDamage, effects[primaryType])

I've helped someone with this in the past, if you want to take some idea's / copy it directly.


bandicam-2020-07-25-14-12-35-487-gif.47745
 
Top