Jump to content
  • 0

Monster faction


brunoshp

Question


  • Group:  Members
  • Topic Count:  64
  • Topics Per Day:  0.02
  • Content Count:  180
  • Reputation:   7
  • Joined:  12/19/12
  • Last Seen:  

i need tu change bg_monster to faction_monster

 

i change this:

	int class_ = 0, x = 0, y = 0, bg_id = 0;
	const char *str,*mapname, *evt="";

	bg_id  = script_getnum(st,2);
	mapname    = script_getstr(st,3);
	x      = script_getnum(st,4);
	y      = script_getnum(st,5);
	str    = script_getstr(st,6);
	class_ = script_getnum(st,7);
	if( script_hasdata(st,8) ) evt = script_getstr(st,8);
	check_event(st, evt);
	script_pushint(st, mob_spawn_bg(mapname,x,y,str,class_,evt,bg_id));
	return SCRIPT_CMD_SUCCESS;

to this:

	int class_ = 0, x = 0, y = 0, faction_id = 0;
	const char *str,*mapname, *evt="";

	faction_id  = script_getnum(st,2);
	mapname    = script_getstr(st,3);
	x      = script_getnum(st,4);
	y      = script_getnum(st,5);
	str    = script_getstr(st,6);
	class_ = script_getnum(st,7);
	if( script_hasdata(st,8) ) evt = script_getstr(st,8);
	check_event(st, evt);
	script_pushint(st, mob_spawn_bg2(mapname,x,y,str,class_,evt,faction_id));
	return SCRIPT_CMD_SUCCESS;

and duplicate mob_spawn_bg to mob_spawn_bg2

int mob_spawn_bg2(const char* mapname, short x, short y, const char* mobname, int mob_id, const char* event, int faction_id)
{
	struct mob_data *md = NULL;
	struct spawn_data data;
	int16 m;

	if( (m = map_mapname2mapid(mapname)) < 0 )
	{
		ShowWarning("mob_spawn_bg2: Map [%s] not found.\n", mapname);
		return 0;
	}

	memset(&data, 0, sizeof(struct spawn_data));
	data.m = m;
	data.num = 1;
	if( mob_id <= 0 )
	{
		mob_id = mob_get_random_id(-mob_id-1,1,99);
		if( !mob_id ) return 0;
	}

	data.id = mob_id;
	if( (x <= 0 || y <= 0) && !map_search_freecell(NULL, m, &x, &y, -1,-1, 1) )
	{
		ShowWarning("mob_spawn_bg2: Couldn't locate a spawn cell for guardian class %d (faction_id %d) at map %s\n",mob_id, faction_id, map[m].name);
		return 0;
	}

	data.x = x;
	data.y = y;
	safestrncpy(data.name, mobname, sizeof(data.name));
	safestrncpy(data.eventname, event, sizeof(data.eventname));
	if( !mob_parse_dataset(&data) )
		return 0;

	md = mob_spawn_dataset(&data);
	mob_spawn(md);
	md->faction_id = faction_id; // faction Team ID

	return md->bl.id;
}

and duplicate to mob_spawn_bg to mob_spawn_bg2 in mob.h

int mob_spawn_bg2(const char* mapname, int16 x, int16 y, const char* mobname, int mob_id, const char* event, int faction_id);

 i compiled dont have error, but whe summom monster  he not in faction.

this script:

gef_fild14,188,186,3	script	sdf52g4	123,{

set .@smob1, faction_monster( 1, "gef_fild14", 181, 187, "poring 1", 1830, "" ) ;
set .@smob2, faction_monster( 1, "gef_fild14", 161, 167, "poring 2", 1002, "" ) ;
unitattack .@smob1, .@smob2 ;
unitattack .@smob2, .@smob1 ;

end;


} 

can help me?

Edited by brunoshp
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...