Jump to content

thairoinfo

Members
  • Content Count

    2
  • Joined

  • Last visited

Posts posted by thairoinfo


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

     

    
    
    /**
     * 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);
    }
    

     

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.