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

Item Text Effect [REQUEST]

LOpi

New Member
Joined
Aug 13, 2007
Messages
23
Reaction score
1
Im trying to find out how when you equip an item, a text pops up on you every like 3 seconds, kinda like the portals with name but with equipable items please help. Im using TFS 3.6(8.60)!!
 
Put this in creature scripts and make sure you register it to login.lua
Lua:
local ITEM_ID = 7899
local text = "words go here"
function onThink(cid, interval, lastExecution)
	if exhaustion.check(cid, 23056) then return true end
	if (getPlayerSlotItem(cid, CONST_SLOT_ARMOR).itemid == ITEM_ID) then
		doSendAnimatedText(getCreaturePosition(cid), "".. text .."", COLOR_RED)
		exhaustion.set(cid, 23056, 2)
	end
	return true
end
 
TY for helping, I put this in login.ua inside creature scripts
Lua:
local config = {
	loginMessage = getConfigValue('loginMessage'),
	useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
	local loss = getConfigValue('deathLostPercent')
	if(loss ~= nil) then
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
	end

	local accountManager = getPlayerAccountManager(cid)
	if(accountManager == MANAGER_NONE) then
		local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
		if(lastLogin > 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
			str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
		else
			str = str .. " Please choose your outfit."
			doPlayerSendOutfitWindow(cid)
		end

		doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
	elseif(accountManager == MANAGER_NAMELOCK) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
	elseif(accountManager == MANAGER_ACCOUNT) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
	end

	if(not isPlayerGhost(cid)) then
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
	end

	registerCreatureEvent(cid, "Mail")
	registerCreatureEvent(cid, "GuildMotd")
registerCreatureEvent(cid,'SpellUp')
registerCreatureEvent(cid, "partyAndGuildProtection")
registerCreatureEvent(cid, "PointSystem")
registerCreatureEvent(cid, "Sworddis") ----- THIS IS HOW I PUT IT --->


	registerCreatureEvent(cid, "Idle")
	if(config.useFragHandler) then
		registerCreatureEvent(cid, "SkullCheck")
	end

	registerCreatureEvent(cid, "ReportBug")
	registerCreatureEvent(cid, "AdvanceSave")
	return true
end
Lua:
 local ITEM_ID = 2390
local text = "Oblivion Slayer"
function onThink(cid, interval, lastExecution)
	if exhaustion.check(cid, 23056) then return true end
	if (getPlayerSlotItem(cid, CONST_SLOT_ARMOR).itemid == ITEM_ID) then
		doSendAnimatedText(getCreaturePosition(cid), "".. text .."", COLOR_RED)
		exhaustion.set(cid, 23056, 2)
	end
	return true

Doent work

error.jpg
 
Add it as type think, also change the slot armor to right and left if you use a weapon, now it's checking if it has a sword on the armor slot.
Although you can also add it as a globalevent (it's the same script as Synthetic_ posted, but added 2 lines so it works as a globalevent).
Lua:
local ITEM_ID = 2390
local text = "Oblivion Slayer"

function onThink(interval, lastExecution)
         for _, name in ipairs(getOnlinePlayers()) do
         local cid = getPlayerByName(name)
		if (getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == ITEM_ID) or (getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == ITEM_ID) then
			doSendAnimatedText(getCreaturePosition(cid), "".. text .."", COLOR_RED)
               	end
         end
         return true
end

Then add the time in the globalevent xml line.
 
Last edited:
Add it as type think, also change the slot armor to right and left if you use a weapon, now it's checking if it has a sword on the armor slot.
Although you can also add it as a globalevent (it's the same script as Synthetic_ posted, but added 2 lines so it works as a globalevent).
Lua:
local ITEM_ID = 2390
local text = "Oblivion Slayer"

function onThink(interval, lastExecution)
         for _, name in ipairs(getOnlinePlayers()) do
         local cid = getPlayerByName(name)
		if (getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == ITEM_ID) or (getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == ITEM_ID) then
			doSendAnimatedText(getCreaturePosition(cid), "".. text .."", COLOR_RED)
               	end
         end
         return true
end

Then add the time in the globalevent xml line.

It's more efficient in terms of server resources to use creature scripts rather then running a constant loop through every player online :p

@OP: It didn't work because you capitalized "S" when you registered it in login.lua, and the actual lua file wasn't.
 
Back
Top Bottom