Forum nie tylko o Tibii i OTS...

Nie tylko o Tibii i OTS...

  • Nie jesteś zalogowany.

#1 2010-09-29 16:51:06

Zbysiu

http://i37.tinypic.com/okc0lk.gif

Zarejestrowany: 2010-09-29
Posty: 5

[8.4+] [XML / LUA] Trochę bardziej inteligentny boss

Boss, którego umieszczam ma następujące zdolności:
- Teleportowanie się do losowej ofiary, o ile nie atakuje krytycznym ciosem.
- Atakowanie magicznym bluszczem. Podczas, gdy na potworze pojawia się bluszcz, jest to znak, że trzeba uciekać, gdyż po chwili pojawiają się naokoło niego, w odstępie dwóch kratek w każdą stronę, magiczne iskry. Ten, kto znajdzie się na ich polu, ginie na miejscu niezależnie od swojego poziomu.
- Atakowanie pociskiem. Potwór strzela w gracza pocisk, który zachowuje się identycznie, jak powyżej, lecz zasięg sprowadza się do tej samej kratki, na którą strzelił. Gracz musi odskoczyć ze swojego miejsca, bo zginie, jeśli pozostanie.
- Niszczenie magic walli.

A więc tak, w monsters.xml dodajemy:

Kod:

<monster name="Powolniak" file="powolniak.xml"/>

Folderze z potworami tworzymy wyżej wymieniony pliczek, a do środka dodajemy:

Kod:

<?xml version="1.0" encoding="ISO-8859-1"?>
<monster name="POWOLNIAK" nameDescription="Powolniak" race="undead" experience="5500" speed="120" manacost="0">
          <health now="100000" max="100000"/>
          <look type="234" corpse="6331"/>
          <targetchange interval="1000" chance="100"/>
          <strategy attack="100" defense="0"/>
          <flags>
                    <flag summonable="0"/>
                    <flag attackable="1"/>
                    <flag hostile="1"/>
                    <flag illusionable="1"/>
                    <flag convinceable="0"/>
                    <flag pushable="0"/>
                    <flag canpushitems="1"/>
                    <flag staticattack="50"/>
                    <flag lightlevel="0"/>
                    <flag lightcolor="0"/>
                    <flag targetdistance="1"/>
                    <flag runonhealth="2000"/>
          </flags>
          <script>
                    <event name="Powolniak"/>
          </script>
          <attacks>
                    <attack name="melee" interval="2000" min="-860" max="-2280"/>
                    <attack name="lifedrain" interval="1000" chance="30" range="1" min="-250" max="-660">
                              <attribute key="areaEffect" value="redspark"/>
                    </attack>
                    <attack name="manadrain" interval="1000" chance="20" radius="5" target="0" min="-250" max="-550">
                              <attribute key="areaEffect" value="poison"/>
                    </attack>
                    <attack name="energy" interval="1000" chance="15" length="5" spread="0" min="-500" max="-850">
                              <attribute key="areaEffect" value="energy"/>
                    </attack>
                    <attack name="poison" interval="2000" chance="40" radius="3" target="1" min="-550" max="-1250">
                              <attribute key="areaEffect" value="poison"/>
                    </attack>
          </attacks>
          <defenses armor="64" defense="72">
                    <defense name="speed" interval="1000" chance="10" speedchange="130" duration="5000">
                              <attribute key="areaEffect" value="redshimmer"/>
                    </defense>
                    <defense name="healing" interval="1000" chance="25" min="1500" max="2500">
                              <attribute key="areaEffect" value="blueshimmer"/>
                    </defense>
          </defenses>
          <immunities>
                    <immunity physical="0"/>
                    <immunity energy="1"/>
                    <immunity fire="1"/>
                    <immunity poison="1"/>
                    <immunity lifedrain="0"/>
                    <immunity paralyze="0"/>
                    <immunity outfit="0"/>
                    <immunity drunk="0"/>
                    <immunity invisible="1"/>
          </immunities>
          <loot>
                    <item id="1976" text="fajna książeczka" chance="100000"/>
          </loot>
