Jump to content

How to guild war map NPC fixing?


Recommended Posts

I want to fix npc to guild war arena. 

 

/map/metin2_map_t3 what I do this way is not working.

how can I do it?

 

edit:

war_map.cpp in my source kod;

CHARACTER_MANAGER::instance().SpawnMob(20375, GetMapIndex(), 130, 99, 2, false, -1, true);

Syserr

SpawnMob: cannot create monster at non-exist sectree 130 x 99
Edited by kaJaMrSimple
Link to comment
Share on other sites

  • Premium

Syserr is self explanatory, 130,99 are not valid coordinates, because you are passing local coords to the function while:

LPSECTREE SECTREE_MANAGER::Get(DWORD dwIndex, DWORD x, DWORD y)
{
	SECTREEID id;
	id.coord.x = x / SECTREE_SIZE;
	id.coord.y = y / SECTREE_SIZE;
	return Get(dwIndex, id.package);
}

you can see it goes to divide the cords with the sectree_size

 

Also, we can check, for example, do_mob_ld where it uses SpawnMob and:

	CHARACTER_MANAGER::instance().SpawnMob(vnum, 
		ch->GetMapIndex(),
		x*100, 
		y*100, 
		ch->GetZ(),
		pkMob->m_table.bType == CHAR_TYPE_STONE,
		dir);

So, to be sure, recalculate the coords doing /warp charactername.

Link to comment
Share on other sites

56 minutes ago, xXIntelXx said:

Syserr is self explanatory, 130,99 are not valid coordinates, because you are passing local coords to the function while:



LPSECTREE SECTREE_MANAGER::Get(DWORD dwIndex, DWORD x, DWORD y)
{
	SECTREEID id;
	id.coord.x = x / SECTREE_SIZE;
	id.coord.y = y / SECTREE_SIZE;
	return Get(dwIndex, id.package);
}

you can see it goes to divide the cords with the sectree_size

 

Also, we can check, for example, do_mob_ld where it uses SpawnMob and:



	CHARACTER_MANAGER::instance().SpawnMob(vnum, 
		ch->GetMapIndex(),
		x*100, 
		y*100, 
		ch->GetZ(),
		pkMob->m_table.bType == CHAR_TYPE_STONE,
		dir);

So, to be sure, recalculate the coords doing /warp charactername.

 

quest warp begin
	state start begin
		when letter with pc.is_gm() begin
			send_letter("GM: Warp")
		end
		when button or info with pc.is_gm() begin
			setskin(0)
			send_letter("GM: Warp")
			syschat(pc.get_map_index().."-"..pc.get_x().."-"..pc.get_y().."-"..pc.get_local_x().."-"..pc.get_local_y())
		end
	end
end

I have a quest like this. but not working in guild warp map. I can't find coords. 
but I can spawn mob like this

regen_in_map(pc . get_map_index ( ), "locale/turkey/map/metin2_map_t3/cit.txt")

I want mobs (20375) to spawn every time a war starts. I have a countdown feature. When the time is up, the mobs on the map purge all and the war begins.

Edited by kaJaMrSimple
Link to comment
Share on other sites

  • Premium

yeah but you said you spawn it from sources:

CHARACTER_MANAGER::instance().SpawnMob(20375, GetMapIndex(), 130, 99, 2, false, -1, true);

now, I don't know if the coords are random or not, but if they are not, just go into the map, and get the coords with the warp command warping to yourself.

Otherwise, in a quest, mob_spawn uses global coords, dungeon_spawn_mob uses local coords

Link to comment
Share on other sites

3 minutes ago, xXIntelXx said:

evet ama onu kaynaklardan çıkardığını söyledin:


       

şimdi, koordinatların rastgele olup olmadığını bilmiyorum, ama değilse, sadece haritaya gidin ve warp komutunun kendinize çarptığı koordinatları alın.

