Jump to content
  • Join-Us

    https://metin2.dev is the 1st international community on Metin2 development. Join us to develop your skills and share your knowledge with the community, respectful and ethical forum.

  • 0

Stone spawning


Minton

Question

2 answers to this question

Recommended Posts

  • 0
  • Moderator

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 8
  • Love 3
  • Love 2
  • Good 5
  • Dislove 1
Link to comment
Share on other sites

  • 0
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
Link to comment
Share on other sites

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.