<Sorry bad english xP>Author 1.0: Mock
Author 2.0: Mock
Authoe 3.0: Mock
Test 1.0: Aries 0.4.0
Test 2.0: TFS 0.3 (Want 2.0 for TFS 0.2? Click
Test 3.0: OTserv matrix, TFS 0.2 and 0.3
Well, before some versions this is the better version from all. Many peoples don't know but the real creator of this script it's me! many noobs was ripped it to other forums, if you dont belive i can send to you the link from versions 1.0 and 2.0 (1.0 i post on **serv net***** on exactaly 28-07-08, 18:22).
The 2 new features of this script is: you can run functions and send animated text with more than 9 characters (YES)
like this:
I will break this threat in 2 parts, With global events and without globalevents.
------------------------------------------------------------
With global events
Well, go to data/globalevents/globalevents.xml open it and add this tag:
Code:
<globalevent name="show" interval="1" script="show.lua"/>
Now in show.lua in data/globalevents/scripts add it:
Code:
----------------------------
--------Talkting TPS 3.0 ---
---------- By mock ---------
--dont remove the credists--
----------------------------
clolortypes = {
{kind=2,chance=100,{x=100,y=100,z=7},'Haha i can say ma ny words with this script ;D ---By mock ',255}, -- kind (text), chance 100%,pos,Text,color
{kind=3,chance=98,{x=100,y=100,z=7},{x=102,y=102,z=7},CONST_ANI_SPEAR}, -- kind(distance), chance 98%, frompos, topos, distance
{kind=4,chance=10,function() --- kind(function), chance 10%, function
local pos = {x=110,y=110,z=7,stackpos=255}
local a = getThingfromPos(pos)
if isPlayer(a.uid) == TRUE then
doTeleportThing(a.uid, {x=100,y=100,z=7})
end
end},
{kind=1,chance=20,{x=100,y=100,z=7},CONST_ME_WATERCREATURE}, -- kind (effect), chance 20%, pos, effecttype
}
function animatedTextBig(pos,text,color)
--- Function by mock.
local pos2 = {x=pos.x,y=pos.y,z=pos.z} -- pra nao bugar xP
local letters = 9
local c = math.floor(#text/letters)
local ac = 0
for i=1,c do
ac = i
doSendAnimatedText(pos2,string.sub(text,letters*(i-1),letters*i-1), color)
pos2.x = pos2.x+1
end
doSendAnimatedText(pos2,string.sub(text,letters*(ac),#text), color)
return ac
end
function run_it()
for i=1,#clolortypes do
if clolortypes[i].kind == 1 then
if clolortypes[i].chance >= math.random(1,100) then
doSendMagicEffect(clolortypes[i][1],clolortypes[i][2])
end
elseif clolortypes[i].kind == 2 then
if clolortypes[i].chance >= math.random(1,100) then
animatedTextBig(clolortypes[i][1],clolortypes[i][2],clolortypes[i][3])
end
elseif clolortypes[i].kind == 3 then
if clolortypes[i].chance >= math.random(1,100) then
doSendDistanceShoot(clolortypes[i][1],clolortypes[i][2],clolortypes[i][3])
end
elseif clolortypes[i].kind == 4 then
if clolortypes[i].chance >= math.random(1,100) then
xpcall(clolortypes[i][1](),false) --- para nao parar o evento
end
end
end
end
function onThink(interval, lastExecution)
run_it()
return TRUE
end
Save it.
------------------------------------------------------------
Without global events
I'ts good to use on otserv matrix or in TFS 0.2 or in older distros.
First you need know, you dont have globalevents, we will use loop of addEvents (recursividade), but we need something to start it so we will use and TALKACTION so the difference is in the last END i put addEvent ^^
like this:
Code:
----------------------------
--------Talkting TPS 3.0 ---
---------- By mock ---------
--dont remove the credists--
----------------------------
clolortypes = {
{kind=2,chance=100,{x=100,y=100,z=7},'Haha i can say ma ny words with this script ;D ---By mock ',255}, -- kind (text), chance 100%,pos,Text,color
{kind=3,chance=98,{x=100,y=100,z=7},{x=102,y=102,z=7},CONST_ANI_SPEAR}, -- kind(distance), chance 98%, frompos, topos, distance
{kind=4,chance=10,function() --- kind(function), chance 10%, function
local pos = {x=110,y=110,z=7,stackpos=255}
local a = getThingfromPos(pos)
if isPlayer(a.uid) == TRUE then
doTeleportThing(a.uid, {x=100,y=100,z=7})
end
end},
{kind=1,chance=20,{x=100,y=100,z=7},CONST_ME_WATERCREATURE}, -- kind (effect), chance 20%, pos, effecttype
}
function animatedTextBig(pos,text,color)
--- Function by mock.
local pos2 = {x=pos.x,y=pos.y,z=pos.z} -- pra nao bugar xP
local letters = 9
local c = math.floor(#text/letters)
local ac = 0
for i=1,c do
ac = i
doSendAnimatedText(pos2,string.sub(text,letters*(i-1),letters*i-1), color)
pos2.x = pos2.x+1
end
doSendAnimatedText(pos2,string.sub(text,letters*(ac),#text), color)
return ac
end
function run_it()
local delay = 1 -- seconds
for i=1,#clolortypes do
if clolortypes[i].kind == 1 then
if clolortypes[i].chance >= math.random(1,100) then
doSendMagicEffect(clolortypes[i][1],clolortypes[i][2])
end
elseif clolortypes[i].kind == 2 then
if clolortypes[i].chance >= math.random(1,100) then
animatedTextBig(clolortypes[i][1],clolortypes[i][2],clolortypes[i][3])
end
elseif clolortypes[i].kind == 3 then
if clolortypes[i].chance >= math.random(1,100) then
doSendDistanceShoot(clolortypes[i][1],clolortypes[i][2],clolortypes[i][3])
end
elseif clolortypes[i].kind == 4 then
if clolortypes[i].chance >= math.random(1,100) then
xpcall(clolortypes[i][1](),false) --- para nao parar o evento
end
end
end
addEvent(run_it,1000*delay,false)
end
function onSay(cid, words, param)
run_it()
return TRUE
end
Create ans normal script in talkactions/scripts, save it how as show.lua and add this tag:
Code:
<talkaction words="!show" script="show.lua"/>
To run script you must need put: run_it() in the script ^^, now you can add ascess ETC~.
-------------------------------------------------------------
Config
It's verry easy to config.
--- Config animatex text.
You need add an table sctructure like this on table clolortypes
Code:
{kind=[COLOR="Red"]2[/COLOR],chance=%,pos,text,color},
Chance is 1-100
pos: {x=...}
Text = 'Haha i can say ma ny words with this script ;D ---By mock '
Color = TEXTCOLOR_YELLOW or 210 (0-255)
--- Config magic effect.
You need add an table sctructure like this on table clolortypes
{kind=1,chance=%,pos,type},
2 its an constante, if you change kind to othern umber will take some error ^^
Chance is 1-100
pos: {x=...}
type = CONST_ME_WATERCREATURE
--- Config distance shoot.
You need add an table sctructure like this on table clolortypes
Code:
{kind=[COLOR="Red"]3[/COLOR],chance=%,frompos,topos,type},
Chance is 1-100
frompos: {x=...}
topos: {x=...}
type: CONST_ANI_SPEAR (or id)
--- Config functions.
You need add an table sctructure like this on table clolortypes
Code:
{kind=[COLOR="Red"]4[/COLOR],chance=10,function},
Chance is 1-100
function: neet do be like this:
Code:
function() print('hail') end
Code:
{kind=4,chance=10,function() --- kind(function), chance 10%, function
local pos = {x=110,y=110,z=7,stackpos=255}
local a = getThingfromPos(pos)
if isPlayer(a.uid) == TRUE then
doTeleportThing(a.uid, {x=100,y=100,z=7})
end
end},
Have fun ^^
Last edited: