TalkAction [Fun Script] Dance!!!

bomba

Member
Joined
Feb 26, 2008
Messages
635
Best answers
0
Reaction score
6
Location
Brazil
Idea: If start dance: may not move.

Code:
if string.lower(param) == "start" and not(events[pid].dancer) then
 mayNotMove(cid, 1)
  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
        mayNotMove(cid, 0)
       stopEvent(events[pid].dancer)
      stopEvent(events[pid].messager)
     stopEvent(events[pid].outfitChanger)
    events[pid] = {}
   doCreatureChangeOutfit(cid, backOutfit[pid])
  end
 return TRUE
end
Azi, if you like, add to first post...
*Sorry bad english.
 

Pewo

Intermediate OT User
Joined
Jul 30, 2009
Messages
1,607
Best answers
0
Reaction score
100
hahah very fun lol
 

uchiha1sasukee

Chillin Boss
Joined
May 18, 2009
Messages
1,522
Best answers
0
Reaction score
128
Location
North LA, Van Nuys
i got an error
[14/02/2010 06:43:51] Loading reputation.xml...[Error - ScriptingManager::loadFromXml] Cannot load mod mods/reputation.xml
[14/02/2010 06:43:51] Line: 2, Info: Extra content at the end of the document

can you tell me now what is the fully right script dance the right one without bugs?

[14/02/2010 06:43:51] failed!
 

Maniucza

~Lua~ Noob
Joined
Aug 2, 2009
Messages
86
Best answers
0
Reaction score
6
Location
Poland / Rzeszów
Fixed, work under TFS 0.3.6

PHP:
local cfg = {
	   effects = {1,33},
	   effectSpeed = 2000,  
	   danceTexts = {"GO GO DANCE!", "DANCE NOW!", "DANCE IS FUNY!"},
	   textSpeed = 1500, -- how fast animated texts is sending?
	   danceSpeed = 100, -- dance speed
	   utfitSpeed = 250, -- outfit changer speed
	   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
	   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
}



function effectSender(tab)
    local effect = math.random(cfg.effects[1], cfg.effects[2]}
    doSendMagicEffect(getCreaturePosition(tab[1]), effect)    
    tab[2].effectSender = addEvent(effectSender, cfg.effectSpeed, {tab[1], tab[2]})
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, cfg.danceSpeed, {tab[1], tab[2]})
    end
end

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

function outfitChanger(tab)
    if isPlayer(tab[1]) then
        if getPlayerSex(tab[1]) == PLAYERSEX_FEMALE then
            outs = cfg.outfitFemale
        else
            outs = cfg.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, cfg.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
		mayNotMove(cid, 1)
		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
        mayNotMove(cid, 0)
		stopEvent(events[pid].effectSender)
		stopEvent(events[pid].dancer)
		stopEvent(events[pid].messager)
		stopEvent(events[pid].outfitChanger)
		events[pid] = {}
		doCreatureChangeOutfit(cid, backOutfit[pid])
	end
	return true
end
 

Linryt

Conclusionot.sytes.net
Joined
Nov 29, 2008
Messages
73
Best answers
0
Reaction score
0
what do u do if u dont have a lib/data file lol
 

Slipanark

* Junior Scripter *
Joined
Nov 22, 2008
Messages
3
Best answers
0
Reaction score
0
Thank you for sharing, but it doesn't work on TFS 0.3.6 cryingdamson6pl1..

When the player writes "!dance start" it appears the following bug..

PHP:
data/talkactions/scripts/dancing.lua:onSay
Description:
data/talkactions/scripts/dancing.lua:61 attempt to index global `events` <a nil value>
Stck traceback:
data/talkactions/scripts/dancing.lua:61 in function <data/talkactions/scripts/dancing.lua:57>
Fixed, work under TFS 0.3.6

PHP:
local cfg = {
	   effects = {1,33},
	   effectSpeed = 2000,  
	   danceTexts = {"GO GO DANCE!", "DANCE NOW!", "DANCE IS FUNY!"},
	   textSpeed = 1500, -- how fast animated texts is sending?
	   danceSpeed = 100, -- dance speed
	   utfitSpeed = 250, -- outfit changer speed
	   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
	   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
}



function effectSender(tab)
    local effect = math.random(cfg.effects[1], cfg.effects[2]}
    doSendMagicEffect(getCreaturePosition(tab[1]), effect)    
    tab[2].effectSender = addEvent(effectSender, cfg.effectSpeed, {tab[1], tab[2]})
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, cfg.danceSpeed, {tab[1], tab[2]})
    end
end

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

function outfitChanger(tab)
    if isPlayer(tab[1]) then
        if getPlayerSex(tab[1]) == PLAYERSEX_FEMALE then
            outs = cfg.outfitFemale
        else
            outs = cfg.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, cfg.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
		mayNotMove(cid, 1)
		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
        mayNotMove(cid, 0)
		stopEvent(events[pid].effectSender)
		stopEvent(events[pid].dancer)
		stopEvent(events[pid].messager)
		stopEvent(events[pid].outfitChanger)
		events[pid] = {}
		doCreatureChangeOutfit(cid, backOutfit[pid])
	end
	return true
end
Maniucza I tried your solution but it didn't work.
 

dowx

New Member
Joined
Apr 15, 2011
Messages
1
Best answers
0
Reaction score
0
thanks im using it ist realy work thx REP++
 

cykor119

New Member
Joined
Aug 8, 2010
Messages
149
Best answers
0
Reaction score
3
Can you change the script, because I have installed on the server addon bonus, and person when many costume changes on the server get bonus hp, MLV, mana, and by my server is lagging
 

3mR

Mapper
Joined
May 29, 2012
Messages
322
Best answers
0
Reaction score
39
When I write !dance Nothing Doing !
 
Top