tomb delay after mvp death

thairoinfo

New member
Messages
2
Points
0
so I want Tombs will be spawned after mvp died in 2-5 seconds

do you guys have any suggestions

thank you

 
Can i ask why ?
default_ohmy.png


Anyway, you need to add a timer on the function that spawn the tomb there is nothing more to say
default_smile.png


Note: You can also change your MvP to be "script spawned" and deal with the tomb in a customized way. But the source edit seems easier and faster
default_smile.png


 
Note: I have no idea if this will work, because of the st struct.

src/map/npc.c:

Code:
// MvP tomb [GreenBox]
void run_tomb(struct map_session_data* sd, struct npc_data* nd) {
    char buffer[200];
    char time[10];
 
    nullpo_retv(nd);
    strftime(time, sizeof(time), "%H:%M", localtime(&nd->u.tomb.kill_time));
 
    // TODO: Find exact color?
    snprintf(buffer, sizeof(buffer), msg_sd(sd,857), nd->u.tomb.md->db->name); // "[ ^EE0000%s^000000 ]"
    clif->scriptmes(sd, nd->bl.id, buffer);
 
    clif->scriptmes(sd, nd->bl.id, msg_sd(sd,858)); // "Has met its demise"
 
    snprintf(buffer, sizeof(buffer), msg_sd(sd,859), time); // "Time of death : ^EE0000%s^000000"
    clif->scriptmes(sd, nd->bl.id, buffer);
 
    clif->scriptmes(sd, nd->bl.id, msg_sd(sd,860)); // "Defeated by"
 
    snprintf(buffer, sizeof(buffer), msg_sd(sd,861), nd->u.tomb.killer_name[0] ? nd->u.tomb.killer_name : msg_sd(sd,15)); // "[^EE0000%s^000000]" / "Unknown"
    clif->scriptmes(sd, nd->bl.id, buffer);
 
    clif->scriptclose(sd, nd->bl.id);
To:
Code:
// MvP tomb [GreenBox]
void run_tomb(struct map_session_data* sd, struct npc_data* nd) {
	char buffer[200];
	char time[10];

	nullpo_retv(nd);
	strftime(time, sizeof(time), "%H:%M", localtime(&nd->u.tomb.kill_time));

	st->state = RERUNLINE;
	st->sleep.tick = 5000;

	// TODO: Find exact color?
	snprintf(buffer, sizeof(buffer), msg_sd(sd,857), nd->u.tomb.md->db->name); // "[ ^EE0000%s^000000 ]"
	clif->scriptmes(sd, nd->bl.id, buffer);

	clif->scriptmes(sd, nd->bl.id, msg_sd(sd,858)); // "Has met its demise"

	snprintf(buffer, sizeof(buffer), msg_sd(sd,859), time); // "Time of death : ^EE0000%s^000000"
	clif->scriptmes(sd, nd->bl.id, buffer);

	clif->scriptmes(sd, nd->bl.id, msg_sd(sd,860)); // "Defeated by"

	snprintf(buffer, sizeof(buffer), msg_sd(sd,861), nd->u.tomb.killer_name[0] ? nd->u.tomb.killer_name : msg_sd(sd,15)); // "[^EE0000%s^000000]" / "Unknown"
	clif->scriptmes(sd, nd->bl.id, buffer);

	clif->scriptclose(sd, nd->bl.id);
}
 
Last edited by a moderator:
tomb is spawned too fast that may issues when player picks an item

I found this source in rathena's git

but i don't know how to adapt into Herc one

Code:
/**
 * Tomb spawn time calculations
 * @param nd: NPC data
 */
int mvptomb_setdelayspawn(struct npc_data *nd) {
	if (nd->u.tomb.spawn_timer != INVALID_TIMER)
		delete_timer(nd->u.tomb.spawn_timer, mvptomb_delayspawn);
	nd->u.tomb.spawn_timer = add_timer(gettick() + battle_config.mvp_tomb_delay, mvptomb_delayspawn, nd->bl.id, 0);
	return 0;
}

/**
 * Tomb spawn with delay (timer function)
 * @param tid: Timer ID
 * @param tick: Time
 * @param id: Block list ID
 * @param data: Used for add_timer_func_list
 */
int mvptomb_delayspawn(int tid, unsigned int tick, int id, intptr_t data) {
	struct npc_data *nd = BL_CAST(BL_NPC, map_id2bl(id));

	if (nd) {
		if (nd->u.tomb.spawn_timer != tid) {
			ShowError("mvptomb_delayspawn: Timer mismatch: %d != %d\n", tid, nd->u.tomb.spawn_timer);
			return 0;
		}
		nd->u.tomb.spawn_timer = INVALID_TIMER;
		clif_spawn(&nd->bl);
	}
	return 0;
}

/**
 * Create and display a tombstone on the map
 * @param md: the mob to create a tombstone for
 * @param killer: name of player who killed the mob
 * @param time: time of mob's death
 * @author [GreenBox]
 */
void mvptomb_create(struct mob_data *md, char *killer, time_t time)
{
	struct npc_data *nd;

	if ( md->tomb_nid )
		mvptomb_destroy(md);

	CREATE(nd, struct npc_data, 1);

	nd->bl.id = md->tomb_nid = npc_get_new_npc_id();

	nd->ud.dir = md->ud.dir;
	nd->bl.m = md->bl.m;
	nd->bl.x = md->bl.x;
	nd->bl.y = md->bl.y;
	nd->bl.type = BL_NPC;

	safestrncpy(nd->name, msg_txt(NULL,656), sizeof(nd->name));

	nd->class_ = 565;
	nd->speed = 200;
	nd->subtype = NPCTYPE_TOMB;

	nd->u.tomb.md = md;
	nd->u.tomb.kill_time = time;
	nd->u.tomb.spawn_timer = INVALID_TIMER;

	if (killer)
		safestrncpy(nd->u.tomb.killer_name, killer, NAME_LENGTH);
	else
		nd->u.tomb.killer_name[0] = '\0';

	map_addnpc(nd->bl.m, nd);
	if(map_addblock(&nd->bl))
		return;
	status_set_viewdata(&nd->bl, nd->class_);
	status_change_init(&nd->bl);
	unit_dataset(&nd->bl);

	mvptomb_setdelayspawn(nd);
}
 
Back
Top