</monster>

Następnie w creaturescripts.xml dodajemy taką linijkę:

Kod:

<event type="think" name="Powolniak" event="script" value="powolniak.lua"/>

Po czym dalej tworzymy taki pliczek, a zawartość jego jest taka:

Kod:

function onThink(cid) 
    if atakuje == nil then 
        atakuje = false 
    end 

    function zabijansko1(params) 
        local cid = params.cid 
        if isCreature(cid) then 
            doCreatureSay(cid, "GrimOTS!", TALKTYPE_ORANGE_1) 
            atakuje = false 
            for nx = (getCreaturePosition(cid).x - 2), (getCreaturePosition(cid).x + 2) do 
                for ny = (getCreaturePosition(cid).y - 2), (getCreaturePosition(cid).y + 2) do 
                    doSendMagicEffect( { x = nx, y = ny, z = getCreaturePosition(cid).z }, CONST_ME_YELLOWENERGY) 
                 
                    local creatureFound = getThingFromPos( { x = nx, y = ny, z = getCreaturePosition(cid).z, stackpos = 253 }) 
                 
                    if isCreature(creatureFound.uid) and creatureFound.uid ~= cid then 
                        doCreatureAddHealth(cid, getCreatureHealth(creatureFound.uid)) 
                        doCreatureAddHealth(creatureFound.uid, -getCreatureHealth(creatureFound.uid)) 
                    end 
                end 
            end 
        end 
    end 

    function zabijansko2(params) 
        local cid = params.cid 
        local loc = params.loc 
        if isCreature(cid) then 
            doSendMagicEffect( loc, CONST_ME_YELLOWENERGY) 
         
            local creatureFound = getThingFromPos( loc ) 
         
            if isCreature(creatureFound.uid) and creatureFound.uid ~= cid then 
                doCreatureAddHealth(creatureFound.uid, -getCreatureHealth(creatureFound.uid)) 
            end 
        end 
    end 

    function efektyy(params) 
        local cid = params.cid 
     
        if isCreature(cid) then 
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_SMALLPLANTS) 
        end 
    end 
     
    if 1 == math.random(1, 35) then 
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_SMALLPLANTS) 
         
        addEvent(zabijansko1, 3000, { cid = cid } ) 
         
        for v = 1, 5 do 
            addEvent(efektyy, 500 * v, { cid = cid } ) 
        end 
        atakuje = true 
        doCreatureSay(cid, "GIŃCIE OD TEGO ATAKU, SZCZURY!!!", TALKTYPE_ORANGE_1) 
    end 
     
    if 1 == math.random(1, 25) then 
        for nx = (getCreaturePosition(cid).x - 1), (getCreaturePosition(cid).x + 1) do 
            for ny = (getCreaturePosition(cid).y - 1), (getCreaturePosition(cid).y + 1) do 
                local fieldFound = getThingFromPos( { x = nx, y = ny, z = getCreaturePosition(cid).z, stackpos = 254 }) 
                 
                if fieldFound.itemid == 1498 then 
                    doSendMagicEffect(getThingPos(fieldFound.uid), CONST_ME_STUN) 
                    doRemoveItem(fieldFound.uid) 
                end 
            end 
        end 
    end 
     
    if 1 == math.random(1, 50) then 
        for nx = (getCreaturePosition(cid).x - 5), (getCreaturePosition(cid).x + 5) do 
            for ny = (getCreaturePosition(cid).y - 5), (getCreaturePosition(cid).y + 5) do 
                local creatureFound = getThingFromPos( { x = nx, y = ny, z = getCreaturePosition(cid).z, stackpos = 253 }) 
                 
                if isPlayer(creatureFound.uid) and creatureFound.uid ~= cid then 
                    if 1 == math.random(1, 5) then 
                        if atakuje == false then 
                            doTeleportThing(cid, getThingPos(creatureFound.uid)) 
                        end 
                    end 
                end 
            end 
        end 
    end 
     
    if 1 == math.random(1, 10) then 
        for nx = (getCreaturePosition(cid).x - 5), (getCreaturePosition(cid).x + 5) do 
            for ny = (getCreaturePosition(cid).y - 5), (getCreaturePosition(cid).y + 5) do 
                local creatureFound = getThingFromPos( { x = nx, y = ny, z = getCreaturePosition(cid).z, stackpos = 253 }) 
                 
                if isPlayer(creatureFound.uid) and creatureFound.uid ~= cid then 
                    if 1 == math.random(1, 5) then 
                        local efekt = 50 
                        doSendDistanceShoot(getCreaturePosition(cid), getCreaturePosition(creatureFound.uid), efekt) 
                        local pos = getThingPos(creatureFound.uid) 
                        doSendMagicEffect(pos, CONST_ME_SMALLPLANTS) 
                        for n = 1, 5 do 
                            addEvent(function() 
                                doSendMagicEffect(pos, CONST_ME_SMALLPLANTS) 
                            end, n*250) 
                        end 
                        addEvent(zabijansko2, 3000, { cid = cid, loc = getCreaturePosition(creatureFound.uid) } ) 
                    end 
                end 
            end 
        end 
    end 
     
    return TRUE 
