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

System Administrator @ Hungarian Government
System Administrator @ Vibestro
Freelancer Developer @ Various projects

Link to comment
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 38
  • Dislove 1
  • Good 12
  • Love 3
  • Love 24
Link to comment
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

System Administrator @ Hungarian Government
System Administrator @ Vibestro
Freelancer Developer @ Various projects

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • 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.