Vocations Door
Bom galera to aqui hoje pra ensinar a vocês como fazer uma Vocation door por Action Id.
Va no seu mapa editor e coloque um dos seguintes Actions IDs.
4531 = Sorcerers e Master Sorcerers
4532 = Druids e Elder Druids
4533 = Paladin's e Royal Paladin's
4534 = Knight's e Elite Knight's
Veja um exemplo:
(Nessa Porta só Knight's e Elite Knight's poderão passar.)
Agora vamos ao Script.
Depois de adicionar o action id na porta, va em data/actions/scripts, criem um arquivo chamado vocdoor.lua.
No arquivo vocdoor.lua adicione:
function onUse(cid, item, frompos, item2, topos)playervoc = getPlayerVocation(cid)
if item.actionid == (4531) then
if getPlayerVocation(cid) == 1 or playervoc == 5 then
pos = getPlayerPosition(cid)
if pos.x == topos.x then
if pos.y < topos.y then
pos.y = topos.y + 1
else
pos.y = topos.y - 1
end
elseif pos.y == topos.y then
if pos.x < topos.x then
pos.x = topos.x + 1
else
pos.x = topos.x - 1
end
else
doPlayerSendTextMessage(cid,22,'Você precisa estar na frente da porta.')
return 1
end
doTeleportThing(cid,pos)
doSendMagicEffect(topos,12)
else
doPlayerSendTextMessage(cid,22,"Apenas Sorcerer's podem passar.")
end
elseif item.actionid == (4532) then
if getPlayerVocation(cid) == 2 or playervoc == 6 then
pos = getPlayerPosition(cid)
if pos.x == topos.x then
if pos.y < topos.y then
pos.y = topos.y + 1
else
pos.y = topos.y - 1
end
elseif pos.y == topos.y then
if pos.x < topos.x then
pos.x = topos.x + 1
else
pos.x = topos.x - 1
end
else
doPlayerSendTextMessage(cid,22,'Você precisa estar na frente da porta.')
return 1
end
doTeleportThing(cid,pos)
doSendMagicEffect(topos,12)
else
doPlayerSendTextMessage(cid,22,"Apenas Druid's podem passar.")
end
elseif item.actionid == (4533) then
if getPlayerVocation(cid) == 3 or playervoc == 7 then
pos = getPlayerPosition(cid)
if pos.x == topos.x then
if pos.y < topos.y then
pos.y = topos.y + 1
else
pos.y = topos.y - 1
end
elseif pos.y == topos.y then
if pos.x < topos.x then
pos.x = topos.x + 1
else
pos.x = topos.x - 1
end
else
doPlayerSendTextMessage(cid,22,'Você precisa estar na frente da porta.')
return 1
end
doTeleportThing(cid,pos)
doSendMagicEffect(topos,12)
else
doPlayerSendTextMessage(cid,22,"Apenas Paladin's podem passar.")
end
elseif item.actionid == (4534) then
if getPlayerVocation(cid) == 4 or playervoc == 8 then
pos = getPlayerPosition(cid)
if pos.x == topos.x then
if pos.y < topos.y then
pos.y = topos.y + 1
else
pos.y = topos.y - 1
end
elseif pos.y == topos.y then
if pos.x < topos.x then
pos.x = topos.x + 1
else
pos.x = topos.x - 1
end
else
doPlayerSendTextMessage(cid,22,'Você precisa estar na frente da porta.')
return 1
end
doTeleportThing(cid,pos)
doSendMagicEffect(topos,12)
else
doPlayerSendTextMessage(cid,22,"Apenas Knight's podem passar.")
end
return 1
else
return 0
end
end
Agora va em data/actions/actions.xml e adicione a seguinte tag:
<action actionid="4531" event="script" value="vocdoor.lua"/><action actionid="4532" event="script" value="vocdoor.lua"/>
<action actionid="4533" event="script" value="vocdoor.lua"/>
<action actionid="4534" event="script" value="vocdoor.lua"/>
Explicando
Vermelho = Os numeros em vermelho são os numeros das actions id's de cada porta.
Azul = Aonde esta em Azul são os numeros de cada vocação.
1 = Sorcerer
2 = Druid
3 = Paladin
4 = Knight
5 = Master Sorcerer
6 = Elder Druid
7 = Royal Paladin
8 = Elite Knight
Laranja = Laranja é a menssagem que aparecera caso o player tente passa na porta com a vocação errada.
Bom é isso ai, qualquer coisa é só pergunta.
Ahh não esquece de comentar =).
Creditos:
Leleo = EU
Obrigado pela atenção.
Abraços.