• 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!

Lua Metin Stones repair script

Bufo

-.-'
Joined
Jul 30, 2010
Messages
134
Reaction score
12
Location
P(R)OLAND
Hello I need some help.

Metin stones every x hours in map create monster look like stone and this monster don't attack and doing everything:
This is example Earth Stone:
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Earth Stone" nameDescription="a Earth Stone" race="blood" experience="5000000" speed="0" manacost="33000">
	<health now="1000000" max="1000000"/>
	<look typeex="1353" corpse="0"/>
	<targetchange interval="2000" chance="0"/>
	<strategy attack="0" defense="0"/>
	<flags>
<flag summonable="0"/>
<flag attackable="1"/>
<flag hostile="1"/>
<flag illusionable="0"/>
<flag convinceable="0"/>
<flag pushable="0"/>
<flag canpushitems="1"/>
<flag canpushcreatures="0"/>
<flag targetdistance="0"/>
<flag staticattack="0"/>
<flag runonhealth="550"/>
	</flags>
    <defenses name="healing" interval="4000" chance="11" min="580" max="1100">
      <attribute key="areaEffect" value="greenshimmer"/>
    </defenses>
	<elements>
     <element deathPercent="30"/>
     <element physicalPercent="30"/>
     <element holyPercent="40"/>
     <element firePercent="-15"/>
	</elements>
</monster>

There are 4 different stones and every x hours in map create 1 random stone:
Globalevents.xml:
PHP:
<globalevent name="stone" interval="x" event="script" value="stone.lua"/>

Stone.lua:
PHP:
config = {
		[1] = {x=1100, y=1012, z=6},
		[2] = {x=1100, y=1012, z=6},
		[3] = {x=1100, y=1012, z=6},
		[4] = {x=1100, y=1012, z=6},
		
		1 = "Earth Stone",
 		2 = "Icy Stone",
		3 = "Fire Stone",
		4 = "Wind Stone"
    }

function onThink(interval)
	rand = math.random(4)
		if rand == 1 then
			doCreateMonster(config.1,config[1])
			doBroadcastMessage('[Event Stones]\n '.. config.1 ..' have been spawn. Find and defeat it!', 22)
		end
		if rand == 2 then
			doCreateMonster(config.2,config[2])
			doBroadcastMessage("[Event Stones]\n ".. config.2 .." have been spawn. Find and defeat it!", 22)
		end
		if rand == 3 then
			doCreateMonster(config.3,config[3])
			doBroadcastMessage("[Event Stones]\n ".. config.3 .." have been spawn. Find and defeat it!", 22)
		end
		if rand == 4 then
			doCreateMonster(config.4,config[4])
			doBroadcastMessage("[Event Stones]\n ".. config.4 .." have been spawn. Find and defeat it!", 22)
		end
end

Can you repair globaleventscript becouse don't work ; /

Code:
[29/06/2011 10:39:45] [Error - LuaScriptInterface::loadFile] data/globalevents/scripts/stone.lua:7: '}' expected (to close '{' at line 1) near '='
[29/06/2011 10:39:45] [Warning - Event::loadScript] Cannot load script (data/globalevents/scripts/stone.lua)
[29/06/2011 10:39:45] data/globalevents/scripts/stone.lua:7: '}' expected (to close '{' at line 1) near '='

And if you have a time can you add function if player attack stone around stone create monster:
Code:
90% - 3x Hydra, 5x Bog Raider, 3x Plaguesmith.
70% - 3x Defiler, 2x Hellhound, 3x Plaguesmith, 4x Medusa.
50% - 3x Hellhound, 1x Azerus, 1x Defiler, 3x Plaguesmith, 2x Phantasm.
40% - 3x Massacre, 1x Azerus.
20% - 3x Juggernaut, 2x Azerus, 2x Defiler, 1x Hellhound.
5% - 3x Juggernaut, 2x Azerus, 2x Defiler, 4x Hellhound, 3x Plaguesmith, 2x Phantasm.

And player who set the most damage on the stone win random reward.

I am thanking in advance.
 
