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

TFS 0.X -=[TFS]=- 0.3.6 8.60 The monster appears on the player's

ParrotPLPL

Banned User
Joined
May 19, 2024
Messages
8
Reaction score
2
the monster appears on the player's side when the player stands on top of the monster, so the team creates several monsters at the same time

giphy.gifScreenshot_1.png.03a2c548a147300642723bdb0e64b2d9.pngScreenshot_2.png.a69c9f4f2c387af613e8dc0b3fe736fb.png
 
Solution
doCreateMonster
It was fix for 0.4. On 0.3.6 doCreateMonster looks like this ( forgottenserver036pl1/src/luascript.cpp at master · peonso/forgottenserver036pl1 (https://github.com/peonso/forgottenserver036pl1/blob/master/src/luascript.cpp#L4620) ):
Code:
doCreateMonster(name, pos[, displayError = true])
so there is no way to force spawn on position of player using just that function.

You got to spawn and then teleport monster to position.
Replace:
Lua:
addEvent(doCreateMonster, boss.seconds * 1000, boss.newBoss, position)
with:
Lua:
addEvent(function(bossName, position)
    local monsterId = doCreateMonster(bossName, position, false)
    -- `doCreateMonster` returns `true` when it fails.. and number with monster...
You should post as much useful information as possible. Where's the script?
You need to force create the monster, like this: doCreateMonster("[EXP] Statue", position, false, true)
 
@Addams

I've already done this and the monster doesn't appear on top of the player

Script Here:

Lua:
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

local lastTarget = nil
function onKill(cid, target, damage, flags)
    if lastTarget and lastTarget == target then
        return true
    end
    lastTarget = target

    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

@Edit
I wanted it like that

Untitled Project.gif


XML:
<?xml version="1.0" encoding="UTF-8"?>
  <monster name="[EXP] Statue" nameDescription="[EXP] Statue" race="blood" experience="100000000000000" speed="0" manacost="0">
    <health now="1000000000" max="1000000000"/>
    <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>
 
Last edited:
I've already done this and the monster doesn't appear on top of the player
addEvent(doCreateMonster, boss.seconds * 1000, boss.newBoss, position)
to
addEvent(doCreateMonster, boss.seconds * 1000, boss.newBoss, position, false, true)
 
Which TFS 0.x are you using? I tried quick on OTX2, which is supposed to be based on 0.x
Animation.gif
 
doCreateMonster
It was fix for 0.4. On 0.3.6 doCreateMonster looks like this ( forgottenserver036pl1/src/luascript.cpp at master · peonso/forgottenserver036pl1 (https://github.com/peonso/forgottenserver036pl1/blob/master/src/luascript.cpp#L4620) ):
Code:
doCreateMonster(name, pos[, displayError = true])
so there is no way to force spawn on position of player using just that function.

You got to spawn and then teleport monster to position.
Replace:
Lua:
addEvent(doCreateMonster, boss.seconds * 1000, boss.newBoss, position)
with:
Lua:
addEvent(function(bossName, position)
    local monsterId = doCreateMonster(bossName, position, false)
    -- `doCreateMonster` returns `true` when it fails.. and number with monster ID, when it works
    if type(monsterId) == "number" then
        doTeleportThing(monsterId, position, true)
    end
end, boss.seconds * 1000, boss.newBoss, position)
but in case of 0.3.6, if there will be monsters/players all around (1-2 sqm around) blocking all tiles, boss won't spawn.
That's why they added force parameter in 0.4, to make it possible to spawn monster on monster/player.
 
Solution
Back
Top