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

CreatureEvent [Monster/Talkactions] Metin Stone Event

kawon

o.O
Joined
Mar 16, 2009
Messages
555
Reaction score
29
Location
Poland
Hello :)

This is very popular Metin Stone Event :)

How this work?
1.Change place when metin stone can respawn.
2.Say /metin xxx (xxx this is name stone, np. /metin Icy Stone)

Reward change in creaturescripts/metin_kill.lua


To creaturescripts.xml add:
PHP:
<event type="death" name="metin_death" event="script" value="metin_kill.lua"/>  
<event type="combat" name="Kamulec" event="script" value="metin_stones.lua"/>

To login.lua add:
PHP:
	registerCreatureEvent(cid, "Kamulec")
	registerCreatureEvent(cid, "metin_death")

This is script (metin_kill.lua) when player kill stones then get points to sms shop:
PHP:
local config = {
    points = 5, -- how many points winner get?
    }

	local names = {'earth stone', 'icy stone', 'fire stone', 'wind stone'}

function onDeath(cid, corpse, deathList)
	if (isInArray(names, getCreatureName(cid):lower())) then
		--local mostdmg = deathList[2] ~= nil and deathList[2] or deathList[1]
		local mostdmg = isPlayer(deathList[1]) and deathList[1] or (deathList[2] ~= nil and deathList[2])
		if isPlayer(mostdmg) then
		
			db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` +" .. config.points .. " WHERE `name` = '".. getAccountByName(getCreatureName(mostdmg)) .."';")
			doPlayerSendTextMessage(mostdmg, 22, "You have killed " .. getCreatureName(cid) .. ". You won 5 points to sms shop.")
			db.executeQuery("INSERT INTO metin_wins (name, reward, reward_id, stone, date) VALUES ('" .. getCreatureName(mostdmg) .. "', '5 points', '2', '" .. getCreatureName(cid) .. "', " .. os.time() .. ")") 
		
		else
			doBroadcastMessage("No one has destroyed the stone")
		end
	end
	return TRUE
end


This is web script (gesior acc):
PHP:
<?PHP

$main_content .='<center><br><br><font color="green"><h2>Metin Stone Event</h2></font></center>';
$main_content .='<p><strong>N</strong>asz serwer został urozmaicony o system kamieni Metin. Co jakiś czas w jednym z miejsc poza miastem (przy drogach) pojawia się kamien metin o losowym żywiole. Gracz zostanie poinformowany o zrespieniu się kamienia komunikatem: <u><i> Icy Stone have been spawn. Find and defeat it!</i></u> Miejscówki na mapie w których może pojawić się kamień: </p>
<p>Zadaniem gracza jest zniszczyć kamień. Nie jest to jednak takie łatwe, kamienie summują potwory które utrudniają ci zadanie. Warto najpierw skupić się na potworach, a później dopiero na niszczeniu kamienia. Czym więcej kamień traci życia tym bardziej jest niebezpieczny. Osoba która zada najwieksze obrażenia kamieniowi otrzyma 5 premium points.</p>';


$main_content .= '<center><table width="100%"> <tr > <td width="100" align="center" bgcolor="'.$config['site']['darkborder'].'"><img src="http://noveria.pl/images/items/Mossy_Stone.gif"></td> <td  bgcolor="'.$config['site']['darkborder'].'"><strong>Earth Stone:</strong><br /><strong>HP:</strong> 200000 <br /><strong>Monsters:</strong> Carniphila, Earth Elemental, Bog Raider, Giant Spider, Hydra, Lich, Serpent Spawn, Defiler, Medusa, Lost Soul, Son of Verminor, Juggernaut <br /><strong>Special:</strong> healing, paralyze</td>  </tr>
<tr><td align="center" bgcolor="'.$config['site']['lightborder'].'"><img src="http://noveria.pl/images/items/Blue_Shrine_Stone.gif"></td><td bgcolor="'.$config['site']['lightborder'].'"><strong>Icy Stone:</strong> <br /><strong>HP:</strong> 200000 <br /><strong>Monsters:</strong> ice golem, frost dragon hatchling, crystal spider, frost dragon,  yeti<br /><strong>Special:</strong> strong healing</td> </tr>

<tr><td align="center" bgcolor="'.$config['site']['darkborder'].'"><img src="http://noveria.pl/images/items/Red_Shrine_Stone.gif"></td><td  bgcolor="'.$config['site']['darkborder'].'"><strong>Fire Stone:</strong>  <br /><strong>HP:</strong> 200000 <br /> <strong>Monsters:</strong> Fire Elemental, Dragon, 	Dragon Lord Hatchling, Dragon Lord, Diabolic Imp, Demodras, Hellfire Fighter, Hellhound, Demon <br /><strong>Special:</strong> healing</td>  </tr>
<tr><td align="center" bgcolor="'.$config['site']['lightborder'].'"><img src="http://noveria.pl/images/items/Stone_(Normal).gif"></td><td bgcolor="'.$config['site']['lightborder'].'"><strong>Wind Stone:</strong> <br /><strong>HP: </strong> 200000 <br /><strong>Monsters:</strong> Gargoyle, Stone Golem, Black Knight, Behemoth, Destroyer, Betrayed Wraith, Dark Torturer, Grim Reaper, Blightwalker, Undead Dragon<br /><strong>Special:</strong> healing</td> </tr>
</table></center>';




$metin_wins = $SQL->query('SELECT * FROM metin_wins ORDER BY date DESC LIMIT 5')->fetchAll();

$main_content .= '<center><font color="green"><h2>Last 5 Metin Stone killers</h2></font></center>';

if ($metin_wins){
	$main_content .= '<table border="0" cellspacing="1" cellpadding="4" width="100%">
	<tr bgcolor="'.$config['site']['vdarkborder'].'"">			
		<td width="10%" class="white" style="text-align: center; font-weight: bold;">#</td>

		<td width="20%" class="white" style="text-align: center; font-weight: bold;">Player</td>
		<td width="25%" class="white" style="text-align: center; font-weight: bold;">Reward</td>
		<td width="25%" class="white" style="text-align: center; font-weight: bold;">Stone</td>		
		<td wdith="25%" class="white" style="text-align: center; font-weight: bold;">Date</td>
	</tr>';
	$i = 1;
	foreach ($metin_wins as $mm){
		$file = './images/items/'.$mm['reward_id'].'.gif';
		$img = is_file($file) ? '<img src="'.$file.'" alt="'.$mm['reward'].'">' : $mm['reward'];
		$bg = (is_int($i/2)) ? $config['site']['lightborder'] : $config['site']['darkborder'];
		$main_content .= '<tr align="center" bgcolor="'.$bg.'"><td>'.$i.'</td><td><a href="?subtopic=characters&name='.$mm['name'].'">'.$mm['name'].'</a></td><td>'.$img.'</td><td>'.$mm['stone'].'</td><td>'.date('Y-m-d H:i', $mm['date']).'</td></tr>';
		$i++;
	}
	$main_content .= '</table>';
}
else{
	$main_content .= 'No one killed stone';
}


?>


SQL:

PHP:
CREATE TABLE IF NOT EXISTS `metin_wins` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(40) NOT NULL DEFAULT '',
  `reward` varchar(20) NOT NULL DEFAULT '',
  `date` bigint(20) unsigned NOT NULL,
  `reward_id` int(11) NOT NULL DEFAULT '0',
  `stone` varchar(20) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
 

Attachments

Last edited:
hi
when i summon any stone i see warning in console
[Warning - Monster::Monster] Unknown event name - metin_death
 
You add it to creaturescript/login.lua - register etc.. and to creaturescript.xml. You can see too in a monster :)
 
i add to login.lua
registerCreatureEvent(cid, Kamulec)

and to creaturescript.xml

<event type="combat" name="Kamulec" event="script" value="metin_stones.lua"/>
<event type="death" name="Kamulec" event="script" value="metin_kill.lua"/>

please help ;p

#edit
why in monsters files are
<script>
<event name="metin_death"/>
</script>
what is that ?
 
I edit first post :)

Add:
- script to web (gesior acc)
- commands to creaturescripts.xml and login.lua
- add new version with premium points (when player kill stones then get premium points to sms shop)
 
@ up

Create a new table, if you done creating table click ,,SQL" and paste:

ALTER TABLE metin_wins ADD date varchar(255) NOT NULL

All work's, thx.
 
Last edited:
Mam problem , gdzie należy dodać WEB SKRYPT ?
I have a provlem , where i must add This is web script (gesior acc): ??
 
Back
Top