Jump to content

Stone spawning


Go to solution Solved by VegaS™,

Recommended Posts

Hi,

I want to make a feature that spawns another metin stone on killing a metin stone (example: you kill a lv5 stone, and with 5% chance it spawns another instantly). In which functions to start?

Thanks

  • Metin2 Dev 1
  • Love 1

🖥️ SysAdmin — Government (HU)
🛠️ Freelance Metin2 Dev • DevOps
🐧 FreeBSD / Linux | 🛡️ Security & WAF | 🚀 Performance | 🔥 Firewalls | ⚙ Automation
Open to work - Contact me on Discord @matteo_r

Link to comment
https://metin2.dev/topic/27740-stone-spawning/
Share on other sites

  • Forum Moderator
  • Solution

I didn't test it, let me know if it works.

There are other solutions as well, with resurrection vnum, but you need a custom function since you want it with a spawn chance.

Srcs/Server/game/src/char_battle.cpp

This is the hidden content, please

Edited by VegaS™
  • Metin2 Dev 58
  • Eyes 1
  • Dislove 1
  • Good 18
  • muscle 1
  • Love 3
  • Love 41
Link to comment
https://metin2.dev/topic/27740-stone-spawning/#findComment-142119
Share on other sites

23 hours ago, VegaS™ said:

I didn't test it, let me know if it works.

There are other solutions as well, with resurrection vnum, but you need a custom function since you want it with a spawn chance.

Srcs/Server/game/src/char_battle.cpp

void CHARACTER::Dead(LPCHARACTER pkKiller, bool bImmediateDead)
{
	[...]
	// At the end of the function
	if (pkKiller && pkKiller->IsPC() && IsStone())
	{
		static const auto SPAWN_STONE_LIST = {
			8001,
			8002,
			8003,
		};
		
		if (std::find(SPAWN_STONE_LIST.begin(), SPAWN_STONE_LIST.end(), GetRaceNum()) != SPAWN_STONE_LIST.end())
		{
			static const auto SPAWN_STONE_PCT = 100;
			if (number(1, 100) <= SPAWN_STONE_PCT)
			{
				static auto& character_manager = CHARACTER_MANAGER::instance();
				character_manager.SpawnMob(GetRaceNum(), GetMapIndex(), GetX(), GetY(), GetZ(), true, static_cast<int>(GetRotation()), true);
				if (test_server)
					pkKiller->ChatPacket(CHAT_TYPE_INFO, "SpawnMob: name(%s), x(%ld), y(%ld), z(%ld)", GetName(), GetX(), GetY(), GetZ());
			}
		}
	}
}

 

It works perfectly thank you @VegaS™❤

  • Good 1

🖥️ SysAdmin — Government (HU)
🛠️ Freelance Metin2 Dev • DevOps
🐧 FreeBSD / Linux | 🛡️ Security & WAF | 🚀 Performance | 🔥 Firewalls | ⚙ Automation
Open to work - Contact me on Discord @matteo_r

Link to comment
https://metin2.dev/topic/27740-stone-spawning/#findComment-142175
Share on other sites

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.