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

GlobalEvent Talking TPs/sings (v 3.0!) By mock.

Mock

Mock the bear (MTB)
Joined
Jul 29, 2008
Messages
619
Reaction score
106
Location
Brazil
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
<Sorry bad english xP>

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:
mff.png

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"/>
You can change the interval :p
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
I will teach how to configure in end of the thread.
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},
2 its an constante, if you change kind to othern umber will take some error ^^
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},
3 its an constante, if you change kind to othern umber will take some error ^^
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},
4 its an constante, if you change kind to othern umber will take some error ^^
Chance is 1-100
function: neet do be like this:
Code:
function() print('hail') end
or:
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:
i get this error when i startup the server
bugsz.png

i did everything you said:(
 
I'm wondering, with the 0.2 versikon of your script. Does it auto start when i start the server, or do I have to enter and write !show ?
 
Só eu não entendi a configuração? Que droga :S
Explicação em português ae mOck :/
 
Cool o_O


Can you explain more what I shall edit and what I should not? Cuz this confuse me a bit :S
There are different pos and like that.. dunno what to edit XD

(I DONT GET THIS PART:)
But what is this: (red marked)

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
                     [B][COLOR="Red"]local pos = {x=110,y=110,z=7,stackpos=255}[/COLOR][/B]
                     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
 
Back
Top