What's new

Criredric - nietypowy boss wampir?w.

Status
Not open for further replies.

Vergil93

Advanced User
Joined
Jun 19, 2010
Messages
263
Reaction score
6
Boss ten posiada takie umiej?tno?ci:
* Usuwanie mwalli, wild growth, fire/poison/energy field,
* Przyzwane przez niego nietoperze go uleczaj?,
* O?ywia martwe wampiry i nietoperze.

Najpierw w?drujemy do monsters i tworzymy tam plik o nazwie Criredric.xml i wklejamy:
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Criredric" nameDescription="Criredric" race="undead" experience="1275" speed="245" manacost="0">
  <health now="2150" max="2150"/>
  <look type="68" corpse="6006"/>
  <targetchange interval="1250" chance="12"/>
  <strategy attack="100" defense="0"/>
  <flags>
    <flag attackable="1"/>
    <flag hostile="1"/>
    <flag convinceable="1"/>
    <flag canpushitems="1"/>
    <flag canpushcreatures="1"/>
    <flag targetdistance="1"/>
    <flag staticattack="90"/>
    <flag runonhealth="15"/>
  </flags>
	<script>
		<event name="Criredric"/>
	</script>
  <attacks>
    <attack name="melee" interval="2000" skill="75" attack="60"/>
    <attack name="lifedrain" interval="1064" chance="12" range="1" min="-132" max="-199">
      <attribute key="areaEffect" value="redshimmer"/>
    </attack>
    <attack name="death" interval="987" chance="5" target="1" range="3" min="-234" max="-261">
      <attribute key="areaEffect" value="mortarea"/>
	  <attribute key="shootEffect" value="suddendeath"/>
    </attack>
	<attack name="death" interval="987" chance="14" target="1" range="3" min="-74" max="-91">
      <attribute key="areaEffect" value="mortarea"/>
	  <attribute key="shootEffect" value="death"/>
    </attack>
	<attack name="speed" interval="1111" chance="12" target="0" radius="4" speedchange="-389" duration="10000">
      <attribute key="areaEffect" value="redshimmer"/>
    </attack>
  </attacks>
  <defenses armor="17" defense="23">
    <defense name="outfit" interval="1063" chance="16" monster="bat" duration="2500">
      <attribute key="areaEffect" value="poff"/>
    </defense>
    <defense name="outfit" interval="1102" chance="16" monster="vampire" duration="6000">
      <attribute key="areaEffect" value="poff"/>
    </defense>
     <defense name="speed" interval="976" chance="10" speedchange="186" duration="6000">
      <attribute key="areaEffect" value="redshimmer"/>
    </defense>
  </defenses>
  <elements>
	  <element physicalPercent="30"/>
	  <element firePercent="-5"/>
	  <element holyPercent="-15"/>
  </elements>
  <immunities>
    <immunity earth="1"/>
    <immunity death="1"/>
	<immunity drown="1"/>
	<immunity drunk="1"/>
    <immunity lifedrain="1"/>
    <immunity paralyze="1"/>
    <immunity invisible="1"/>
  </immunities>
  <voices interval="5000" chance="100"> 
    <voice sentence="BLOOD!" yell="1"/>
    <voice sentence="Let me kiss your neck."/>
    <voice sentence="I smell warm blood."/>
    <voice sentence="I call you, my bats! Come!"/>
  </voices>
  <summons maxSummons="3">
    <summon name="Bat" interval="987" chance="18"/>
  </summons>
  <loot>
    <item id="2148" countmax="19" chance="11550"/> --gold
    <item id="7403" chance="1310"/> --berserker
    <item id="10601" chance="6760"/> --vamp teeth
    <item id="5905" chance="100000"/> --vamp dust
    <item id="2172" chance="970"/> --bronze amulet
    <item id="982" countmax="3" chance="1000"/> --dark talon
    <item id="2148" countmax="9" chance="11550"/> --gold
    <item id="6300" chance="7580"/> --death ring
    <item id="2229" countmax="3" chance="22980"/> --skull
    <item id="2238" chance="16970"/> --worn leather boots
    <item id="2747" chance="14700"/> --grave flower
    <item id="2534" chance="1340"/> --vamp shield
    <item id="2483" chance="14390"/> --scale armor
	<item id="8903" chance="1390"/> --sb of lost soul
    <item id="7588" countmax="3" chance="13480"/> --SHP
    <item id="2479" chance="12440"/> --strange helmet
  </loot>
</monster>
Nast?pnie tworzymy plik weak wampire.xml i wklejamy:
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="weak vampire" nameDescription="a weak vampire" race="undead" experience="95" speed="220" manacost="0">
  <health now="260" max="260"/>
  <look type="68" corpse="6006"/>
  <targetchange interval="5000" chance="8"/>
  <strategy attack="100" defense="0"/>
  <flags>
    <flag attackable="1"/>
    <flag hostile="1"/>
    <flag convinceable="1"/>
    <flag canpushitems="1"/>
    <flag canpushcreatures="1"/>
    <flag targetdistance="1"/>
    <flag staticattack="90"/>
    <flag runonhealth="0"/>
  </flags>
  <attacks>
    <attack name="melee" interval="2000" skill="55" attack="30"/>
    <attack name="lifedrain" interval="1075" chance="11" range="1" min="-20" max="-100">
      <attribute key="areaEffect" value="redshimmer"/>
    </attack>
    <attack name="speed" interval="975" chance="8" target="1" speedchange="-298" duration="12000">
      <attribute key="areaEffect" value="redshimmer"/>
    </attack>
  </attacks>
  <defenses armor="15" defense="20">
    <defense name="outfit" interval="1042" chance="17" monster="bat" duration="2000">
      <attribute key="areaEffect" value="poff"/>
    </defense>
	<defense name="healing" interval="994" chance="13" min="14" max="38"/>
     <defense name="speed" interval="1053" chance="11" speedchange="206" duration="6000">
      <attribute key="areaEffect" value="redshimmer"/>
    </defense>
  </defenses>
  <elements>
  <element physicalPercent="10"/>
  <element firePercent="-15"/>
  <element holyPercent="-25"/>
  </elements>
  <immunities>
    <immunity earth="1"/>
    <immunity death="1"/>
	<immunity drown="1"/>
	<immunity drunk="1"/>
    <immunity lifedrain="1"/>
    <immunity paralyze="1"/>
    <immunity invisible="1"/>
  </immunities>
  <voices interval="5000" chance="100"> 
    <voice sentence="BLOOD!" yell="1"/>
    <voice sentence="I smell warm blood."/>
  </voices>
  <loot>
    <item id="2148" countmax="10" chance="5090"/> --gold
    <item id="10601" chance="2760"/> --vampire teeth
    <item id="2144" chance="480"/> --black pearl
	<item id="2229" chance="350"/> --skull
	<item id="2172" chance="50"/> --bronze amulet
  </loot>
</monster>
Do monsters.xml doklejamy:
PHP:
<monster name="Criredric" file="Criredric.xml"/>
<monster name="Weak Vampire" file="weak vampire.xml"/>
 

Vergil93

Advanced User
Joined
Jun 19, 2010
Messages
263
Reaction score
6
Odp: Criredric - nietypowy boss wampir?w.

Idziemy teraz do folderu creaturescripts/scripts i tworzymy plik o nazwie Criredric.lua i wklejamy:
PHP:
local monsters = {
				[2956] = {monster = "weak vampire"},
				[4298] = {monster = "bat"}
				}
local tiles = {2957,2958,4299,4300}

local fields = {
				[1] = {item_id = {1497,1499}, effect = CONST_ME_TELEPORT},
				[2] = {item_id = {1492,1493,1494}, effect = CONST_ME_MAGIC_RED},
				[3] = {item_id = {1495}, effect = CONST_ME_MAGIC_BLUE},
				[4] = {item_id = {1496}, effect = CONST_ME_MAGIC_GREEN},
				[5] = {item_id = {967}, effect = CONST_ME_MAGIC_RED},
				[6] = {item_id = {11779}, effect = CONST_ME_ASSASSIN}
				}

