Tibia Mod
Forum zostało Przeniesione tutaj:
http://tibiamod.xaa.pl/

Zapraszam.

Join the forum, it's quick and easy

Tibia Mod
Forum zostało Przeniesione tutaj:
http://tibiamod.xaa.pl/

Zapraszam.
Tibia Mod
Czy chcesz zareagować na tę wiadomość? Zarejestruj się na forum za pomocą kilku kliknięć lub zaloguj się, aby kontynuować.

Saga System [CreatureEvents&Npc]

3 posters

Go down

Saga System [CreatureEvents&Npc] Empty Saga System [CreatureEvents&Npc]

Pisanie by darkes Wto Lis 13, 2012 9:33 pm

JSkrypt działa na takiej zasadzie ,że każda osoba ,która zada min. 25% hp lub ostatni hit dostaje sage.

W data/Creaturescript/creaturescript.xml dodajemy:



Kod:
<event type="kill" name="saga" event="script" value="saga.lua"/>

W Creaturescirpt/sripts/login.lua
Kod:
registerCreatureEvent(cid, "saga")


W Creaturescirpt/sripts/Saga.lua
Kod:
function onKill(cid, target, lastHit)
   if lastHit and getCreatureName(target):lower() == 'wolf' or getCreatureName(target):lower() == 'wolf' and doCreatureAddHealth(target, -(getCreatureHealth(target)*(25/100))) then
      setGlobalStorageValue(1, 0)
      doCreatureSay(cid, "You kill mizuki", TALKTYPE_ORANGE_1)
      if getPlayerStorageValue(cid, 8000) == 1 then
         setPlayerStorageValue(cid, 8000, 2)
      end
   end
   return true
end

Skrypt działa na tfs 0.3.5 pl, wiem bo testowałem xd. W miejsce wolf należy wpisać nazwę potworka ,który daje nam storage.

25/100<----ile % hp trzeba zadać potworkowi abyśmy otrzymali sage.

Jeżeli ktoś chce to może dać + xd.

Screen dla potwierdzenie. Kolega zjechał go do reda a ja dobiłem mobka i oboje dostaliśmy storage ;d.
Saga System [CreatureEvents&Npc] Sagak

Zamiast setGlobalStorageValue(1, 0) można dać :
doPlayerAddExp(cid,ilość expa)
doPlayerAddMana(cid, ilość many)
doPlayerAddItem(cid, id itemka)
doPlayerAddHealth(cid,ilość hp)
lub
doTeleportThing(cid, tppos)
tppos = {x=160, y=49, z=7, stackpos=1}



Przykładowy npc


Kod:
 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)
    if((msg == "hi") and not (isFocused(cid))) then
        selfSay("Welcome, ".. getCreatureName(cid) .." do you want start Your adventure with Bleach??", cid, TRUE)
        addFocus(cid)
    elseif((isFocused(cid)) and (msg == "yes")) then  ----- 1>
        if getPlayerStorageValue(cid,25128) == -1 then ---- 2
        selfSay("Alright, so I have for you first task. You have to kill Hollow. He is somehere in the Karakura and I don't know where. Find him", cid,  TRUE) ----- 3
          doPlayerAddExp(cid, 500) ----- 4
      setPlayerStorageValue(cid,25128,2) ---- 5
        end
        if((msg == "hi") and not (isFocused(cid))) then
        selfSay("Welcome, ".. getCreatureName(cid) .." Do You find and kill Hollow?! ' .", cid, TRUE)
        addFocus(cid)
    elseif((isFocused(cid)) and (msg == "yes")) then  ----- 1>
        if getPlayerStorageValue(cid,25128) == 3 then ---- 2
        selfSay("Great. Now You have to go Orihime Inoue.", cid,  TRUE) ----- 3
          doPlayerAddExp(cid, 1000) ----- 4
      setPlayerStorageValue(cid,25128,4) ---- 5
        end
    elseif((isFocused(cid)) and (msg == "bye" or msg == "goodbye" or msg == "cya")) then
        selfSay("Goodbye!", cid, TRUE)
        closeShopWindow(cid)
        focus = 0
    end
end
function onPlayerCloseChannel(cid)
    if(isFocused(cid)) then
        selfSay("Bye Bye!")
        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("Bye Bye!", cid,  TRUE)
                closeShopWindow(focus)
                removeFocus(focus)
            end
        end
    end
    lookAtFocus()
end
end



Ostatnio zmieniony przez darkes dnia Czw Lis 15, 2012 7:57 pm, w całości zmieniany 2 razy

darkes
Uploader

Liczba postów : 27
Join date : 13/11/2012

Powrót do góry Go down

Saga System [CreatureEvents&Npc] Empty Re: Saga System [CreatureEvents&Npc]

Pisanie by kubiczi123 Wto Lis 13, 2012 11:59 pm

Ladnie opisane, widac, ze sie postarales, bo i ss wlasny.
To dzieki ludziom jak ty to wszystko bedzie szlo do przodu.
Skrypt dziala, byl drobny blad ale to przez moj silnik.

kubiczi123
Moderator

Liczba postów : 12
Join date : 13/11/2012
Age : 28
Skąd : Pila

Powrót do góry Go down

Saga System [CreatureEvents&Npc] Empty Re: Saga System [CreatureEvents&Npc]

Pisanie by Sedron Sro Lis 14, 2012 1:47 pm

Przeniosę do systemów.
Jeśli skrypt ma więcej niż 2 znaczniki jak ten temat,
Proszę kierować skrypt do Systemów.

Pozdrawima
Sedron
Sedron
Admin

Liczba postów : 97
Join date : 11/11/2012

https://tibiamod.forumpl.net

Powrót do góry Go down

Saga System [CreatureEvents&Npc] Empty Re: Saga System [CreatureEvents&Npc]

Pisanie by Sponsored content


Sponsored content


Powrót do góry Go down

Powrót do góry

- Similar topics

 
Permissions in this forum:
Nie możesz odpowiadać w tematach