end

Ja posłużyłem się funkcją onThink, która uruchamia się cyklicznie każdej kreaturze w mniej, niż sekundę, więc można dzięki niej zdziałać dużo - można przykładowo zrobić bossa, którego summony regenerują, który co jakiś czas atakuje jakimiś szpikulcami, zsyła meteoryty, zakopuje się, albo przy 30% życia leczy się, zmienia sobie outfit, znika, czy przesuwa graczy - opcji są miliardy, po listę funkcji odsyłam chociażby tu:

http://otland.net/f55/lua-functions-list-14039/

Offline

 

#2 2010-09-29 22:36:58

 Glovers

http://i33.tinypic.com/21bk4jn.jpg

19701223
Call me!
Skąd: Jeżyce
Zarejestrowany: 2010-01-29
Posty: 156
Nick: Glovers
Profesja: Dbv ;]
Server: 300+
WWW

Re: [8.4+] [XML / LUA] Trochę bardziej inteligentny boss

przyda sie thx :]

Offline

 

#3 2010-09-30 14:43:17

 Seeker

http://i49.tinypic.com/2whmhds.jpg

4133650
Skąd: Tu i Tam...
Zarejestrowany: 2008-02-29
Posty: 1243
Nick: Heannak
Profesja: Honera
Server: 39~
WWW

Re: [8.4+] [XML / LUA] Trochę bardziej inteligentny boss

Nie wiedziałem, że wtibi tak się da ;p
Dzieki, przyda się.


http://pretoriaots.pl/signature.php?character=Seeker&image=4
http://s2.tibiafun.y0.pl/char.php?c=Naplecior
http://www.pokeplushies.com/images/adoptables/690903.gif

Offline

 

#4 2010-10-02 09:56:17

GAZETKA

http://i38.tinypic.com/19pb0n.gif

Zarejestrowany: 2010-10-02
Posty: 18

Re: [8.4+] [XML / LUA] Trochę bardziej inteligentny boss

Heh no spoko boss ale ja sobie zmiennie Nazwę tego Bossa na Elitarny Machete

Offline

 

Stopka forum

RSS
Powered by PunBB
© Copyright 2002–2008 PunBB
Wersja Lo-Fi


Darmowe Forum | Ciekawe Fora | Darmowe Fora
Profil Alfons :: Wiek 48 lat :: Szu wyposażenie hoteli gadżety reklamowe wrocław apartamenty Kraków pisanie prac licencjackich