• 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 Animated Text

Alyhide

Banned User
Joined
Aug 21, 2010
Messages
1,945
Reaction score
54
Location
Switzerland
Hello, I am wondering how to do that animated text thingy that like :

Hello! pops up at 1000,1000,7 etc.


Rep++ I will be searching for the script also.
 
check doc/lua functions next time
doSendAnimatedText(pos, text, color[, player])
Example taken from one of my scripts
doSendAnimatedText(config.Pos, "" .. 16-getGlobalStorageValue(5056) .. " min", TEXTCOLOR_YELLOW)
 
this is for onUse, but try eet? >.< set an item with the action ID. D:::::

Lua:
text_Text = {{"hello!", "hello"},{"HeLlO?", "hellO"},{"HELL-o", "ELLO!"},{"hello!", "hello"}}
function AnimTexter(parameters)
     doSendAnimatedText(parameters.pos,parameters.text,parameters.color)
     delay10 = delay10+400
end

function onUse(cid,item,frompos,item2,topos)
     local playerpos = getPlayerPosition(cid)
     local color = {}
     local text_Text_Div = {}
     delay10 = 0
     local random_number = math.random(1,table.getn(text_Text))
     text_Text_Div = text_Text[random_number]
     if(getPlayerItemCount(cid,item.itemid)>= 1) then
           textpos = playerpos
     else
           textpos = playerpos
     end
     local parameters1 = { pos = textpos, text = text_Text_Div[1], color = math.random(150,190)}
     local parameters2 = { pos = textpos, text = text_Text_Div[2], color = math.random(150,190)}
     local parameters3 = { pos = textpos, text = text_Text_Div[3], color = math.random(150,190)}
     local parameters4 = { pos = textpos, text = text_Text_Div[4], color = math.random(150,190)}
     local parameters5 = { pos = textpos, text = text_Text_Div[5], color = math.random(150,190)}
     local parameters6 = { pos = textpos, text = text_Text_Div[6], color = math.random(150,190)}
     local parameters7 = { pos = textpos, text = text_Text_Div[7], color = math.random(150,190)}
     local parameters8 = { pos = textpos, text = text_Text_Div[8], color = math.random(150,190)}
     local parameters9 = { pos = textpos, text = text_Text_Div[9], color = math.random(150,190)}
     addEvent(AnimTexter,400,parameters1)
     addEvent(AnimTexter,1000,parameters2)
     addEvent(AnimTexter,1700,parameters3)
     addEvent(AnimTexter,2100,parameters4)
     addEvent(AnimTexter,2700,parameters5)
     addEvent(AnimTexter,3600,parameters6)
     addEvent(AnimTexter,4100,parameters7)
     addEvent(AnimTexter,4600,parameters8)
     addEvent(AnimTexter,5000,parameters9)

     return true

end
end
 
No look, it justs send a text with all colors and effects at random in a certain square it should be something like this :

Code:
     local parameters1 = { pos = 1000,1000,7}

etc.
 
go find one of those talking tp's and sign's script and just rip the code from there, i believe all u need is a math.random() in the color param that ranges between valid values
 
Lua:
local config = {
 positions = {
  ["Text.."] = { x = 1000, y = 1000, z = 7 },
  ["Text.."] = { x = 1000, y = 1000, z = 7 },
  ["Text.."] = { x = 1000, y = 1000, z = 7 },
  ["Text.."] = { x = 1000, y = 1000, z = 7 },
  ["Text.."] = { x = 1000, y = 1000, z = 7 },
  ["Text.."] = { x = 1000, y = 1000, z = 7 },
},

 effects = {
  CONST_ME_MAGIC_BLUE,
  CONST_ME_MAGIC_GREEN,
 },

 colors = {
  TEXTCOLOR_WHITE,
  TEXTCOLOR_ORANGE,
  TEXTCOLOR_GREEN,
  TEXTCOLOR_BLUE
 }
}

