Skip to content

Rename a monster remove monster from battle list #1741

Description

@ArturKnopik

Priority

Low

Area

  • Data
  • Source
  • Docker
  • Other

What happened?

https://youtu.be/DsReABGMEm8

void ProtocolGame::parseTileTransformThing(const InputMessagePtr& msg)

Deleting and re-adding a monster causes it to no longer appear on the battle list (after changing its name) and the player stops attacking that monster

Notes:
Try to attack monster as god using provided script - this will trigger monster onThink event but monster will stay in place , moving monster will go back to battlelist

Tested on latest TFS, idk how canary handle this case but i think it will behaves in the same way

Helper script

local prefixes = { "1 ", "2 ", "3 " }
local timer = 5
local current = 1

local onThink = CreatureEvent("RatNameChange")

function onThink.onThink(creature)
    print(creature:getName(), "counter", current)
    timer = timer - 1

    if timer <= 0 then
        creature:rename(prefixes[current] .. " rat")

        current = current + 1
        if current > #prefixes then
            current = 1
        end

        timer = 5
    end

    return true
end

onThink:register()

local talkaction = TalkAction("/rat")

function talkaction.onSay(player, words, param)
    local monster = Game.createMonster("Rat", player:getPosition(), true, true)

    if monster then
        monster:registerEvent("RatNameChange")
    end

    return false
end

talkaction:register()

What OS are you seeing the problem on?

Windows

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority: LowMinor impactStatus: Pending TestThis PR or Issue requires more testingType: BugInconsistencies or issues which will cause an issue or problem for users or implementors.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions