What's new

Mods [mod] Metin Stone Event - pe?na automatyzacja

Status
Not open for further replies.

Oskar

Forum friend
Joined
Jan 24, 2009
Messages
2,256
Reaction score
331
Jaki? geniusz wklei? m?j skrypt na otlanda, wi?c nast?pstwem jest umieszczenie go tutaj. Przez prawdziwego autora.
Tworzymy nowego moda i wklejamy:
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Metin Stone Event" version="1.1" author="Oskar" contact="http://tibia.net.pl/members/oskar.html" enabled="no">
<config name="metinStone_conf"><![CDATA[
metinStoneStart = {
				pos_od = {x=1865,y=1123,z=13}, --lewy gorny rog
				pos_do = {x=1878,y=1131,z=13}, --prawy dolny rog
				time = 240, --pierwsze i kazde nastepne losowanie od momentu startu serwera, w minutach
				chance = 50 --szansa na wylosowanie kamulca
				}
metinArea = createCombatArea{
							{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
							{0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0},
							{0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},
							{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
							{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
							{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
							{1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1},
							{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
							{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
							{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
							{0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},
							{0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0},
							{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0}
							}
metinConfig = {
                ['fire stone'] = {
							[90] = {m = {'fire elemental','fire devil'}, n = {15, 20}},
							[80] = {m = {'fire elemental','fire devil','massive fire elemental'}, n = {16, 21}},
							[70] = {m = {'dragon','fire elemental'}, n = {17, 22}},
							[60] = {m = {'dragon','massive fire elemental','fire elemental'}, n = {18, 23}},
							[50] = {m = {'dragon','dragon lord','massive fire elemental'}, n = {19, 24}},
							[40] = {m = {'dragon lord','massive fire elemental','diabolic imp'}, n = {20, 25}},
							[30] = {m = {'diabolic imp','hellfire fighter','infernalist'}, n = {21, 26}},
							[20] = {m = {'diabolic imp','hellfire fighter','demon','infernalist'}, n = {22, 27}},
							[10] = {m = {'demon','hellfire fighter','infernalist','hellhound'}, n = {23, 28}},
							[5] = {m = {'demon','arch devil','hellhound'}, n = {24, 29}}},
                ['earth stone'] = {
							[90] = {m = {'slime','bonelord','earth elemental'}, n = {15, 20}},
							[80] = {m = {'bonelord','elder bonelord','earth elemental'}, n = {16, 21}},
							[70] = {m = {'massive earth elemental','bog raider','earth elemental'}, n = {17, 22}},
							[60] = {m = {'bog raider','medusa','wyvern'}, n = {18, 23}},
							[50] = {m = {'medusa','defiler','slime'}, n = {19, 24}},
							[40] = {m = {'medusa','serpent spawn','slime'}, n = {20, 25}},
							[30] = {m = {'serpent spawn','wyvern','defiler'}, n = {21, 26}},
							[20] = {m = {'defiler','medusa','slime'}, n = {22, 27}},
							[10] = {m = {'defiler','plaguesmith','phantasm'}, n = {23, 28}},
							[5] = {m = {'plaguesmith','defiler','abomination creature'}, n = {24, 29}}},
                ['ice stone'] = {
							[90] = {m = {'ice golem','crystal spider'}, n = {15, 20}},
							[80] = {m = {'ice golem','crystal spider','ice witch'}, n = {16, 21}},
							[70] = {m = {'crystal spider','ice witch','mammoth'}, n = {17, 22}},
							[60] = {m = {'crystal spider','frost dragon'}, n = {18, 23}},
							[50] = {m = {'crystal spider','frost dragon','ice witch'}, n = {19, 24}},
							[40] = {m = {'frost dragon','warlock'}, n = {20, 25}},
							[30] = {m = {'crystal spider','frost dragon','warlock'}, n = {21, 26}},
							[20] = {m = {'crystal spider','frost dragon','warlock','ice witch'}, n = {22, 27}},
							[10] = {m = {'frost dragon','warlock'}, n = {23, 28}},
							[5] = {m = {'frost dragon','warlock'}, n = {24, 29}}},
                }
metinCombat = {['fire stone'] = {COMBAT_FIREDAMAGE, CONST_ME_FIREAREA}, 
				['earth stone'] = {COMBAT_EARTHDAMAGE, CONST_ME_SMALLPLANTS}, 
				['ice stone'] = {COMBAT_ICEDAMAGE, CONST_ME_ICEATTACK}}
				
function getPercent(number, all)
    return (number / all) * 100
end

function choose(arg)
    return arg[math.random(#arg)]
end
 
function isWalkable(pos, creature, proj, pz)
if getTileThingByPos({x=pos.x,y=pos.y,z=pos.z,stackpos=0}).itemid == 0 then return false end
if getTopCreature(pos).uid > 0 and creature then return false end
if getTileInfo(pos).protection and pz then return false, true end
local n = not proj and 3 or 2
for i = 0, 255 do
	pos.stackpos = i
	local tile = getTileThingByPos(pos)
	if tile.itemid ~= 0 and not isCreature(tile.uid) then
		if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
			return false
		end
	end
end
return true
end

function checkPositions(fromPos, toPos, nb)
local pos = {x=math.random(fromPos.x,toPos.x), y=math.random(fromPos.y,toPos.y), z=math.random(fromPos.z,toPos.z)}
if isWalkable(pos, true, true, true) then
	return pos
end
return (nb < 50 and checkPositions(fromPos, toPos, nb+1) or false)
end

function setMetinStone(metinStoneStart, metinConfig)
local pos = checkPositions(metinStoneStart.pos_od, metinStoneStart.pos_do, 0)
if pos and math.random(100) <= metinStoneStart.chance then
	local stones = {}
	for k, _ in pairs(metinConfig) do
		table.insert(stones, k)
	end
	local stone = choose(stones)
	doBroadcastMessage(stone .. ' is summoned!')
	local mon = doCreateMonster(stone, pos, false)
	registerCreatureEvent(mon, 'metinStoneCombat')
end
return addEvent(setMetinStone, metinStoneStart.time * 60 * 1000, metinStoneStart, metinConfig)
end
]]></config>

<event type="combat" name="metinStoneCombat" event="script"><![CDATA[
domodlib('metinStone_conf')
function onCombat(cid, target)
if isMonster(target) then
	registerCreatureEvent(target, 'metinStoneCombat')
end
local t, vw = getPercent(getCreatureHealth(target), getCreatureMaxHealth(target)), metinConfig[getCreatureName(target):lower()]
if isMonster(target) and vw then
    if t > 90 then doCreatureSetStorage(target, 1000, 91) end
    for k, v in pairs(vw) do
		if k >= t and getCreatureStorage(target, 1000) > k then
            local pos = getThingPos(target)
            for i = 1, math.random(v.n[1], v.n[2]) do
                local s = {x=pos.x,y=pos.y,z=pos.z}
                s.x = pos.x + math.random(-3,3)
                s.y = pos.y + math.random(-3,3)
                doCreateMonster(choose(v.m), s, false)
            end
			doCombatAreaHealth(target, metinCombat[getCreatureName(target):lower()][1], pos, metinArea, -298, -917, metinCombat[getCreatureName(target):lower()][2])
            return doCreatureSetStorage(target, 1000, k)
        end
    end
end
return true
end
]]></event>

<globalevent name="metinStoneStart" type="start" event="script"><![CDATA[
domodlib("metinStone_conf")
function onStartup()
	return addEvent(setMetinStone, metinStoneStart.time * 60 * 1000, metinStoneStart, metinConfig)
end
]]></globalevent>

<event type="login" name="metinStoneLogin" event="buffer"><![CDATA[
	registerCreatureEvent(cid, 'metinStoneCombat')
]]></event>
</mod>
W monsters.xml dodajemy:
PHP:
<monster name="Ice Stone" file="metin/ice stone.xml"/>
<monster name="Earth Stone" file="metin/earth stone.xml"/>
<monster name="Fire Stone" file="metin/fire stone.xml"/>
A tutaj pliki potwor?w:
PHP:
<?xml version="1.0" encoding="ISO-8859-1"?>
<monster name="Ice Stone" nameDescription="Ice Stone" race="undead" experience="200000" speed="0">
   <health now="2500000" max="2500000"/>
   <look typeex="1354"/>
   <targetchange interval="5000" chance="8"/>
   <strategy attack="100" defense="0"/>
	<flags>
	  <flag attackable="1"/>
	  <flag hostile="1"/>
	  <flag convinceable="1"/>
	  <flag staticattack="0"/>
	  <flag targetdistance="1"/>
	  <flag runonhealth="0"/>
	</flags>
	<attacks>
		<attack name="ice" interval="1064" chance="45" target="1" min="-164" max="-287">
			<attribute key="shootEffect" value="ice"/>
		</attack>
		<attack name="ice" interval="1753" chance="25" target="0" radius="3" min="-365" max="-552">
			<attribute key="areaEffect" value="icearea"/>
		</attack>
	</attacks>
  <immunities>
	<immunity paralyze="1"/>
	<immunity lifedrain="1"/>
	<immunity ice="1"/>
    <immunity invisible="1"/>
  </immunities>
	<defenses armor="10" defense="30"/>
</monster>
PHP:
<?xml version="1.0" encoding="ISO-8859-1"?>
<monster name="Earth Stone" nameDescription="Earth Stone" race="undead" experience="200000" speed="0">
   <health now="2500000" max="2500000"/>
   <look typeex="1353"/>
   <targetchange interval="5000" chance="8"/>
   <strategy attack="100" defense="0"/>
	<flags>
	  <flag attackable="1"/>
	  <flag hostile="1"/>
	  <flag convinceable="1"/>
	  <flag staticattack="0"/>
	  <flag targetdistance="1"/>
	  <flag runonhealth="0"/>
	</flags>
	<attacks>
		<attack name="earth" interval="1064" chance="45" target="1" min="-164" max="-287">
			<attribute key="shootEffect" value="earth"/>
		</attack>
		<attack name="earth" interval="1753" chance="25" target="0" radius="3" min="-365" max="-552">
			<attribute key="areaEffect" value="carniphila"/>
		</attack>
	</attacks>
  <immunities>
	<immunity paralyze="1"/>
	<immunity lifedrain="1"/>
	<immunity earth="1"/>
    <immunity invisible="1"/>
  </immunities>
	<defenses armor="10" defense="30"/>
</monster>
PHP:
<?xml version="1.0" encoding="ISO-8859-1"?>
<monster name="Fire Stone" nameDescription="Fire Stone" race="undead" experience="200000" speed="0">
   <health now="2500000" max="2500000"/>
   <look typeex="1355"/>
   <targetchange interval="5000" chance="8"/>
   <strategy attack="100" defense="0"/>
	<flags>
	  <flag attackable="1"/>
	  <flag hostile="1"/>
	  <flag convinceable="1"/>
	  <flag staticattack="0"/>
	  <flag targetdistance="1"/>
	  <flag runonhealth="0"/>
	</flags>
	<attacks>
		<attack name="fire" interval="1064" chance="45" target="1" min="-164" max="-287">
			<attribute key="shootEffect" value="fire"/>
		</attack>
		<attack name="fire" interval="1753" chance="25" target="0" radius="3" min="-365" max="-552">
			<attribute key="areaEffect" value="fire"/>
		</attack>
	</attacks>
  <immunities>
	<immunity paralyze="1"/>
	<immunity lifedrain="1"/>
	<immunity fire="1"/>
    <immunity invisible="1"/>
  </immunities>
	<defenses armor="10" defense="30"/>
</monster>
Wstawiam go tylko dlatego, ?e ten kto? z otlandu nieco mnie zdenerwowa?.
 

Socha01

New User
Joined
Sep 26, 2008
Messages
8
Reaction score
0
Odp:
Notka moderatorska:
Metin Stone Event - pe?na automatyzacja

jaka nazwa pliku moda
 

HateThisSite

Advanced User
Joined
Feb 14, 2011
Messages
465
Reaction score
60
Odp:
Notka moderatorska:
Metin Stone Event - pe?na automatyzacja

Co ten skrypt robi? <leniuch>
By? publikowany przez ciebie gdzie? indziej?
Ile zaj??o Ci tworzenie go?
 

sStempels

Active User
Joined
Mar 25, 2009
Messages
61
Reaction score
2
Odp:
Notka moderatorska:
Metin Stone Event - pe?na automatyzacja

Jak by? m?g? uzupe?ni? skrypt
Notka moderatorska:
w <xml> z g?ry dzieki.
 

Oskar

Forum friend
Joined
Jan 24, 2009
Messages
2,256
Reaction score
331
Odp:
Notka moderatorska:
Metin Stone Event - pe?na automatyzacja

To akurat nie by? Metin Stone Event tylko inny, bardziej zaawansowany skrypt, ale ju? to poprawi?em i teraz macie poprawnego skrypta.
 

sStempels

Active User
Joined
Mar 25, 2009
Messages
61
Reaction score
2
Odp:
Notka moderatorska:
Metin Stone Event - pe?na automatyzacja

A jak mo?na wiedzie? do czego s?u?y? tamten 'zaawansowany skrypt'?
 

Oskar

Forum friend
Joined
Jan 24, 2009
Messages
2,256
Reaction score
331
Odp:
Notka moderatorska:
Metin Stone Event - pe?na automatyzacja

By?a wklejona tylko po?owa, wi?c i tak na nic wam on.
System set?w. Jeden z trudniejszych, kt?re uda?o mi si? napisa?.
 

Oskar1415

Advanced User
Joined
Feb 25, 2009
Messages
381
Reaction score
22
Odp:
Notka moderatorska:
Metin Stone Event - pe?na automatyzacja

Gdy Metin przywo?uje potwory s? b??dy w konsoli:

[22:0:45.153] [Error - CreatureScript Interface]
[22:0:45.154] domodlib('metinStone_conf')
[22:0:45.155] function onCombat(cid, target)
[22:0:45.156] if isMonster(target) then
[22:0:45.156] registerCreatureEvent(target, 'metinStoneCombat')
[22:0:45.157] end
[22:0:45.158] local t, vw = getPercent(getCreatureHealth(target), getCreatureMax
Health(target)), metinConfig[getCreatureName(target):lower()]
[22:0:45.159] if isMonster(target) and vw then
[22:0:45.160] if t > 90 then doCreatureSetStorage(target, 1000, 91) end
[22:0:45.161] for k, v in pairs(vw) do
[22:0:45.162] if k >= t and getCreatureStorage(target, 1000) > k then
[22:0:45.163] local pos = getThingPos(target)
[22:0:45.165] for i = 1, math.random(v.n[1], v.n[2]) do
[22:0:45.166] local s = {x=pos.x,y=pos.y,z=pos.z}
[22:0:45.167] s.x = pos.x + math.random(-3,3)
[22:0:45.168] s.y = pos.y + math.random(-3,3)
[22:0:45.168] doCreateMonster(choose(v.m), s, false)
[22:0:45.169] end
[22:0:45.170] doCombatAreaHealth(target, metinCombat[getCreatureName
(target):lower()][1], pos, metinArea, -298, -917, metinCombat[getCreatureName(ta
rget):lower()][2])
[22:0:45.172] return doCreatureSetStorage(target, 1000, k)
[22:0:45.173] end
[22:0:45.174] end
[22:0:45.174] end
[22:0:45.175] return true
[22:0:45.176] end
[22:0:45.177] :eek:nCombat
[22:0:45.178] Description:
[22:0:45.179] (luaDoCreateMonster) Cannot create monster: fire elemental
 

rafiik18

Banned
Joined
Feb 6, 2011
Messages
167
Reaction score
11
Odp:
Notka moderatorska:
Metin Stone Event - pe?na automatyzacja

Idzie zrobi? tak aby kamie? pojawia? si? w wybranych miejscach??
 

Dexon1vo

User
Joined
Aug 12, 2011
Messages
47
Reaction score
1
Odp:
Notka moderatorska:
Metin Stone Event - pe?na automatyzacja

Skopiowane z Otlanda nic nie doda?e? po co tu to da?e? -.-
 

Oskar

Forum friend
Joined
Jan 24, 2009
Messages
2,256
Reaction score
331
Odp:
Notka moderatorska:
Metin Stone Event - pe?na automatyzacja

Dlaczego? Poniewa? to m?j skrypt, a osoba, kt?ra wrzuci?a go na otland mi go ukrad?a. Poza tym ja nigdy nie kopiuj? cudzych skrypt?w tylko po to by wstawi? je na forum. To idiotyczne tak robi?.
 

avaster12

Advanced User
Joined
Jan 19, 2010
Messages
244
Reaction score
9
Odp:
Notka moderatorska:
Metin Stone Event - pe?na automatyzacja

opisz jak to dogra?
 

Tomuch

User
Joined
Nov 7, 2008
Messages
25
Reaction score
0
Odp:
Notka moderatorska:
Metin Stone Event - pe?na automatyzacja

hah... chyba troche za pozno, ale moze mi ktos powiedziec, gdzie tutaj jest cos z lootem??
jaki lot z tego :D
i kto go dostaje..
 

kskpassat

User
Joined
Sep 6, 2008
Messages
25
Reaction score
0
Odp:
Notka moderatorska:
Metin Stone Event - pe?na automatyzacja

W?a?nie, co z nagrodami?
 

tytan53

Advanced User
Joined
Dec 13, 2008
Messages
195
Reaction score
11
Odp:
Notka moderatorska:
Metin Stone Event - pe?na automatyzacja

No w?a?nie ja te? mam ten skrypt, wi?c dzi?ki Oskar ale jak by? m?g? wyt?umaczy? jak lota ustawi? i kto go dostaje to by by?o bardzo fajnie :)

Pozdrawiam.

Dami
 

Gm Zasanek

User
Joined
Dec 27, 2012
Messages
48
Reaction score
3
Odp:
Notka moderatorska:
Metin Stone Event - pe?na automatyzacja

Ja te? bym chcia? ?eby? wyt?umaczy? jak ustawi? lota i kto go dostanie.
Prosz? o szybk? odpowiedz :p
 

Gm Zasanek

User
Joined
Dec 27, 2012
Messages
48
Reaction score
3
Odp:
Notka moderatorska:
Metin Stone Event - pe?na automatyzacja

Hmmm? Wyt?umaczy kto?? :p
 

Replay3run

Advanced User
Joined
Feb 8, 2011
Messages
162
Reaction score
19
Odp:
Notka moderatorska:
Metin Stone Event - pe?na automatyzacja

wszystko zrobi?em tak jak opisane ale niestety nie dzia?a, za bardzo w tym ogarni?ty nie jestem ale wywala b??d w konsoli

Loading Metin Stone Event.xml... done, but disabled.

kto? wie co mo?e by? nie tak?

@edit

Rozwi?za?em problem.
 
Last edited:
Status
Not open for further replies.
Top