function onThink(cid, interval, lastExecution)
 for text, pos in pairs(config.positions) do
  doSendMagicEffect(pos, config.effects[math.random(1, #config.effects)])
  doSendAnimatedText(pos, text, config.colors[math.random(1, #config.colors)])
 end
 return TRUE
end
 
Last edited:
Try this:
Lua:
local config = {
    positions = {
        ["Welcome!"] = { x = 1360, y = 1081, z = 7 },
        ["Depot"] = { x = 1358, y = 1082, z = 7 },
        ["N P C"] = { x = 1362, y = 1082, z = 7 },
        ["Quest"] = { x = 1358, y = 1079, z = 7 },
        ["Eventos"] = { x = 1363, y = 1082, z = 7 },
        ["Trainers"] = { x = 1362, y = 1079, z = 7 },
        ["Speedy As"] = { x = 1360, y = 1084, z = 8 },
        ["ChangeMap"] = { x = 1360, y = 1076, z = 7 },
        ["VIP Zone"] = { x = 1357, y = 1082, z = 7 },
        ["Clic Aqui"] = { x = 1007, y = 876, z = 7 },
        ["Clik Aqui"] = { x = 992, y = 884, z = 7 },
        ["Evento"] = { x = 991, y = 880, z = 7 },
    }
}

function onThink(cid, interval, lastExecution)
    for text, pos in pairs(config.positions) do
        doSendAnimatedText(pos, text, math.random(1, 255))
    end
    
    return TRUE
end
It will send text with random color in a certain position... ^^
 
Code:
--[[ 
	Talking Tp/signs/tiles for TFS 0.3+
	by Maxi (Shawak)
]]--
 
	local text = {
	--X pos,Y pos, Z pos, text
	[1] = {pos = {1000,1000,7}, text = {"TEXT"}},
	[2] = {pos = {1000,1001,7}, text = {"TEXT"}},
	[3] = {pos = {1000,1002,7}, text = {"TEXT"}},
	[4] = {pos = {1000,1003,7}, text = {"TEXT"}}
	}
 
	local effects = {
	--X pos,Y pos, Z pos, text
	[1] = {pos = {1095,1217,7}, effect = {18}},
	[2] = {pos = {1096,1217,7}, effect = {19}},
	[3] = {pos = {1097,1217,7}, effect = {21}},
	[4] = {pos = {1098,1217,7}, effect = {22}}
	}
 
function onThink(interval, lastExecution)
	for _, area in pairs(text) do
		doSendAnimatedText({x=area.pos[1],y=area.pos[2],z=area.pos[3]},area.text[1], math.random(01,255))
	end
	for _, area in pairs(effects) do
		doSendMagicEffect({x=area.pos[1],y=area.pos[2],z=area.pos[3]},area.effect[1])
	end
	return TRUE
end

Add your own positions and text.
 
Try this:
Lua:
local config = {
    positions = {
        ["Welcome!"] = { x = 1360, y = 1081, z = 7 },
        ["Depot"] = { x = 1358, y = 1082, z = 7 },
        ["N P C"] = { x = 1362, y = 1082, z = 7 },
        ["Quest"] = { x = 1358, y = 1079, z = 7 },
        ["Eventos"] = { x = 1363, y = 1082, z = 7 },
        ["Trainers"] = { x = 1362, y = 1079, z = 7 },
        ["Speedy As"] = { x = 1360, y = 1084, z = 8 },
        ["ChangeMap"] = { x = 1360, y = 1076, z = 7 },
        ["VIP Zone"] = { x = 1357, y = 1082, z = 7 },
        ["Clic Aqui"] = { x = 1007, y = 876, z = 7 },
        ["Clik Aqui"] = { x = 992, y = 884, z = 7 },
        ["Evento"] = { x = 991, y = 880, z = 7 },
    }
}

function onThink(cid, interval, lastExecution)
    for text, pos in pairs(config.positions) do
        doSendAnimatedText(pos, text, math.random(1, 255))
    end
    
    return TRUE
end
It will send text with random color in a certain position... ^^

Thanks for post but i use last rev for 9.42 - 0.4

Error

dosendanimatedtext is now a deprecated function.
 
Back
Top