Syreldar

[QUEST]Maps' minimum level check

11 posts in this topic

This quest will warp to the village whoever logins into a map which minimum level required is higher than the player's level.

This basically fixes those who abuse the Wedding Ring or the Warp Scrolls to go to maps they normally shouldn't be able to go into.

For example: if a player logins into the Grotto of Exile but his level is less than 75, he will be teleported back to his village.

The maps and the minimum levels are fully customizable.

Have fun!

quest warp_check begin
	state start begin
		when login begin
			local map_indexes = {
			-- [map_index] = minimum_level
				[91] = 75, --** Grotto of Exile 1st Floor,
				[82] = 75, --** Grotto of Exile 2nd Floor,
				[216] = 75, --** Devils Catacomb,
				[218] = 90, --** Cape Dragon Head
				[219] = 90, --** Dawn Mist Wood
				[220] = 90, --** Mount Thunder
				[221] = 90 --** Bay Black Sand
			};

			if (map_indexes[pc.get_map_index()] ~= nil and pc.get_level() < map_indexes[pc.get_map_index()]) then
				syschat("Your level is too low to stay in this map. You will be teleported back to your village.")
				warp_to_village();
			end -- if
		end -- when
	end -- state
end -- quest

 

  • Like 7
  • Thanks 1

Share this post


Link to post
Share on other sites
7 hours ago, C. Alexandru Sorin said:

better, 


when login or levelup begin

? Please..you always login into a map, levelup is useless here.

Share this post


Link to post
Share on other sites
Acum 4 ore, Syreldar a spus:

? Please..you always login into a map, levelup is useless here.

some guys have some quest with ``reborn`` ( set again lv 1) . after that they can stay in the map and can do levelup faster.

it is good to be there, maybe someone need this. by the way, Very nice work!

Share this post


Link to post
Share on other sites
20 hours ago, C. Alexandru Sorin said:

some guys have some quest with ``reborn`` ( set again lv 1) . after that they can stay in the map and can do levelup faster.

it is good to be there, maybe someone need this. by the way, Very nice work!

Levelup only triggers if the level you are is greater than the level you were before, hence is called LEVEL UP not LEVEL DOWN or ONLEVEL so levelup is still useless here. It's the reborn system that should make you re-log upon use.

Share this post


Link to post
Share on other sites
On 3/13/2019 at 10:50 AM, Syreldar said:

Levelup only triggers if the level you are is greater than the level you were before, hence is called LEVEL UP not LEVEL DOWN or ONLEVEL so levelup is still useless here. It's the reborn system that should make you re-log upon use.

 

@C. Alexandru Sorin knew what he said, once player level is resetted to 1 for example and after that he levelup to 2 the quest gets triggered and the player is warped home.

  • Confused 1

Share this post


Link to post
Share on other sites
2 hours ago, WeedHex said:

Better from c++.

When login  begin triggered every time, same for the lua local and if.

Why not from c++ directly?

Better you go and live inside c++, there is no reason to make it via c++ and also no signifiant speed improvement. Via quest you can edit easily.

Share this post


Link to post
Share on other sites
2 hours ago, WeedHex said:

Better from c++.

When login  begin triggered every time, same for the lua local and if.

Why not from c++ directly?

Sure, let's write each and every quest/dungeon/function directly inside the source. It will be fun i bet.

 

😂

  • Haha 2

Share this post


Link to post
Share on other sites
8 hours ago, WeedHex said:

Why not from c++ directly?

Not everything should be written in source, but here's a method. (2 years ago - i posted it in another forum)

//@Src/Server/game/src/input_login.cpp
// Add to the beginning of the file:
inline bool AllowedToWarp(const DWORD dwMapIndex, const DWORD dwLevel)
{
	struct set_struct
	{
		const unsigned short map_index;
		const unsigned short minimum_level;
	}
	set_fields[] =
	{
		{ 91, 75 },  // Grotto of Exile 1st Floor
		{ 82, 75 },  // Grotto of Exile 2nd Floor
		{ 216, 75 }, // Devils Catacomb
		{ 218, 90 }, // Cape Dragon Head
		{ 219, 90 }, // Dawn Mist Wood
		{ 220, 90 }, // Mount Thunder
		{ 221, 90 }  // Bay Black Sand
	};
	
	for (unsigned short i = 0; i < _countof(set_fields); ++i)
	{
		if (dwMapIndex == set_fields[i].map_index && dwLevel < set_fields[i].minimum_level)
			return false;
    }
	
	return true;
}
//1.) Search for:
	ch->SendGreetMessage();
//2.) Add after:
	if (!AllowedToWarp(ch->GetMapIndex(), ch->GetLevel()))
		ch->GoHome();
  • Like 2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.