Last edited:
PHP:
config = {
        [1] = {name="Earth Stone", pos={x=1100, y=1012, z=6}},
        [2] = {name="Icy Stone", pos={x=1100, y=1012, z=6}},
        [3] = {name="Fire Stone", pos={x=1100, y=1012, z=6}},
        [4] = {name="Wind Stone", pos={x=1100, y=1012, z=6}},
}

function onThink(interval)
    local monst = config[math.random(1, #config)]
	if not(monst) then return TRUE end
	doCreateMonster(monst.name,monst.pos)
	doBroadcastMessage('[Event Stones]\n '.. monst.name ..' have been spawn. Find and defeat it!', 22)
	return TRUE
end

You can not declare the variables as numbers or variable names begin with the numbers.
 
And If you have time can you create for me second part request:

Can you add function if player attack stone around stone create monster:
Code:
90% - 3x Hydra, 5x Bog Raider, 3x Plaguesmith.
70% - 3x Defiler, 2x Hellhound, 3x Plaguesmith, 4x Medusa.
50% - 3x Hellhound, 1x Azerus, 1x Defiler, 3x Plaguesmith, 2x Phantasm.
40% - 3x Massacre, 1x Azerus.
20% - 3x Juggernaut, 2x Azerus, 2x Defiler, 1x Hellhound.
5% - 3x Juggernaut, 2x Azerus, 2x Defiler, 4x Hellhound, 3x Plaguesmith, 2x Phantasm.

And player who set the most damage on the stone win random reward.

I am thanking in advance.
 
no.
ZOMBIE INFECTION - Zombie event - NEW version, bug free, updated - fail
GOOD TIMES - Guild Extra Experience Time [by Summ] - fail
CASTLE WAR - [Talkactions,Globalevents,Lib,Monsters] Castle War System + Maps!!! - fail
 
Use standart summons in monsters:
PHP:
<summons maxSummons="2">
        <summon name="fire elemental" interval="2000" chance="10" max="2"/>
</summons>
 
Nie sprawdzałem, ale możesz spróbować (na szybko pisane):
PHP:
config = {
    ["MetinStone"] = {
        -- [percent] = {monster names}
        [10] = {"Monster Boss", "Monster", "Monster"},
        [20] = {"Monster Boss II", "Monster Elite II", "Monster II"}
    }
}

function onAttack(cid, target)
    local data = config[getCreatureName(target)] or nil
    if (data and data ~= nil) then
        local masterpos = getThingPosition(target)
        for percent, monsters in pairs(data) do
            if (math.random(0, 100) < percent) then
                for i = 0, #monsters do
                    doCreateMonster(monsters[i], masterpos)
                end
            end
        end
    end
    return true
end
 
No powiem Ci ładnie ale niestety nie działa ; s W konsoli 0 błędów w tibii 0 potworków ; s
PHP:
config = {
    ["Wind Stone"] = {
        -- [percent] = {monster names}
		[90] = {"Behemoth", "Behemoth", "Behemoth", "Behemoth", "Behemoth", "Behemoth", "Ghastly Dragon", "Undead Dragon", "Undead Dragon"},
		[70] = {"Ghastly Dragon", "Ghastly Dragon", "Ghastly Dragon", "Hand of Darkness", "Undead Dragon"},
		[5] = {"Apocalypse", "Ghazbaran", "Hand of Darkness", "Hand of Darkness", "Ghastly Dragon"}
    }
}

function onAttack(cid, target)
    local data = config[getCreatureName(target)] or nil
    if (data and data ~= nil) then
        local masterpos = getThingPosition(target)
        for percent, monsters in pairs(data) do
            if (math.random(0, 100) < percent) then
                for i = 0, #monsters do
                    doCreateMonster(monsters[i], masterpos)
                end
            end
        end
    end
    return true
end

PHP:
<event type="attack" name="MetinStone" event="script" value="metin_stone.lua"/>

PHP:
	registerCreatureEvent(cid, "MetinStone")

I niestety 0 reakcji ; /
 
add <script>
<event name="MetinFire"/>
</script>

and then create a onThink (creaturescript and name is MetinFire (in creaturescripts.xml)
and in the file then add the spawning.
If getCreatureHealth(cid) <= getCreatureMaxHealth(cid)*0.5 then -- if 50% bla bla
doSpawnShit(blabla)

and so on..
 
Back
Top