• 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 How do I make this monster spawn on top of the player?

Klock

New Member
Joined
Apr 22, 2024
Messages
30
Reaction score
1
Lua:
<?xml version="1.0" encoding="UTF-8"?>
  <monster name="[EXP] Statue" nameDescription="[EXP] Statue" race="blood" experience="100000000000000" speed="0" manacost="0">
    <health now="1" max="1"/>
    <look typeex="9791" corpse="6364"/>
    <targetchange interval="60000" chance="0"/>
    <strategy attack="100" defense="0"/>
    <flags>
      <flag summonable="0"/>
      <flag attackable="1"/>
      <flag hostile="0"/>
      <flag illusionable="0"/>
      <flag convinceable="0"/>
      <flag pushable="0"/>
      <flag canpushitems="0"/>
      <flag staticattack="100"/>
      <flag lightlevel="0"/>
      <flag lightcolor="0"/>
      <flag targetdistance="0"/>
      <flag runonhealth="0"/>
      <flag skull="5"/>
    </flags>
    <attacks>
      <attack name="melee" interval="" min="" max=""/>
    </attacks>
    <defenses armor="1000000000" defense="1000000000">
     <defense name="healing" interval="" chance="1000000000" min="1000000000" max="1000000000">
     <attribute key="areaEffect" value="blueshimmer"/>
     </defense>
    </defenses>
    <immunities>
      <immunity physical="0"/>
      <immunity energy="0"/>
      <immunity fire="0"/>
      <immunity poison="0"/>
      <immunity lifedrain="0"/>
      <immunity paralyze="0"/>
      <immunity outfit="0"/>
      <immunity drunk="0"/>
      <immunity invisible="0"/>
    </immunities>
    <voices interval="5000" chance="2000">
<voice sentence="Bonús-EXP!"/>
    </voices>
    <loot>
    </loot>

  </monster>

XML:
local colorMsg = "orange"
local tableBoss = {
    ["[EXP] Statue"] = {seconds = 3600, newBoss = "[EXP] Statue"}
}

local function timer(position, duration, color)
    for i = 0, (duration - 1) do
        addEvent(function()
            doSendAnimatedText(position, tostring(duration - i), color)
        end, i * 1000)
    end
end

function onKill(cid, target, damage, flags)
    if isPlayer(target) then
        return true
    end
    local boss = tableBoss[getCreatureName(target)]
    if not boss then
        return true
    end
    local position = getThingPos(target)
        doPlayerSendTextMessage(cid, MESSAGE_TYPES[colorMsg], "The boss will be born in " .. boss.seconds .. " seconds.")
        timer(position, boss.seconds, COLOR_WHITE)
        addEvent(doCreateMonster, boss.seconds * 1000, boss.newBoss, position)
    return true
end
 
change:
Lua:
addEvent(doCreateMonster, boss.seconds * 1000, boss.newBoss, position)
to:
Lua:
addEvent(doCreateMonster, boss.seconds * 1000, boss.newBoss, position, false, true)
 
Untitled Project.gif
XML:
[25/04/2024 06:50:39] [Error - CreatureScript Interface]
[25/04/2024 06:50:39] In a timer event called from:
[25/04/2024 06:50:39] data/creaturescripts/scripts/[EXP] Statue.lua:onKill
[25/04/2024 06:50:39] Description:
[25/04/2024 06:50:40] (luaDoCreateMonster) Monster with name '' not found
Untitled Projectç~].gif
 
Last edited:
Ahh my bad, I thought it was Game.createMonster. If you are using TFS 0.4, then I'm not sure if it is possible to force spawn.

This is the problem with using an old codebase... You will have to edit your sources to create an additional parameter to force spawn for doCreateMonster(if it doesnt already exist)
 
Back
Top