Admin Nivaldo Admin
Cantidad de envíos : 34 Edad : 30 Fecha de inscripción : 01/03/2008
| Tema: Como hacer playas 100% Sáb Dic 13, 2008 10:43 pm | |
| Primero si tienes un ot que no tiene el Npc aqui se los dejo: Guardar npc: - Código:
-
<?xml version="1.0"?>
<npc name="Dimitri" script="data/npc/scripts/swimming4.lua" access="3" lookdir="2"> <mana now="800000" max="80000"/> <health now="200" max="200"/> <look type="267"/> </npc> Guardamos y ahora el script: Copiamos cual sea y guardamos como swimming4.lua Y este es el codigo. Lo rojo es editable! - Código:
-
local focus = 0 local talk_start = 0 local target = 0 local following = false local attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos) if focus == cid then selfSay('Good bye then.') focus = 0 talk_start = 0 end end
function onCreatureTurn(creature)
end
function msgcontains(txt, str) return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)')) end
function onCreatureSay(cid, type, msg) msg = string.lower(msg)
if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 3 then selfSay('Hello ' .. creatureGetName(cid) .. '! I am the life-saving the lake. What we want?') focus = cid talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 3 then selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')
elseif focus == cid then talk_start = os.clock()
if msgcontains(msg, 'swim') then selfSay('Want to swim in the lake?') talk_state = 1
elseif msgcontains(msg, 'exit') then selfSay('Are you sure you want to quit?') talk_state = 2
elseif talk_state == 1 then if msgcontains(msg, 'yes') then if pay(cid,0) then travel(cid, 1045, 990, 7) doSetSwimEffect(cid, "Swimmer", 31536000000) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_WATERSPLASH) else selfSay('Sorry, you don\'t have enough money.') end end talk_state = 0
elseif talk_state == 2 then if msgcontains(msg, 'yes') then if pay(cid,0) then travel(cid, 1040, 990, 7) doSetSwimEffect(cid, "Citizen", 10000) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_BUBBLES) doPlayerSendTextMessage(cid,22,"Por favor Loguea o redefine su outfit.") else selfSay('Sorry, you don\'t have enough money.') end end talk_state = 0
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 3 then selfSay('Good bye, ' .. creatureGetName(cid) .. '!') focus = 0 talk_start = 0 end end end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 15 then if focus > 0 then selfSay('Next Please...') end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 3 then selfSay('Good bye then.') focus = 0 end end end Bueno lo que esta en el codigo que dice: travel(cid, 1045, 990, 7) Esa seria donde Saldria el player de la playa (Hi, Exit, yes) Los numeros serian X: ? Y: ? Z: ? Donde saldria su player, al igual que el de arriba que seria para entrar a la playa. Bueno ahora Abrimos nuestro map editor Si no tienes uno con lo 8.1 : http://rapidshare.com/files/84862608/Simone_0.5.rarY abrimos El Map editor.... Vamos a la Seccion grounds y Buscamos el Tipo de agua Numero "4620". Por que esta? por que es en la que se puede caminar, en la que se puede poner el npc y demas.... Normalmente seria el agua 4608 que esta hay, pues la cambiamos por la 4620 Para poder nadar... Y luego le ponemos proteccion en la playa, pero afuera si tu quieres, no es obligatorio... Ahora Vamos a data/movements/movements.xml Abrimos movements.xml Y pegamos en la parte de abajo: - Código:
-
<movevent event="StepIn" actionid="3333" script="swimming.lua"/> Luego en data/movements/movements.xml/scripts Copiamos cualquiera y lo guardamos como swimming.lua Y Abrimos y borramos todo. Y pegamos esto: - Código:
-
function onStepIn(cid, item, frompos, item2, npos) npos = {x=frompos.x, y=frompos.y, z=frompos.z} if isPlayer(cid) == TRUE then getPlayerPosition(cid) swimvalue = 3330 --storagevalue to check diveroutfit = { lookType = 267, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookAddons = 0 } standardoutfit = { lookType = getPlayerStorageValue(cid, 3331), lookHead = getPlayerStorageValue(cid, 3332), lookBody =
getPlayerStorageValue(cid, 3333), lookLegs = getPlayerStorageValue(cid, 3334), lookFeet = getPlayerStorageValue(cid, 3335), lookAddons =
getPlayerStorageValue(cid, 3336) } isswimming = getPlayerStorageValue(cid, swimvalue) if (isswimming == -1) or (isswimming == 2) then if item.itemid == 4632 then npos.y = npos.y - 1 doTeleportThing(cid,npos) elseif item.itemid == 4633 then npos.x = npos.x - 1 doTeleportThing(cid,npos) elseif item.itemid == 4634 then npos.y = npos.y + 1 doTeleportThing(cid,npos) elseif item.itemid == 4635 then npos.x = npos.x + 1 doTeleportThing(cid,npos) elseif item.itemid == 4640 then npos.y = npos.y + 1 npos.x = npos.x + 1 doTeleportThing(cid,npos) elseif item.itemid == 4642 then npos.y = npos.y - 1 npos.x = npos.x + 1 doTeleportThing(cid,npos) elseif item.itemid == 4643 then npos.y = npos.y - 1 npos.x = npos.x - 1 doTeleportThing(cid,npos) elseif item.itemid == 4638 then npos.x = npos.x + 1 doTeleportThing(cid,npos) elseif item.itemid == 4641 then npos.x = npos.x - 1 npos.y = npos.y + 1 doTeleportThing(cid,npos) elseif item.itemid == 4637 then npos.x = npos.x - 1 doTeleportThing(cid,npos) end setPlayerStorageValue(cid, 3331, getCreatureOutfit(cid).lookType) setPlayerStorageValue(cid, 3332, getCreatureOutfit(cid).lookHead) setPlayerStorageValue(cid, 3333, getCreatureOutfit(cid).lookBody) setPlayerStorageValue(cid, 3334, getCreatureOutfit(cid).lookLegs) setPlayerStorageValue(cid, 3335, getCreatureOutfit(cid).lookFeet) setPlayerStorageValue(cid, 3336, getCreatureOutfit(cid).lookAddons) setPlayerStorageValue(cid, swimvalue, 1) doSetCreatureOutfit(cid, diveroutfit, 260000) doSendMagicEffect(npos, 2) doSendMagicEffect(npos, 53) elseif isswimming == 1 then if item.itemid == 4632 then dir = 2 elseif item.itemid == 4633 then dir = 1 elseif item.itemid == 4634 then dir = 0 elseif item.itemid == 4635 then dir = 3 elseif item.itemid == 4636 then dir = 3 elseif item.itemid == 4637 then dir = 1 elseif item.itemid == 4638 then dir = 3 elseif item.itemid == 4639 then dir = 2 elseif item.itemid == 4640 then dir = 3 elseif item.itemid == 4641 then dir = 1 elseif item.itemid == 4642 then dir = 3 elseif item.itemid == 4643 then dir = 1 end doSetCreatureOutfit(cid, standardoutfit, 1) doMoveCreature(cid, dir) setPlayerStorageValue(cid, swimvalue, 2) end end return TRUE end Recuerda Poner Proteccion Zone en el agua, para que no te ahogues... | |
|