Jump to content

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
https://metin2.dev/topic/25124-how-to-guild-war-map-npc-fixing/
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.

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

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

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

  • 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
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
  • 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
  • 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
  • 3 years later...
Quote

 

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

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

 

0: North (up)

90: East (right)

180: South (down)

270: West (left)

45: North-East

135: South-East

225: South-West

315: North-West

  • Honorable Member

This could also be useful resource.

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

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.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.