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

Solved Text reappear

Exoltes

Novia OTserv Developer
Joined
Jul 2, 2009
Messages
563
Reaction score
47
Location
Belgium
I'm working on a 8.54 Open Tibia Server using The Forgotten Server - Version 0.2.7 (Mystic Spirit).

I wondered if it is possible to block a message from reappearing if there is still a message visible on the sqm.

Code:
        doCreatureSay(cid, "Test", TALKTYPE_ORANGE_1)
 
What are you trying to do? You can add an exhaustion for that message so it can't appear again when it's still there.
For example an exhaustion condition like potions have if it's just for the same player, or global storage with os.time() if it should be for all players at the same time.
 
Above function onStepIn
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST_HEAL)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 3000)

Under function onStepIn
Code:
if getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE then
     return TRUE
end

Under the textmessage
Code:
doAddCondition(cid, exhaust)
 
Is there a way to do this for npcs also?

Tried is this way but that doesn't seem to have any effect.

Code:
local exhaust = createConditionObject(CONDITION_EXHAUST_HEAL)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 4000)
local pos = {x = 836, y = 940, z = 7, stackpos = 253}
local poss = {x = 839, y = 940, z = 7, stackpos = 253}
function onStepIn(cid, item, pos)

    if item.actionid == 30102 then
          queststatus = getPlayerStorageValue(cid,6580)
              if queststatus == -1 then
                doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You are not allowed to enter the nightmare knights castle.')
                doTeleportThing(cid,{x = 837, y = 942, z = 7})
                if getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE then
                    return TRUE
                end
                doCreatureSay(getThingfromPos(pos).uid, "Begone!", TALKTYPE_SAY)
                doAddCondition(cid, exhaust)
                doCreatureSay(getThingfromPos(poss).uid, "Begone!", TALKTYPE_SAY)
                doAddCondition(cid, exhaust)
            else
                if getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE then
                    return TRUE
                end
                    doCreatureSay(getThingfromPos(pos).uid, "Welcome!", TALKTYPE_SAY)
                doAddCondition(cid, exhaust)
                    doCreatureSay(getThingfromPos(poss).uid, "Welcome!", TALKTYPE_SAY)
                doAddCondition(cid, exhaust)
            end
    elseif item.actionid == 30103 then
          queststatus = getPlayerStorageValue(cid,6580)
              if queststatus == -1 then
                doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You are not allowed to enter the nightmare knights castle.')
                doTeleportThing(cid,{x = 838, y = 942, z = 7})
                if getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE then
                    return TRUE
                end
                doCreatureSay(getThingfromPos(pos).uid, "Begone!", TALKTYPE_SAY)
                doAddCondition(cid, exhaust)
                doCreatureSay(getThingfromPos(poss).uid, "Begone!", TALKTYPE_SAY)
                doAddCondition(cid, exhaust)

            else
                if getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE then
                    return TRUE
                end
                    doCreatureSay(getThingfromPos(pos).uid, "Welcome!", TALKTYPE_SAY)
                doAddCondition(cid, exhaust)
                    doCreatureSay(getThingfromPos(poss).uid, "Welcome!", TALKTYPE_SAY)
                doAddCondition(cid, exhaust)
            end
end

    return 1
end
 
You can't add storage or a condition to an npc. You can do that it only works for players.
If it should also work for npcs, you can use global storage with os.time() + exhaust time as value, then compare the storagevalue with os.time() to see if the exhaustion is still there.
 

Similar threads

Back
Top