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

Imortal monster creaturescript

bagocobra

New Member
Joined
Oct 21, 2012
Messages
48
Reaction score
2
How can i create an imortal monster, that is imortal only when there is another x monster in the area??
 
Creaturescript for onChangeHealth and a extra function with fromPos and toPos to scan if the monster is on the desired area
 
can you give me an exemple? and i need a monster that when get hit by fire damage, it heals that damage instead of losing life.
 
How can i create an imortal monster, that is imortal only when there is another x monster in the area??
You would have to do something like this, but I would be worried how much resources this script would take.
Lua:
local area_range = 7
local creature_needed = "Demon"

function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    local specs = Game.getSpectators(creature:getPosition(), false, false, area_range, area_range, area_range, area_range)
    for key, spec in pairs(specs) do
        if spec:getName() == creature_needed then
            return 0, 0, 0, 0
        end
    end
    return primaryDamage, primaryType, secondaryDamage, secondaryType
end

Also you'll have to register the event to the creature when it's spawned.
Lua:
creature:registerEvent(eventName)
If it's spawned at map load then you would have to add something like this:
 
You would have to do something like this, but I would be worried how much resources this script would take.
Lua:
local area_range = 7
local creature_needed = "Demon"

function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    local specs = Game.getSpectators(creature:getPosition(), false, false, area_range, area_range, area_range, area_range)
    for key, spec in pairs(specs) do
        if spec:getName() == creature_needed then
            return 0, 0, 0, 0
        end
    end
    return primaryDamage, primaryType, secondaryDamage, secondaryType
end

Also you'll have to register the event to the creature when it's spawned.
Lua:
creature:registerEvent(eventName)
If it's spawned at map load then you would have to add something like this:
Sure if he used this for all demons but he wouldn't be returning any values
 
Back
Top