TalkAction [Fun Script] Dance!!!

Azi

Banned User
Joined
Aug 12, 2007
Messages
1,167
Best answers
0
Reaction score
51
Location
Włocławek
Hello, today I show my script to dance in our servers ...
I did it for fun, because its its goining to fun...
I will not describe it, because I will give very short video on youtube, which will see what is going on ...
If you like my script - you can give me a rep point.
Video: YouTube - Funny dance script for open tibia servers [by ersiu]

Commands:
!dance start - for start the dancing
!dance stop - for stop the dancing

Config in script...


data/talkactions/talkactions.xml
under:
PHP:
<talkactions>
add:

FOR TFS 0.3.3 OR HIGHER
PHP:
<talkaction log="no" access="0" words="!dance" event="script" value="dancing.lua"/>
FOR TFS 0.3.2 OR LOWER
PHP:
<talkaction log="no" access="0" words="!dance" script="dancing.lua"/>
in data/lib/data.lua add:
PHP:
events = {}

and make new file in data/talkactions/scripts/ name it: dancing.lua and past here this code

PHP:
local conf = {}
-- // config // ---
    conf.danceTexts = {"GO GO DANCE!", "DANCE NOW!", "DANCE IS FUNY!"}
    conf.textSpeed = 1500 -- how fast animated texts is sending?
    conf.danceSpeed = 100 -- dance speed
    conf.outfitSpeed = 250 -- outfit changer speed
    conf.outfitMale = {128, 129, 130, 131, 132, 133, 134, 143, 144, 145, 146, 151, 152, 153, 154, 251, 268, 273, 278, 289, 325} -- all male outfits
    conf.outfitFemale = {136, 137, 138, 139, 140, 141, 142, 147, 148, 149, 150, 155, 156, 157, 158, 252, 269, 270, 279, 288, 324} -- all female outfits
-- // end // --



function dancer(tab)
	if isPlayer(tab[1]) then
		local dirs = {[0] = {1,3},[1] = {0,2},[2] = {1,3},[3] = {0,2}}
		local look = dirs[getCreatureLookDirection(tab[1])]
		doCreatureSetLookDir(tab[1], look[math.random(1,2)])
		tab[2].dancer = addEvent(dancer,conf.danceSpeed, {tab[1], tab[2]})
	end
end

function messager(tab)
	if isPlayer(tab[1]) then
		doCreatureSay(tab[1], conf.danceTexts[math.random(1, #conf.danceTexts)], TALKTYPE_ORANGE_2)
		tab[2].messager = addEvent(messager,conf.textSpeed, tab)
	end
end

function outfitChanger(tab)
	if isPlayer(tab[1]) then
		if getPlayerSex(tab[1]) == PLAYERSEX_FEMALE then
			outs = conf.outfitFemale
		else
			outs = conf.outfitMale
		end
		local outfit = {
		lookType = outs[math.random(1, #outs)],
		lookHead = math.random(1,133),
		lookBody = math.random(1,133),
		lookLegs = math.random(1,133),
		lookFeet = math.random(1,133),
		lookTypeEx = math.random(1,133),
		lookAddons = math.random(0,3)}
		doCreatureChangeOutfit(tab[1], outfit)
		tab[2].outfitChanger = addEvent(outfitChanger,conf.outfitSpeed, tab)
	end
end
backOutfit = {}
local backOutfit = {}
function onSay(cid, words, param, channel)

    local pid = getPlayerGUID(cid)
    
    if type(events[pid]) ~= "table" then
        events[pid] = {}
    end
    
    if string.lower(param) == "start" and not(events[pid].dancer) then
        outBack = getCreatureOutfit(cid)
        backOutfit[pid] = outBack
        backOutfit[pid].lookType = outBack.lookType
        backOutfit[pid].lookAddons = outBack.lookAddons
        dancer({cid, events[pid]})
        messager({cid, events[pid]})
        outfitChanger({cid, events[pid]})
    elseif string.lower(param) == "stop" and events[pid].dancer then
        stopEvent(events[pid].dancer)
        stopEvent(events[pid].messager)
        stopEvent(events[pid].outfitChanger)
        events[pid] = {}
        doCreatureChangeOutfit(cid, backOutfit[pid])
    end
    return TRUE
end
 
Last edited:

Zerak456

Gorlex.net NEW!
Joined
Aug 13, 2008
Messages
1,060
Best answers
0
Reaction score
6
Location
Germany
when i type the command it says: this command require param!




EDIT: ops it was for i didnt said !dance start/!dance stop

i said only !dance


REP++
 

Zerak456

Gorlex.net NEW!
Joined
Aug 13, 2008
Messages
1,060
Best answers
0
Reaction score
6
Location
Germany
BUGGED:

u can type it 100 times then ur server gets lagg and when u type it many times and then stop u dont got ur normally outfit u got that it stops with.

So its good if you make so u can type it one time at time.
 
OP
Azi

Azi

Banned User
Joined
Aug 12, 2007
Messages
1,167
Best answers
0
Reaction score
51
Location
Włocławek
#up
wait a second for fix.


#edit
fixed, thanks for report, rep++ : )
now no laggs by using command! :D
 
Last edited:

Zerak456

Gorlex.net NEW!
Joined
Aug 13, 2008
Messages
1,060
Best answers
0
Reaction score
6
Location
Germany
thanks for reputation
thanks for the fixed :)

np for the raport
 

demon el maton

New Member
Joined
Jan 6, 2009
Messages
23
Best answers
0
Reaction score
0
:(

Code:
[20/06/2009 17:05:48] Lua Script Error: [TalkAction Interface] 
[20/06/2009 17:05:48] data/talkactions/scripts/dancing.lua:onSay

[20/06/2009 17:05:48] data/talkactions/scripts/dancing.lua:15: attempt to call global 'getCreatureLookDirection' (a nil value)
[20/06/2009 17:05:48] stack traceback:
[20/06/2009 17:05:48] 	data/talkactions/scripts/dancing.lua:15: in function 'dancer'
[20/06/2009 17:05:48] 	data/talkactions/scripts/dancing.lua:48: in function <data/talkactions/scripts/dancing.lua:39>
 
OP
Azi

Azi

Banned User
Joined
Aug 12, 2007
Messages
1,167
Best answers
0
Reaction score
51
Location
Włocławek
#up
you don't have function getCreatureLookDirection, im tested it on newest tfs, if you have old version, it's can not works good.
 
OP
Azi

Azi

Banned User
Joined
Aug 12, 2007
Messages
1,167
Best answers
0
Reaction score
51
Location
Włocławek
im testing it with 20 players using it on same time and no lags (50 ppls online).
 

Saj

Remember my name
Joined
Feb 26, 2008
Messages
2,127
Best answers
0
Reaction score
5
Great script, good job!
 

Teddy

SweStream.se
Joined
Oct 2, 2008
Messages
3,798
Best answers
0
Reaction score
10
Location
Sweden 172
wtf .. only 1 palyer can use it not 2 at the same time ?.. :S
 
OP
Azi

Azi

Banned User
Joined
Aug 12, 2007
Messages
1,167
Best answers
0
Reaction score
51
Location
Włocławek
lol?
wait one sec. i fix it! :D

#edit
now should work good! :D
 
Last edited:
Top