Diga no mínimo 1 caractere que você modificou...
- Fórum
- OTServ
- Recursos
- Scripting
- Actions e Talkactions
- [action] System De Futebol (scripts + Mapas)
IV
action
[action] System De Futebol (scripts + Mapas)
Por Ivomec, 23 de set. de 2009 em Actions e Talkactions
otserv
script
4
3.2k
info
Grupo: Barão
Registrado: 01/07/09
Posts: 216
Reputação: +4

25 de setembro de 2009 às 23:45
info
Grupo: Artesão
Registrado: 19/10/05
Posts: 145
Reputação: +20
Char no Tibia: Zigfried Werewolf

01 de outubro de 2009 às 18:11
tradução da google sapsplsapsapsaplsapl



info
Grupo: Campones
Registrado: 23/09/09
Posts: 10
Reputação: 0
Char no Tibia: -
Futebol System .( nao sei se ja existe )
(uso Ações, Movimentos, GlobalEvents, testado em 0.3.4pl2 TFS)
Informations: Informações:
- movie (speed x2): - Filme Speed (x2):
- 3 mapas de futebol de campo [2 mapas para 2 vs 2, 1 para 3 v 3 jogos] AIDS (xxx, ~ 40 uids: P)
- Mesma velocidade (configurável) para todos os jogadores (utani hur / gran hur, time ring, botas de trabalho não velocidade, nível de velocidade de mudança doesnt)
- A bola e os jogadores mover auto teleport (jogadores teleport configurable) para iniciar posições depois do gol
- Auto remover itens (que depois do futebol) de campo de futebol
- Os jogadores do auto kick de campo de futebol, após X minutos (configurável) [/b
- Média de transmissão
- Enviar mensagens de jogador
- Auto mudar cores equipamento de membros da equipe (todos os membros têm a cor como o primeiro jogador de sua equipe [próximo switch])
SCRIPT
1. 1. Map link (copy 1 - 3 football fields to your map, dont modify UID/AIDs) Mapa (link cópia 1 - 3 campos de futebol para o mapa, não alterar UID / SIDA)
Download Aqui!
2. em dados / lib / data.lua no final do arquivo cole:
3. em dados / lib / criar arquivo football.lua e colar:
-- 1 - exit pos , 2 - team 1 ball, 3 - team 2 ball, 4 - team1frompos, 5 -team2frompos, 6 - team1topos, 7 - team2topos, 8-team1gate aid, 9 - team2game aid, 10 - speed, 11 - match time, 12 - highest uid + 1, 13 - field size
football_positions_uids = {}
football_positions_uids[1] = {23301,23302,23303, {23304,23305,23306}, {23307,23308,23309}, {23310,23311,23312}, {23313,23314,23315}, 23311, 23312, 450, 3, 23315, {8,3}}
football_positions_uids[2] = {23320,23321,23322, {23323,23324}, {23325,23326}, {23327,23328}, {23329,23330}, 23321, 23322, 450, 3, 23330, {6,2}}
football_positions_uids[3] = {23340,23341,23342, {23343,23344}, {23345,23346}, {23347,23348}, {23349,23350}, 23341, 23342, 450, 3, 23350, {6,2}}
teleport_players_on_goal = true
function footballGoal(pos, ball, team1pos, team2pos, goalStorage, ballpos) -- add goal to team 1/2 score, show "GOAL", animations, teleport ball and players
setGlobalStorageValue(goalStorage, getGlobalStorageValue(goalStorage)+1)
if(teleport_players_on_goal) then
for i = 1 , #team1pos do
doTeleportThing(getGlobalStorageValue(team1pos), getThingPos(team1pos), TRUE)
end
for i = 1 , #team2pos do
doTeleportThing(getGlobalStorageValue(team2pos), getThingPos(team2pos), TRUE)
end
end
doSendMagicEffect(pos, CONST_ME_BATS)
doTeleportThing(ball.uid, ballpos, TRUE)
doSendMagicEffect(ballpos, CONST_ME_MAGIC_GREEN)
doSendAnimatedText(ballpos, "GOAL!", TEXTCOLOR_TEAL)
end
function footballGetBall(startFromPos, fieldSize) -- get ball uid or create new and return uid, remove all balls from football field (if any exist)
ball = 0
for ix = startFromPos.x - fieldSize[1], startFromPos.x + fieldSize[1] do
for iy = startFromPos.y - fieldSize[2], startFromPos.y + fieldSize[2] do
tmpBall = getTileItemById({x=ix, y=iy, z=startFromPos.z}, 2109)
if(tmpBall.uid > 0) then
if(ball == 0) then
ball = tmpBall.uid
else
doRemoveItem(tmpBall.uid)
end
end
end
end
if(ball == 0) then
return doCreateItem(2109, 1, startFromPos)
else
return ball
end
end
4. em data \ actions \ scripts \ football.lua criar o arquivo e colar:
function onUse(cid, item, frompos, item2, topos)
if(item.itemid == 1945 or item.itemid == 1946) then
match = football_positions_uids[item.actionid-23300]
if(getGlobalStorageValue(match[1]) < 1) then
fromPoss = {match[4], match[5]}
toPoss = {match[6], match[7]}
players_number = 0
for i = 1, 2 do
teamPoss = fromPoss
for p = 1, #teamPoss do
if(isPlayer(getTopCreature(getThingPos(teamPoss[p])).uid) == TRUE) then
players_number = players_number + 1
end
end
end
if(players_number ~= #fromPoss[1] + #fromPoss[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, #fromPoss[1] + #fromPoss[2] .. " players needed. Only " .. players_number .. " on start positions.")
return false
end
setGlobalStorageValue(match[1], os.time() + match[11] * 60)
ballPos = getThingPos(match[2])
doTeleportThing(footballGetBall(getThingPos(match[2]), match[13]), ballPos, TRUE)
addEvent(doSendAnimatedText, 4000, ballPos, "0!", TEXTCOLOR_TEAL)
addEvent(doSendAnimatedText, 3000, ballPos, "1", TEXTCOLOR_TEAL)
addEvent(doSendAnimatedText, 2000, ballPos, "2", TEXTCOLOR_TEAL)
addEvent(doSendAnimatedText, 1000, ballPos, "3", TEXTCOLOR_TEAL)
teamOutfit = {}
for i = 1, 2 do
teamFromPoss = fromPoss
teamToPoss = toPoss
teamOutfit = getCreatureOutfit(getTopCreature(getThingPos(teamFromPoss[1])).uid)
for p = 1, #teamFromPoss do
player = getTopCreature(getThingPos(teamFromPoss[p])).uid
setGlobalStorageValue(teamToPoss[p], player)
doCreatureSetNoMove(player, 1)
addEvent(doCreatureSetNoMove, 4000, player, 0)
outfit = getCreatureOutfit(player)
outfit.lookHead = teamOutfit.lookHead
outfit.lookBody = teamOutfit.lookBody
outfit.lookLegs = teamOutfit.lookLegs
outfit.lookFeet = teamOutfit.lookFeet
doSetCreatureOutfit(player, outfit, match[11] * 60 * 1000 + 2500)
doTeleportThing(player, getThingPos(teamToPoss[p]), TRUE)
doPlayerSendTextMessage(player, MESSAGE_STATUS_CONSOLE_ORANGE, "Match start. You are in Team " .. i .. " on field " .. item.actionid-23300 .. ". You have " .. match[11] .. " minutes.")
end
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Football field in use. Please wait.")
return false
end
return true
end
return false
end
5. em data \ actions \ actions.xml acrescentar:
6. em data \ movimentos \ scripts \ football.lua criar o arquivo e colar:
7. em data \ movimentos \ movements.xml acrescentar:
8. em data \ GlobalEvents \ scripts \ football.lua criar o arquivo e colar:
[b]function onThink(interval, lastExecution) for m = 1 , #football_positions_uids do match = football_positions_uids[m] if(getGlobalStorageValue(match[1]) == -1) then for t = match[1], match[12] do setGlobalStorageValue(t, 0) end end end_time = getGlobalStorageValue(match[1]) if(end_time > 0 and end_time < os.time()) then toPoss = {match[6], match[7]} team_players = {"", ""} for i = 1, 2 do teamPoss = toPoss[i] for p = 1, #teamPoss do team_players[i] = team_players[i] .. getCreatureName(getGlobalStorageValue(teamPoss[p])) if p ~= #teamPoss then team_players[i] = team_players[i] .. ", " end end end score = "Team 1 (" .. team_players[1] .. ") - " .. getGlobalStorageValue(match[2]) .. " : " .. getGlobalStorageValue(match[3]) .. " - (" .. team_players[2] .. ") Team 2" doBroadcastMessage("Football field " .. m .. ". " .. score, MESSAGE_STATUS_CONSOLE_BLUE) for i = 1, 2 do teamPoss = toPoss[i] exitPos = getThingPos(match[1]) for p = 1, #teamPoss do doTeleportThing(getGlobalStorageValue(teamPoss[p]), exitPos, TRUE) doPlayerSendTextMessage(getGlobalStorageValue(teamPoss[p]), MESSAGE_STATUS_CONSOLE_ORANGE, "You were in Team " .. i .. " on field " .. m .. ". " .. score) end end for i = match[1], match[12] do setGlobalStorageValue(i, 0) end end end return true end[/b]9. em data \ GlobalEvents \ globalevents.xml acrescentar:
<globalevent name="football" interval="5" event="script" value="football.lua">
Creditos : Gesior.pl (otland) e para mim, modifiquei algumas coisas.
Editado Abril 13 por Roksas