local function effect(p)
local fieldFound = getThingFromPos(p.pos)
    if isCreature(p.cid) then
        doSendMagicEffect(p.pos, CONST_ME_MORTAREA)
        if p.n < 4 then
            p.n=p.n+1
            addEvent(effect, 250, p)
        else
            if monsters[fieldFound.itemid] then 
                doCreateMonster(monsters[fieldFound.itemid].monster, p.pos, false)
                doRemoveItem(fieldFound.uid)
            elseif isInArray(tiles, fieldFound.itemid) then
                doCreateItem(fieldFound.itemid-1, 1, p.pos)
                doRemoveItem(fieldFound.uid)
            end
        end
    end
end

function onThink(cid)
	if isMonster(cid) then
        local pos = getCreaturePosition(cid)
        if math.random(1, 100) <= 7 then
            if getCreatureHealth(cid) < getCreatureMaxHealth(cid) then
                for nx = (pos.x - 3), (pos.x + 3) do
                    for ny = (pos.y - 3), (pos.y + 3) do
                        local creatureFound = getThingFromPos({x=nx,y=ny,z=pos.z,stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
                        if creatureFound.uid ~= cid and isMonster(creatureFound.uid) and getCreatureName(creatureFound.uid) == "bat" and getCreatureMaster(creatureFound.uid) == cid and isSightClear(getCreaturePosition(creatureFound.uid), pos, true) then
                            local hp = math.ceil(getCreatureHealth(creatureFound.uid)+math.random(1,9))
                            doCreatureAddHealth(cid, hp)
                            doSendAnimatedText(pos, hp, COLOR_BLACK)
                            doSendDistanceShoot(getThingPos(creatureFound.uid), pos, CONST_ANI_DEATH)
                            doSendMagicEffect(pos, CONST_ME_MORTAREA)
                        end
                    end
                end
            end
        end
        if math.random(1, 100) <= 15 then
            for nx = (pos.x - 2), (pos.x + 2) do
                for ny = (pos.y - 2), (pos.y + 2) do
                    for i = 1, 254 do
                        stackpos = i
                        local fieldFound = getThingFromPos({x = nx, y = ny, z = pos.z, stackpos = stackpos})
                        if fieldFound.uid ~= 0 and isInArray({2956,2957,2958,4298,4299,4300}, fieldFound.itemid) and isSightClear(pos, getThingPos(fieldFound.uid), true) then
                            local poss = getThingPos(fieldFound.uid)
                            addEvent(effect, 250, {pos=poss, cid=cid, n=1, fieldFound=fieldFound})
                        end
                    end
                end
            end
        end
        if math.random(1, 100) <= 10 then 
            for nx = (pos.x - 1), (pos.x + 1) do 
                for ny = (pos.y - 1), (pos.y + 1) do 
                    for i = 1, 254 do
                        stackpos = i
                        local fieldFound = getThingFromPos({x = nx, y = ny, z = pos.z, stackpos = stackpos}) 
                        for k = 1, #fields do
							if fieldFound.uid ~= 0 and isInArray(fields[k].item_id, fieldFound.itemid) then
								doSendMagicEffect(getThingPos(fieldFound.uid), fields[k].effect)
								doRemoveItem(fieldFound.uid)
							end
						end
                    end
                end
            end
        end
    end
    return true
end
Do creaturescripts.xml wklejamy:
PHP:
<event type="think" name="Criredric" event="script" value="Criredric.lua"/>
Za? do login.lua, przed return true wklejamy:
PHP:
registerCreatureEvent(cid, "Criredric")

Skrypt wykonany przez Oskar.
Wszelkie prawa zastrze?one.

Notka moderatorska:
Skrypt jak zwykle bardzo dobry w Twoim wykonaniu i przenosz? do monsters.
 
Last edited:

zakius

Senior User
Joined
May 25, 2008
Messages
869
Reaction score
52
Odp: Criredric - nietypowy boss wampir?w.

haha, widz?, ?e powolniak wywo?a? niema?e poruszenie w twojej g?owie co?
jak sko?cz? z powolniakem zobacz? co tu da si? zrobi? aby skr?ci?, poprawi? bo akurat nie mam co robi?
@down: sporo da si? zrobi?, drabinka elseif do usuni?cia itp
a powolniaka robi? aby wrzuci? do oryginalnego tematu, tylko nie wiem czy wszystko b?dzie na 0.3.4 dzia?a?
i nie tyle b??d?w co niedoci?gni?? moim zdaniem
 
Last edited:

Vergil93

Advanced User
Joined
Jun 19, 2010
Messages
263
Reaction score
6
Odp: Criredric - nietypowy boss wampir?w.

Powolniaka te? przerobi?em na swoje potrzeby, tamten mia? kilka b??d?w.
Tutaj niewiele mo?na skr?ci?. Tylko "zmartwychwstanie" wampir?w i nietoperzy, ale nie wiadomo czy u innych czasem doTransformItem nie dzia?a poprawnie.
 

Vergil93

Advanced User
Joined
Jun 19, 2010
Messages
263
Reaction score
6
Odp: Criredric - nietypowy boss wampir?w.

?adnych komentarzy?
 

zakius

Senior User
Joined
May 25, 2008
Messages
869
Reaction score
52
Odp: Criredric - nietypowy boss wampir?w.

Code:
local monsters=
{
    [2956]="weak vampire",
    [4298]="bat"
}
local tiles={2957,2958,4299,4300}
local function effect(p)
    if isCreature(p.cid) then
        doSendMagicEffect(p.pos, CONST_ME_MORTAREA)
        if p.n <4 then
            p.n=p.n+1
            addEvent(effect, 250, p)
        else
            local fieldFound = getThingFromPos(p.pos)
            if monsters[fieldFound.itemid] then 
                doCreateMonster(monsters[fieldFound.itemid], p.pos, false)
                doRemoveThing(fieldFound.uid)
            elseif isInArray(tiles, fieldFound.itemid) then
                doRemoveItem(fieldFound.uid)
                doCreateItem(fieldFound.itemid-1, 1, p.pos)
            end
        end
    end
end
function onThink(cid)
    if isMonster(cid) then
        local pos = getCreaturePosition(cid)
        if math.random(1, 100) <= 7 then
            if getCreatureHealth(cid) < getCreatureMaxHealth(cid) then
                for nx = (pos(cid).x - 3), (pos(cid).x + 3) do
                    for ny = (pos(cid).y - 3), (pos(cid).y + 3) do
                        local creatureFound = getThingFromPos( { x = nx, y = ny, z = pos(cid).z, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE })
                        if creatureFound.uid ~= cid and isMonster(creatureFound.uid) and getCreatureName(creatureFound.uid) == "bat" and getCreatureMaster(creatureFound.uid) == cid then
                            local hp = math.ceil(getCreatureHealth(creatureFound.uid)+math.random(1,9))
                            doCreatureAddHealth(cid, hp)
                            doSendAnimatedText(pos(cid), hp, COLOR_BLACK)
                            doSendDistanceShoot(getThingPos(creatureFound.uid), pos(cid), CONST_ANI_DEATH)
                            doSendMagicEffect(pos(cid), CONST_ME_MORTAREA)
                        end
                    end
                end
            end
        end
        if math.random(1, 100) <= 15 then
            for nx = (pos.x - 2), (pos.x + 2) do
                for ny = (pos.y - 2), (pos.y + 2) do
                    for i=1, 254 do
                        stackpos = i
                        local fieldFound = getThingFromPos({x = nx, y = ny, z = pos.z, stackpos = stackpos})
                        if fieldFound.uid ~= 0 and isInArray({2956,2957,2958,4298,4299,4300}, fieldFound.itemid)and isSightClear(pos, {x=nx, y=ny, z=pos.z}, false) then
                            local poss = getThingPos(fieldFound.uid)
                            addEvent(effect, 250, {pos=poss, cid=cid, n=1})
                        end
                    end
                end
            end
        end
        if math.random(1, 100) <= 10 then 
            for nx = (pos.x - 1), (pos.x + 1) do 
                for ny = (pos.y - 1), (pos.y + 1) do 
                    for i=1, 254 do
                        stackpos = i
                        local fieldFound = getThingFromPos({x = nx, y = ny, z = pos.z, stackpos = stackpos}) 
                        if isInArray({1497,1499}, fieldFound.itemid) then
                            doSendMagicEffect(getThingPos(fieldFound.uid), CONST_ME_TELEPORT)
                            doRemoveItem(fieldFound.uid)
                        elseif isInArray({1492,1493,1494}, fieldFound.itemid) then
                            doSendMagicEffect(getThingPos(fieldFound.uid), CONST_ME_MAGIC_RED)
                            doRemoveItem(fieldFound.uid)
                        elseif isInArray({1495}, fieldFound.itemid) then
                            doSendMagicEffect(getThingPos(fieldFound.uid), CONST_ME_MAGIC_BLUE)
                            doRemoveItem(fieldFound.uid)
                        elseif isInArray({1496}, fieldFound.itemid) then
                            doSendMagicEffect(getThingPos(fieldFound.uid), CONST_ME_MAGIC_GREEN)
                            doRemoveItem(fieldFound.uid)
                        end 
                    end
                end 
            end 
        end 
    end
    return true
end
tyle na razie, ostatni? drabink? elseif da?oby rade pewnie jeszcze skr?ci? ale nie mam pomys?u
 
Last edited:

Vergil93

Advanced User
Joined
Jun 19, 2010
Messages
263
Reaction score
6
Odp: Criredric - nietypowy boss wampir?w.

PHP:
local monsters=
{
    [2956]="weak vampire",
    [4298]="bat"
}
local tiles={2957,2958,4299,4300}

local fields = {
				[1] = {item_id = {1497,1499}, effect = CONST_ME_TELEPORT},
				[2] = {item_id = {1492,1493,1494}, effect = CONST_ME_MAGIC_RED},
				[3] = {item_id = {1495}, effect = CONST_ME_MAGIC_BLUE},
				[4] = {item_id = {1496}, effect = CONST_ME_MAGIC_GREEN}
				}	
		
local function effect(p)
    if isCreature(p.cid) then
        doSendMagicEffect(p.pos, CONST_ME_MORTAREA)
        if p.n <4 then
            p.n=p.n+1
            addEvent(effect, 250, p)
        else
            local fieldFound = getThingFromPos(p.pos)
            if monsters[fieldFound.itemid] then 
                doCreateMonster(monsters[fieldFound.itemid], p.pos, false)
                doRemoveThing(fieldFound.uid)
            elseif isInArray(tiles, fieldFound.itemid) then
                doCreateItem(fieldFound.itemid-1, 1, p.pos)
				doRemoveItem(fieldFound.uid)
            end
        end
    end
end
function onThink(cid)
    if isMonster(cid) then
		local pos = getCreaturePosition(cid)
        if math.random(1, 100) <= 7 then
            if getCreatureHealth(cid) < getCreatureMaxHealth(cid) then
                for nx = (pos.x - 3), (pos.x + 3) do
                    for ny = (pos.y - 3), (pos.y + 3) do
                        local creatureFound = getThingFromPos({x=nx,y=ny,z=pos.z,stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
                        if creatureFound.uid ~= cid and isMonster(creatureFound.uid) and getCreatureName(creatureFound.uid) == "bat" and getCreatureMaster(creatureFound.uid) == cid then
                            local hp = math.ceil(getCreatureHealth(creatureFound.uid)+math.random(1,9))
                            doCreatureAddHealth(cid, hp)
                            doSendAnimatedText(pos, hp, COLOR_BLACK)
                            doSendDistanceShoot(getThingPos(creatureFound.uid), pos, CONST_ANI_DEATH)
                            doSendMagicEffect(pos, CONST_ME_MORTAREA)
                        end
                    end
                end
            end
        end
        if math.random(1, 100) <= 15 then
            for nx = (pos.x - 2), (pos.x + 2) do
                for ny = (pos.y - 2), (pos.y + 2) do
                    for i=1, 254 do
                        stackpos = i
                        local fieldFound = getThingFromPos({x = nx, y = ny, z = pos.z, stackpos = stackpos})
                        if fieldFound.uid ~= 0 and isInArray({2956,2957,2958,4298,4299,4300}, fieldFound.itemid) then
                            local poss = getThingPos(fieldFound.uid)
                            addEvent(effect, 250, {pos=poss, cid=cid, n=1, fieldFound=fieldFound})
                        end
                    end
                end
            end
        end
        if math.random(1, 100) <= 10 then 
            for nx = (pos.x - 1), (pos.x + 1) do 
                for ny = (pos.y - 1), (pos.y + 1) do 
                    for i=1, 254 do
                        stackpos = i
                        local fieldFound = getThingFromPos({x = nx, y = ny, z = pos.z, stackpos = stackpos}) 
                        for k=1, #fields do
						if isInArray(fields[k].item_id, fieldFound.itemid) then
                            doSendMagicEffect(getThingPos(fieldFound.uid), fields[k].effect)
                            doRemoveItem(fieldFound.uid)
                        end 
						end
                    end
                end 
            end 
        end 
    end
    return true
end

Malutkie b??dy mia?e?.
Poza tym nie zawsze robi transform itemu, a ja nie wiem dlaczego.

#up
Wystarczy?a p?tla.
 
Last edited:

zakius

Senior User
Joined
May 25, 2008
Messages
869
Reaction score
52
Odp: Criredric - nietypowy boss wampir?w.

dlatego zostawi?em us?/dodaj
1 m?g?by? te b??dy pokaza??
2. isSightClear jest potrzebne aby przez ?ciany nie robi?, chyba tam wy?ej zapomnia?em
 

Vergil93

Advanced User
Joined
Jun 19, 2010
Messages
263
Reaction score
6
Odp: Criredric - nietypowy boss wampir?w.

B??dem by?o nadmiar cid?w.
Da?e? lokaln?:
PHP:
local pos = getCreaturePosition(cid)
Zapominaj?c, ?e w funkcjach dalej ja mia?em jako pos nadane samo getCreaturePosition, a co za tym idzie, w dalszej cz??ci skryptu pisa?em pos(cid), a w tym przypadku musi by? samo pos.

isSightClear nie dzia?a. Zreszt? nie musi. Wystarczy odpowiednie pomieszczenie mu zrobi? i gra.
 

zakius

Senior User
Joined
May 25, 2008
Messages
869
Reaction score
52
Odp: Criredric - nietypowy boss wampir?w.

isSightClear dzia?a, przynajmniej tam gdzie jest xd
i zmieni?em na samo pos, wszystko dzia?a?o, niby pomieszczenie mo?na da? ale wtedy przez mwalle b?dzie dzia?a?
i nie chcia?em p?tli bo co to za r??nica czy w p?tli czy w drabince ale robi to samo:sprawdza bruteforcem, a tego chcia?em unikn??

Notka moderatorska:
Kontynuujcie t? wymian? zda? na pw, bo w przeciwnym razie obaj otrzymacie po warnie.
 
Last edited by a moderator:

Seylock

Active User
Joined
Oct 21, 2010
Messages
147
Reaction score
5
Odp: Criredric - nietypowy boss wampir?w.

Prooo :D Super to wszystko zrobione, to ?e wskrzesza.... :) Pro! Jeden z najlepszych monsters jakie widzia?em (chyba nawet najlepszy :p). A tak w og?le to pod jak? tibie?? :p
 
Status
Not open for further replies.
Top