Aksi takdirde, bir görevde mob_spawn küresel koordinatları kullanır, dungeon_spawn_mob yerel koordinatları kullanır

Okayyy I understand. I find global coords. I'll try now. I'll tell the result

Link to comment
Share on other sites

  • Premium
2 minutes ago, kaJaMrSimple said:

Okayyy I understand. I find global coords. I'll try now. I'll tell the result

usually you could just add *100

 

also my bad, mob_spawn (lua) uses local coords (no sleep vision problems lol)

Edited by xXIntelXx
Link to comment
Share on other sites

31 minutes ago, xXIntelXx said:

usually you could just add *100

 

also my bad, mob_spawn (lua) uses local coords (no sleep vision problems lol)

Dec 19 19:29:18 :: SpawnMob: cannot create monster at non-exist sectree 450 x 99 (map 1100001)

 

Same syserr although I give global coords. (130x99 is local, 450x99 global coords)

 

mob_spawn (lua) is useless for me. but I want mobs (20375) to spawn every time a war starts. I have a countdown feature. When the time is up, the mobs on the map purge all and the war begins.

 

If I do it with lua, won't it spawn mobs again when the new player enters after the battle has started (i.e. after purge all)? This is a situation I don't want.

Link to comment
Share on other sites

  • Premium

wait, how 130x99 are local and 450*99 are global? No way my dude ahah

130x99 are the coords u see in the minimap I suppose. Just add *100 + the basecoords of the map at those coords. Let's say the map has coordinates 153600*1203200

 

CHARACTER_MANAGER::instance().SpawnMob(20375, GetMapIndex(), 130*100 + 153600 , 99*100 + 1203200, 2, false, -1, true);
/*
130 = local_x
*100 = "global"
153600 = base_x of the map, the one in Settings.txt

99 = local_y
*100 = "global"
1203200 = base_y of the map, the one in Settings.txt
*/

which basically are the coordinates when you do /warp

Edited by xXIntelXx
I definitely need some sleep
  • Love 1
Link to comment
Share on other sites

43 minutes ago, xXIntelXx said:

wait, how 130x99 are local and 450*99 are global? No way my dude ahah

130x99 are the coords u see in the minimap I suppose. Just add *100 + the basecoords of the map at those coords. Let's say the map has coordinates 153600*1203200

 


CHARACTER_MANAGER::instance().SpawnMob(20375, GetMapIndex(), 130*100 + 153600 , 99*100 + 1203200, 2, false, -1, true);
/*
130 = local_x
*100 = "global"
153600 = base_x of the map, the one in Settings.txt

99 = local_x
*100 = "global"
1203200 = base_y of the map, the one in Settings.txt
*/

which basically are the coordinates when you do /warp

 

Yeahh its work! but there is a small problem. 2 of them come from this and although the z coord is 2 it is not like 2

 

spacer.png

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • Premium
1 hour ago, kaJaMrSimple said:

 

Yeahh its work! but there is a small problem. 2 of them come from this and although the z coord is 2 it is not like 2

 

spacer.png

probably 2 is too low of a number but I have no idea why that thing would go up in the air ahah

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • 3 weeks later...

I specify the z coordinate as 2, it reacts as if the coordinate is random.

my code;

    CHARACTER_MANAGER::instance().SpawnMob(20387, GetMapIndex(), 135 * 100 + 32000, 104  * 100 + 0, 2, false, -1, true);

 

I want to set the direction of mob.

 

What should I do?

Edited by kaJaMrSimple
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Similar Content

  • Activity

    1. 24

      Experimental Renderer

    2. 11

      Multi Language System

    3. 0

      [FREE DESIGN] Interface + Logo + Discord Banner and Avatar

    4. 4

      Feeding game source to LLM

    5. 0

      Quest 6/7 Problem

    6. 5

      Effect weapons

    7. 0

      [C++] Fix Core Downer Using Negative Number in GM Codes

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • 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.