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

Lua If enter area display effect and spawn monster

henkas

Well-Known Member
Joined
Jul 8, 2015
Messages
1,051
Solutions
5
Reaction score
62
Hey looking for a interesing system that i saw multiple servers are using basically if they enter defined area a effect is being displayed in x,y,z position and after effect ends monster spawns so its like they create a animation for example demon enering a portal and once the animattion ends the acttual monster appears.
 
Solution
LUA:
<movevent type="StepIn" uniqueid="12345" event="script" value="teleport_spawn.lua"/>
add new lua script in data/movements/scripts
Code:
local config =
    spawnPos = {x = 100, y = 100, z = 7},
    magicEffect = CONST_ME_TELEPORT,
    monsterName = "Rat",
    spawnDelay = 5000
}

function onStepIn(creature, item, position, fromPosition)
    doSendMagicEffect(config.spawnPos, config.magicEffect)
   
    addEvent(function()
        -- Always check if the monster can be placed
        local spawnedMonster = doSummonCreature(config.monsterName, config.spawnPos)
        if spawnedMonster then
            print("Successfully summoned monster: " .. config.monsterName)
        else
            print("Failed to summon monster at position: "...
LUA:
<movevent type="StepIn" uniqueid="12345" event="script" value="teleport_spawn.lua"/>
add new lua script in data/movements/scripts
Code:
local config =
    spawnPos = {x = 100, y = 100, z = 7},
    magicEffect = CONST_ME_TELEPORT,
    monsterName = "Rat",
    spawnDelay = 5000
}

function onStepIn(creature, item, position, fromPosition)
    doSendMagicEffect(config.spawnPos, config.magicEffect)
   
    addEvent(function()
        -- Always check if the monster can be placed
        local spawnedMonster = doSummonCreature(config.monsterName, config.spawnPos)
        if spawnedMonster then
            print("Successfully summoned monster: " .. config.monsterName)
        else
            print("Failed to summon monster at position: " ..
                  config.spawnPos.x .. ", " ..
                  config.spawnPos.y .. ", " ..
                  config.spawnPos.z)
        end
    end, config.spawnDelay)

    return true
end

should work
 
Solution
Back
Top