Ir para conteúdo
  • 0

[Ajuda] Sistema De Natação [Ajuda]


Flaah

Pergunta

Boa Tarde amigos do XTIBIA, to com um grande problema no sistema de natação que eu peguei que seria:

 

Quando o player saisse da água, ele voltasse com uma outifit que eu escolhesse, isso seria para cada vocation que tenho no meu server.

 

Eu fiz isso, mais so que player ao nadar ele n fica com a outifit de natação e ele não volta a terra, da um block no char.. :(

 

SCRIPT::

 

local outfit = {lookType = 267, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}

outfits = {
			[1] = {lookType = 168}, -- o numero 9 é o ID da vocação e 69 é o ID do looktype.
			[2] = {lookType = 161},
			[3] = {lookType = 173},
			[4] = {lookType = 176},
			[5] = {lookType = 180},
			[6] = {lookType = 182},
			[7] = {lookType = 184},
			[8] = {lookType = 187},
			[9] = {lookType = 10},
			[10] = {lookType = 189},
			[11] = {lookType = 2},
			[12] = {lookType = 77},
			[13] = {lookType = 0},
			[14] = {lookType = 0},
			[15] = {lookType = 19},
			[16] = {lookType = 19},
			[29] = {lookType = 24},
			[30] = {lookType = 10},
			[31] = {lookType = 44},
			[32] = {lookType = 53},
			[33] = {lookType = 57},
			[34] = {lookType = 61},
			[35] = {lookType = 63},
			[36] = {lookType = 69},
			[37] = {lookType = 73},
			[38] = {lookType = 20},
			[39] = {lookType = 40},
			[40] = {lookType = 80},
			[41] = {lookType = 60},
			[42] = {lookType = 30},
			[43] = {lookType = 30}


}

local BORDERS = {
[7943] = {x = 0, y = -2, back = SOUTH},
[7944] = {x = -2, y = 0, back = EAST},
[7945] = {x = 0, y = 2, back = NORTH},
[7946] = {x = 2, y = 0, back = WEST},
[7947] = {x = 2, y = 1, back = WEST},
[7948] = {x = -2, y = 1, back = NORTH},
[7949] = {x = 2, y = -1, back = WEST},
[7950] = {x = -2, y = -1, back = EAST},
[7951] = {x = 2, y = 2, back = WEST},
[7952] = {x = -2, y = 2, back = NORTH},
[7953] = {x = 2, y = -2, back = WEST},
[7954] = {x = -2, y = -2, back = SOUTH}
}

BORDERS[4828] = BORDERS[7943]
BORDERS[4829] = BORDERS[7946]
BORDERS[4830] = BORDERS[7945]
BORDERS[4831] = BORDERS[7944]

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if(not isPlayer(cid)) then
	return true
end

local border = BORDERS[item.itemid]
if(not border) then
	return false
end

local pos, newPos = getCreaturePosition(cid), {}
newPos = pos
newPos.x = pos.x + border.x
newPos.y = pos.y + border.y

if(hasCondition(cid, CONDITION_OUTFIT) and getCreatureOutfit(cid).lookType == outfit.lookType) then
	doMoveCreature(cid, border.back)
	doRemoveCondition(cid, CONDITION_OUTFIT)
else
	if(doTileQueryAdd(cid, pos, 4) ~= RETURNVALUE_NOERROR) then
		return false
	end

	local tmp = getCreaturePosition(cid)
	doTeleportThing(cid, newPos)

	if(not isPlayerGhost(cid)) then
		doSendMagicEffect(tmp, CONST_ME_POFF)
		doSendMagicEffect(newPos, CONST_ME_WATERSPLASH)
	end

	doRemoveConditions(cid, true)
			local voc_id = getPlayerVocation(cid)
			if getPlayerVocation(cid) > 0 then
							doSetCreatureOutfit(cid, outfits[voc_id], -1)
end

return true
end
end

 

ALGUEM PODERIA ME AJUDAR? :(

 

VALENDO +REP

Editado por Flaah
Link para o comentário
Compartilhar em outros sites

Posts Recomendados

  • 0

Pior que não da ERRO no console, o problema mesmo é q o player não fica com a outifit quando nadar, e não consegue sair da água, :(

 

ALGUEM PODERIA ME AJUDAR?? :(

 

VALENDO +REP

Editado por Flaah
Link para o comentário
Compartilhar em outros sites

  • 0
local outfit = {lookType = 267, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
outfits = {
					    [1] = {lookType = 168}, -- o numero 9 é o ID da vocação e 69 é o ID do looktype.
					    [2] = {lookType = 161},
					    [3] = {lookType = 173},
					    [4] = {lookType = 176},
					    [5] = {lookType = 180},
					    [6] = {lookType = 182},
					    [7] = {lookType = 184},
					    [8] = {lookType = 187},
					    [9] = {lookType = 10},
					    [10] = {lookType = 189},
					    [11] = {lookType = 2},
					    [12] = {lookType = 77},
					    [13] = {lookType = 0},
					    [14] = {lookType = 0},
					    [15] = {lookType = 19},
					    [16] = {lookType = 19},
					    [29] = {lookType = 24},
					    [30] = {lookType = 10},
					    [31] = {lookType = 44},
					    [32] = {lookType = 53},
					    [33] = {lookType = 57},
					    [34] = {lookType = 61},
					    [35] = {lookType = 63},
					    [36] = {lookType = 69},
					    [37] = {lookType = 73},
					    [38] = {lookType = 20},
					    [39] = {lookType = 40},
					    [40] = {lookType = 80},
					    [41] = {lookType = 60},
					    [42] = {lookType = 30},
					    [43] = {lookType = 30}

}
local BORDERS = {
   [7943] = {x = 0, y = -2, back = SOUTH},
   [7944] = {x = -2, y = 0, back = EAST},
   [7945] = {x = 0, y = 2, back = NORTH},
   [7946] = {x = 2, y = 0, back = WEST},
   [7947] = {x = 2, y = 1, back = WEST},
   [7948] = {x = -2, y = 1, back = NORTH},
   [7949] = {x = 2, y = -1, back = WEST},
   [7950] = {x = -2, y = -1, back = EAST},
   [7951] = {x = 2, y = 2, back = WEST},
   [7952] = {x = -2, y = 2, back = NORTH},
   [7953] = {x = 2, y = -2, back = WEST},
   [7954] = {x = -2, y = -2, back = SOUTH}
}
BORDERS[4828] = BORDERS[7943]
BORDERS[4829] = BORDERS[7946]
BORDERS[4830] = BORDERS[7945]
BORDERS[4831] = BORDERS[7944]
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
   if(not isPlayer(cid)) then
    return true
   end
   local border = BORDERS[item.itemid]
   if(not border) then
    return false
   end
   local pos, newPos = getCreaturePosition(cid), {}
   newPos = pos
   newPos.x = pos.x + border.x
   newPos.y = pos.y + border.y
   if(hasCondition(cid, CONDITION_OUTFIT) and getCreatureOutfit(cid).lookType == outfit.lookType) then
    doMoveCreature(cid, border.back)
    doRemoveCondition(cid, CONDITION_OUTFIT)
 local voc_id = getPlayerVocation(cid)
 if outfits[voc_id] then
  outfit.lookType = outfits[voc_id].lookType
  doSetCreatureOutfit(cid, outfit, -1)
 end
   else
    if(doTileQueryAdd(cid, pos, 4) ~= RETURNVALUE_NOERROR) then
	    return false
    end
    doTeleportThing(cid, newPos)
    if(not isPlayerGhost(cid)) then
	    doSendMagicEffect(tmp, CONST_ME_POFF)
	    doSendMagicEffect(newPos, CONST_ME_WATERSPLASH)
    end
    doRemoveConditions(cid, true)
 doSetCreatureOutfit(cid, outfit, -1)
end
return true
end

Link para o comentário
Compartilhar em outros sites

  • 0

Cara deu o seguinte erro, quando tento sair do mar:

 

 

[18/07/2012 18:43:53] [Error - MoveEvents Interface]

[18/07/2012 18:43:53] data/movements/scripts/swimming.lua:onStepIn

[18/07/2012 18:43:53] Description:

[18/07/2012 18:43:53] attempt to index a nil value

[18/07/2012 18:43:53] stack traceback:

[18/07/2012 18:43:53] [C]: in function 'doSendMagicEffect'

[18/07/2012 18:43:53] data/movements/scripts/swimming.lua:80: in function <data/movements/scripts/swimming.lua:54>

 

ALGUEM PODERIA ME AJUDAR? :(

 

VALENDO +REP

Link para o comentário
Compartilhar em outros sites

  • 0
local outfit = {lookType = 267, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
outfits = {
					    [1] = {lookType = 168}, -- o numero 9 é o ID da vocação e 69 é o ID do looktype.
					    [2] = {lookType = 161},
					    [3] = {lookType = 173},
					    [4] = {lookType = 176},
					    [5] = {lookType = 180},
					    [6] = {lookType = 182},
					    [7] = {lookType = 184},
					    [8] = {lookType = 187},
					    [9] = {lookType = 10},
					    [10] = {lookType = 189},
					    [11] = {lookType = 2},
					    [12] = {lookType = 77},
					    [13] = {lookType = 0},
					    [14] = {lookType = 0},
					    [15] = {lookType = 19},
					    [16] = {lookType = 19},
					    [29] = {lookType = 24},
					    [30] = {lookType = 10},
					    [31] = {lookType = 44},
					    [32] = {lookType = 53},
					    [33] = {lookType = 57},
					    [34] = {lookType = 61},
					    [35] = {lookType = 63},
					    [36] = {lookType = 69},
					    [37] = {lookType = 73},
					    [38] = {lookType = 20},
					    [39] = {lookType = 40},
					    [40] = {lookType = 80},
					    [41] = {lookType = 60},
					    [42] = {lookType = 30},
					    [43] = {lookType = 30}

}
local BORDERS = {
   [7943] = {x = 0, y = -2, back = SOUTH},
   [7944] = {x = -2, y = 0, back = EAST},
   [7945] = {x = 0, y = 2, back = NORTH},
   [7946] = {x = 2, y = 0, back = WEST},
   [7947] = {x = 2, y = 1, back = WEST},
   [7948] = {x = -2, y = 1, back = NORTH},
   [7949] = {x = 2, y = -1, back = WEST},
   [7950] = {x = -2, y = -1, back = EAST},
   [7951] = {x = 2, y = 2, back = WEST},
   [7952] = {x = -2, y = 2, back = NORTH},
   [7953] = {x = 2, y = -2, back = WEST},
   [7954] = {x = -2, y = -2, back = SOUTH}
}
BORDERS[4828] = BORDERS[7943]
BORDERS[4829] = BORDERS[7946]
BORDERS[4830] = BORDERS[7945]
BORDERS[4831] = BORDERS[7944]
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
   if(not isPlayer(cid)) then
    return true
   end
   local border = BORDERS[item.itemid]
   if(not border) then
    return false
   end
   local pos, newPos = getCreaturePosition(cid), {}
   newPos = pos
   newPos.x = pos.x + border.x
   newPos.y = pos.y + border.y
   if(hasCondition(cid, CONDITION_OUTFIT) and getCreatureOutfit(cid).lookType == outfit.lookType) then
    doMoveCreature(cid, border.back)
    doRemoveCondition(cid, CONDITION_OUTFIT)
 local voc_id = getPlayerVocation(cid)
 if outfits[voc_id] then
  outfit.lookType = outfits[voc_id].lookType
  doSetCreatureOutfit(cid, outfit, -1)
 end
   else
    if(doTileQueryAdd(cid, pos, 4) ~= RETURNVALUE_NOERROR) then
	    return false
    end
 tmp = getCreaturePosition(cid)
    doTeleportThing(cid, newPos)
    if(not isPlayerGhost(cid)) then
	    doSendMagicEffect(tmp, CONST_ME_POFF)
	    doSendMagicEffect(newPos, CONST_ME_WATERSPLASH)
    end
    doRemoveConditions(cid, true)
 doSetCreatureOutfit(cid, outfit, -1)
end
return true
end

Link para o comentário
Compartilhar em outros sites

  • 0

Agora esta com o seguinte ERRO:

 

Ele não nada mais :(

 

PS: Que tile é esse? o.O

 

ALGUEM PODERIA ME AJUDAR? :(

 

VALENDO +REP

Editado por Flaah
Link para o comentário
Compartilhar em outros sites

  • 0

O Tile do RME. Nao transforma em outif Nero. preste mais atencao.


local outfit = {lookType = 267, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
outfits = {
                                                   [1] = {lookType = 168}, -- o numero 9 é o ID da vocação e 69 é o ID do looktype.
                                                   [2] = {lookType = 161},
                                                   [3] = {lookType = 173},
                                                   [4] = {lookType = 176},
                                                   [5] = {lookType = 180},
                                                   [6] = {lookType = 182},
                                                   [7] = {lookType = 184},
                                                   [8] = {lookType = 187},
                                                   [9] = {lookType = 10},
                                                   [10] = {lookType = 189},
                                                   [11] = {lookType = 2},
                                                   [12] = {lookType = 77},
                                                   [13] = {lookType = 0},
                                                   [14] = {lookType = 0},
                                                   [15] = {lookType = 19},
                                                   [16] = {lookType = 19},
                                                   [29] = {lookType = 24},
                                                   [30] = {lookType = 10},
                                                   [31] = {lookType = 44},
                                                   [32] = {lookType = 53},
                                                   [33] = {lookType = 57},
                                                   [34] = {lookType = 61},
                                                   [35] = {lookType = 63},
                                                   [36] = {lookType = 69},
                                                   [37] = {lookType = 73},
                                                   [38] = {lookType = 20},
                                                   [39] = {lookType = 40},
                                                   [40] = {lookType = 80},
                                                   [41] = {lookType = 60},
                                                   [42] = {lookType = 30},
                                                   [43] = {lookType = 30}

}
local BORDERS = {
   [7943] = {x = 0, y = -2, back = SOUTH},
   [7944] = {x = -2, y = 0, back = EAST},
   [7945] = {x = 0, y = 2, back = NORTH},
   [7946] = {x = 2, y = 0, back = WEST},
   [7947] = {x = 2, y = 1, back = WEST},
   [7948] = {x = -2, y = 1, back = NORTH},
   [7949] = {x = 2, y = -1, back = WEST},
   [7950] = {x = -2, y = -1, back = EAST},
   [7951] = {x = 2, y = 2, back = WEST},
   [7952] = {x = -2, y = 2, back = NORTH},
   [7953] = {x = 2, y = -2, back = WEST},
   [7954] = {x = -2, y = -2, back = SOUTH}
}
BORDERS[4828] = BORDERS[7943]
BORDERS[4829] = BORDERS[7946]
BORDERS[4830] = BORDERS[7945]
BORDERS[4831] = BORDERS[7944]
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
   if(not isPlayer(cid)) then
           return true
   end
   local border = BORDERS[item.itemid]
   if(not border) then
           return false
   end
   local pos, newPos = getCreaturePosition(cid), {}
   newPos = pos
   newPos.x = pos.x + border.x
   newPos.y = pos.y + border.y
   if(hasCondition(cid, CONDITION_OUTFIT) and getCreatureOutfit(cid).lookType == outfit.lookType) then
           doMoveCreature(cid, border.bs ack)
           doRemoveCondition(cid, CONDITION_OUTFIT)
 local voc_id = getPlayerVocation(cid)
 if outfits[voc_id] then
  outfit.lookType = outfits[voc_id].lookType
  doSetCreatureOutfit(cid, outfit, -1)
 end
   else
           if(doTileQueryAdd(cid, pos, 4) ~= RETURNVALUE_NOERROR) then
                   return false
           end
           doTeleportThing(cid, newPos)
           if(not isPlayerGhost(cid)) then
                   doSendMagicEffect(newPos, CONST_ME_WATERSPLASH)
           end
           doRemoveConditions(cid, true)
 doSetCreatureOutfit(cid, outfit, -1)
end
return true
end

TENTA ASSIM, E ME FALA.

Link para o comentário
Compartilhar em outros sites

  • 0

Cara ta dando esse ERRO:

 

 

[19/07/2012 13:44:59] [Error - LuaScriptInterface::loadFile] data/movements/scripts/swimming.lua:67: ')' expected near 'ack'

[19/07/2012 13:44:59] [Warning - Event::loadScript] Cannot load script (data/movements/scripts/swimming.lua)

[19/07/2012 13:44:59] data/movements/scripts/swimming.lua:67: ')' expected near 'ack'

[19/07/2012 13:44:59] [Error - LuaScriptInterface::loadFile] data/movements/scripts/swimming.lua:67: ')' expected near 'ack'

[19/07/2012 13:44:59] [Warning - Event::loadScript] Cannot load script (data/movements/scripts/swimming.lua)

[19/07/2012 13:44:59] data/movements/scripts/swimming.lua:67: ')' expected near 'ack'

 

@EDIT

 

Cara coloquei a virgula, que estava dando esse erro acima, mais so que agora quando o player vai nadar pela segunda vez, ele da esse ERRO, e o player anda sobre a água, não nada :(

 

[19/07/2012 13:56:02] [Error - MoveEvents Interface]

[19/07/2012 13:56:02] data/movements/scripts/swimming.lua:onStepIn

[19/07/2012 13:56:02] Description:

[19/07/2012 13:56:02] (luaDoMoveCreature) Creature not found

 

ALGUEM PODERIA ME AJUDAR? :(

 

VALENDO +REP

Editado por Flaah
Link para o comentário
Compartilhar em outros sites

  • 0

Tenta assim cara:

 

local outfit = {lookType = 267, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}

 local outfits = {
	   	 [1] = {lookType = 168}, -- o numero 9 é o ID da vocação e 69 é o ID do looktype.
	   	 [2] = {lookType = 161},
	   	 [3] = {lookType = 173},
	   	 [4] = {lookType = 176},
	   	 [5] = {lookType = 180},
	   	 [6] = {lookType = 182},
	   	 [7] = {lookType = 184},
	   	 [8] = {lookType = 187},
	   	 [9] = {lookType = 10},
	   	 [10] = {lookType = 189},
	   	 [11] = {lookType = 2},
	   	 [12] = {lookType = 77},
	   	 [13] = {lookType = 0},
	   	 [14] = {lookType = 0},
	   	 [15] = {lookType = 19},
	   	 [16] = {lookType = 19},
	   	 [29] = {lookType = 24},
	   	 [30] = {lookType = 10},
	   	 [31] = {lookType = 44},
	   	 [32] = {lookType = 53},
	   	 [33] = {lookType = 57},
	   	 [34] = {lookType = 61},
	   	 [35] = {lookType = 63},
	   	 [36] = {lookType = 69},
	   	 [37] = {lookType = 73},
	   	 [38] = {lookType = 20},
	   	 [39] = {lookType = 40},
	   	 [40] = {lookType = 80},
	   	 [41] = {lookType = 60},
	   	 [42] = {lookType = 30},
	   	 [43] = {lookType = 30}


}

local BORDERS = {
	[7943] = {x = 0, y = -2, back = SOUTH},
	[7944] = {x = -2, y = 0, back = EAST},
	[7945] = {x = 0, y = 2, back = NORTH},
	[7946] = {x = 2, y = 0, back = WEST},
	[7947] = {x = 2, y = 1, back = WEST},
	[7948] = {x = -2, y = 1, back = NORTH},
	[7949] = {x = 2, y = -1, back = WEST},
	[7950] = {x = -2, y = -1, back = WEST},
	[7951] = {x = 2, y = 2, back = WEST},
	[7952] = {x = -2, y = 2, back = NORTH},
	[7953] = {x = 2, y = -2, back = WEST},
	[7954] = {x = -2, y = -2, back = SOUTH}
}

BORDERS[4828] = BORDERS[7943]
BORDERS[4829] = BORDERS[7946]
BORDERS[4830] = BORDERS[7945]
BORDERS[4831] = BORDERS[7944]

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if(not isPlayer(cid)) then
			return true
	end

	local border = BORDERS[item.itemid]
	if(not border) then
			return false
	end
	if hasCondition(cid, CONDITION_INFIGHT) then
			return doPlayerSendCancel(cid, "You are in a fight.") and doTeleportThing(cid, fromPosition)
	end

	local pos, newPos = getCreaturePosition(cid), {}
	newPos = pos
	newPos.x = pos.x + border.x
	newPos.y = pos.y + border.y

	if(hasCondition(cid, CONDITION_OUTFIT) and getCreatureOutfit(cid).lookType == outfit.lookType) then
			doMoveCreature(cid, border.back)
			doRemoveCondition(cid, CONDITION_OUTFIT)
	else
			if(doTileQueryAdd(cid, pos, 4) ~= RETURNVALUE_NOERROR) then
					return false
			end

			doRemoveConditions(cid, true)

			doSendMagicEffect(pos, CONST_ME_POFF)
			doTeleportThing(cid, newPos)
			doSendMagicEffect(pos, CONST_ME_WATERSPLASH)
			voc = getPlayerVocation(cid)
			doCreatureChangeOutfit(cid, outfits[voc])
	end

	return true
end

Editado por Leoxtibia
Link para o comentário
Compartilhar em outros sites

  • 0

Cara quando ele vai nadar, ele não fica com a oufiti de natação e da esse ERRO quando vai volta pra terra, e ele não consegue sobir pra terra:

 

[19/07/2012 14:09:41] [Error - MoveEvents Interface]

[19/07/2012 14:09:41] data/movements/scripts/swimming.lua:onStepIn

[19/07/2012 14:09:41] Description:

[19/07/2012 14:09:41] attempt to index a number value

[19/07/2012 14:09:41] stack traceback:

[19/07/2012 14:09:41] [C]: in function 'doCreatureChangeOutfit'

[19/07/2012 14:09:41] data/movements/scripts/swimming.lua:91: in function <data/movements/scripts/swimming.lua:59>

 

ALGUEM PODERIA ME AJUDAR? :(

 

VALENDO +REP

Editado por Flaah
Link para o comentário
Compartilhar em outros sites

  • 0

Cara o erro do console vc arrumou, mais continua com os ERROS:

 

Ele não fica com a oufiti de natação quando esta na água, e ele não consegue voltar a terra.

 

ALGUEM PODERIA ME AJUDAR? :(

 

VALENDO +REP

Link para o comentário
Compartilhar em outros sites

  • 0

Cara não foi não, continua com os ERROS que eu falei acima :T

 

ALGUEM PODERIA ME AJUDAR? :(

 

VALENDO +REP

Editado por Flaah
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...