Aragornkk
Senior User
- Joined
- Oct 11, 2008
- Messages
- 705
- Reaction score
- 44
Upade 27 lipca
Skrypt naprawiony
Wiem ?e takich quest?w jest pe?no ale na tym forum nie znalaz?em czego? takiego. Skrypt sam napisa?em.
Wchodzimy do npc i tworzymy plik o nazwie aragorn.xml
Wklejamy do niego to:
w folderze creaturescripts/scripts doda? plik o nazwie kill.lua i wklei? to:
Nazwe mo?na zmienia? dowoli
creaturescripts.xml doda? to
W login.lua w creaturescripts
nad
return TRUE
Doda?
Skrypt naprawiony
Wiem ?e takich quest?w jest pe?no ale na tym forum nie znalaz?em czego? takiego. Skrypt sam napisa?em.
Wchodzimy do npc i tworzymy plik o nazwie aragorn.xml
Wklejamy do niego to:
Teraz wchodzimy do npc/scripts i tworzymy aragorn.lua i wklejamy co? takiego.:<?xml version="1.0" encoding="UTF-8"?>
<npc name="Aragorn" script="aragorn.lua" walkinterval="2000" floorchange="0">
<health now="150" max="150"/>
<look type="134" head="57" body="59" legs="40" feet="76" corpse="2212"/>
</npc>
Code:
local focuses = {}
local function isFocused(cid)
for i, v in pairs(focuses) do
if(v == cid) then
return true
end
end
return false
end
local function addFocus(cid)
if(not isFocused(cid)) then
table.insert(focuses, cid)
end
end
local function removeFocus(cid)
for i, v in pairs(focuses) do
if(v == cid) then
table.remove(focuses, i)
break
end
end
end
local function lookAtFocus()
for i, v in pairs(focuses) do
if(isPlayer(v) == TRUE) then
doNpcSetCreatureFocus(v)
return
end
end
doNpcSetCreatureFocus(0)
end
function onCreatureAppear(cid)
end
function onCreatureDisappear(cid)
if(isFocused(cid)) then
selfSay("Hmph!")
focus = 0
if(isPlayer(cid) == TRUE) then --Be sure he's online
closeShopWindow(cid)
end
end
end
function onCreatureSay(cid, type, msg)
queststatus = getPlayerStorageValue(cid,4701)
if((msg == "hi") or (msg == "Hi") and not (isFocused(cid))) then
selfSay("Witaj pewnie jestes kolejnym poszukiwaczem przygod? Aby zaczac quest powiedz 'quest' ", cid)
addFocus(cid)
elseif((isFocused(cid)) and (msg == "?egnaj" or msg == "do zobaczenia" or msg == "bye")) then
selfSay("Spadaj Wie?niaku !!!", cid, TRUE)
closeShopWindow(cid)
focus = 0
removeFocus(cid)
end
queststatus = getPlayerStorageValue(cid,4701)
if((msg == "quest") and (isFocused(cid)) and (queststatus == -1)) then
selfSay("Mog? ci pokaza?, jak nale?y balansowa? cia?em. Naucz? ci? AKROBATYKI", cid)
selfSay("Jak zabijesz smoka wroc tu i powiedz 'zabilem smoka'", cid)
end
queststatus = getPlayerStorageValue(cid,4701)
if((msg == "zabilem smoka") and (isFocused(cid))(queststatus == 1)) then
selfSay("Gratuluje ci. Wielu wojownikom sie to nie udalo", cid)
selfSay("A i bym zapommnial twoja nagroda", cid)--nagrode sami sobie dodacie
setPlayerStorageValue(cid,4701,2)
end
end
function onPlayerCloseChannel(cid)
if(isFocused(cid)) then
selfSay("Hmph!")
closeShopWindow(cid)
focus = 0
end
end
function onPlayerEndTrade(cid)
selfSay("It was a pleasure doing business with you.", cid)
end
function onThink()
for i, focus in pairs(focuses) do
if(isCreature(focus) == FALSE) then
removeFocus(focus)
else
local distance = getDistanceTo(focus) or -1
if((distance > 4) or (distance == -1)) then
selfSay("Hmph!")
closeShopWindow(focus)
removeFocus(focus)
end
end
end
lookAtFocus()
end
Code:
function onKill(cid, target)
local storage = getPlayerStorageValue(cid, 4701)
if(getCreatureName(target) == "dragon") then
if(storage == -1)then
setPlayerStorageValue(cid, 4701, 1)
end
end
return TRUE
end
creaturescripts.xml doda? to
Code:
<event type="kill" name="aragorn" script="kill.lua"/>
nad
return TRUE
Doda?
Code:
registerCreatureEvent(cid, "aragorn")