• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[mod] metin stone system 100 % automatic !!!

kowal2443

New Member
Joined
Jun 13, 2011
Messages
6
Reaction score
2
Hello, i make for You 100 % automatic Metin stone sytem, No have BUG.
TESTED ON TFS 0.4 rev 3884
Please Comment

MOD:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Metin Stone Event" version="1.1" author="Damkow" contact="[email protected]" enabled="on">
<config name="metinStone_conf"><![CDATA[
metinStoneStart = {
				pos_od = {x=32369,y=32165,z=7}, --lewy gorny rog
				pos_do = {x=32369,y=32165,z=7}, --prawy dolny rog
				time = 360, --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)
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 checkPositions(fromPos, toPos)
end

function setMetinStone(metinStoneStart, metinConfig)
local pos = checkPositions(metinStoneStart.pos_od, metinStoneStart.pos_do)
if pos and math.random(100) <= metinStoneStart.chance then
	local stones = {}
	for k, _ in pairs(metinConfig) do
		table.insert(stones, k)
	end
	local stone = stones[math.random(#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>


Monster.xml
Code:
<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"/>

Monster/metin/:
Create ice stone.xml
Code:
<?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>
	<script>
        <event name="metinStoneCombat"/>
    </script>
	<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>


Monster/metin/:
Create fire stone.xml
Code:
<?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>
	<script>
        <event name="metinStoneCombat"/>
    </script>
	<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>

Monster/metin/
Create earth stone.xml

Code:
<?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>
	<script>
        <event name="metinStoneCombat"/>
    </script>
	<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 SCRIPT

Code:
<?php

$main_content .= '
<img src="http://xenoria.eu/ssy/metin.png"
<font size="3"><center><h2><b><font color="darkred">Stone Events/Kamien Events</b></h2></center><br>

<center><b><font size="3 color="orange">Uwaga</font></b> <br><b><font color="gray">Co 4 godziny (od startu serwera) pojawiac sie bedzie komunikat:</font> <font color="green"></font></b><br><br><br>
<b><font size="3 color="red">"[Nazwa Kamienia] is summoned!".</font></b><br>
<b><font size="3 color="red">Kamien respi sie w losowym ustalonym miejscu na mapie (screen nizej).</font></b><br>
<b><font size="3 color="red">nteligetnie respi potwory ( nie mozna ich zlurowac, sa posluszne kamieniowi ) ktore chronia go przed atakujacymi.</font></b><br>
<b><font size="3 color="red">Sam kamien nie jest grozny, lecz gdy traci hp staje sie coraz silniejszy ze swoimi slugami.</font></b><br>
<b><font size="3 color="red">Atakujacy powinni pamietac, ze jedyny sposob zniszczenia kamienia jest jako pierwsze zabijanie jego summonow.</font></b><br>
<br><br>
<b><font size="3 color="red">Miejsce w ktorym losowo respiony jest kamien: NORTH GATE THAIS</font></b><br></font>
<img src="http://xenoria.eu/ssy/metin3.bmp" WIDTH=540 HEIGHT=540>
<b><font size="3 color="red">Opis Kamieni:</font></b><br></font>
<img src="http://xenoria.eu/ssy/metin2.bmp" WIDTH=540 HEIGHT=540>
<BR><BR>
';
?>


Sorry for my english.
My english is bad.
im is Polish Members.
Thanks For ALL :)
 
Sam kamien nie jest grozny, lecz gdy traci hp staje sie coraz silniejszy ze swoimi slugami.

summony tez sa coraz silniejsze?
..
summons are also getting stronger?
 
Here is good script:
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="yes">
<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>

And delete from monsters files:
PHP:
	<script>
        <event name="metinStoneCombat"/>
    </script>
 
I would like to know more about this script :) What does it do exactly?
 
pomocy!!! HELP!!!!

Działa ale jak atakuje to nie pokazuja się potwory.

Mam komunikat "mod załadowany poprawnie ale wyłączony"
 
Last edited:
Back
Top