Jump to content
  • 0

How to apply walk delay to Boss & MvP


iraciz

Question


  • Group:  Members
  • Topic Count:  140
  • Topics Per Day:  0.03
  • Content Count:  562
  • Reputation:   108
  • Joined:  10/05/12
  • Last Seen:  

I have found this code in unit.c  and I was wondering how to apply the delay motion to the mvp and all the other Monsters?

I want them to Not completely stop by hit lock, But at least!,  make them snipeable without reaching the player too quick.

In battle/monster.conf  the conf monster_damage_delay_rate: 100  is useless, Since it only is applied to the very first hit.
So don't give me taht answer, 

The code bellow I brought has the clue, unfortunately I don't know c+

what I understood is that, the damage delay is applied, but after that delay there is a timer that make the mobs invincible or immune to this delay, meaning that for a certain period after receiving damage, they will move under attacks towards you without stopping.

What I want to do, is make this immunity time shorter, because the longer imume to damage induced walk delay, the must cells they snap towards you.

Damage delay 200 ms, good, and after that,  100 ms ignore the damage delay, So when they are under fire they can aproach you step by step, and not by snaping 4 o 5 cells at a time, but without locking them, you got me?

can anyone help me to set that?

/**
 * Applies a walk delay to a unit
 * @param bl: Object to apply walk delay to
 * @param tick: Current tick
 * @param delay: Amount of time to set walk delay
 * @param type: Type of delay
 *	0: Damage induced delay; Do not change previous delay
 *	1: Skill induced delay; Walk delay can only be increased, not decreased
 * @return Success(1); Fail(0);
 */
int unit_set_walkdelay(struct block_list *bl, t_tick tick, t_tick delay, int type)
{
	struct unit_data *ud = unit_bl2ud(bl);

	if (delay <= 0 || !ud)
		return 0;

	if (type) {
		//Bosses can ignore skill induced walkdelay (but not damage induced)
		if(bl->type == BL_MOB && status_has_mode(status_get_status_data(bl),MD_STATUS_IMMUNE))
			return 0;
		//Make sure walk delay is not decreased
		if (DIFF_TICK(ud->canmove_tick, tick+delay) > 0)
			return 0;
	} else {
		// Don't set walk delays when already trapped.
		if (!unit_can_move(bl)) {
			unit_stop_walking(bl,4); //Unit might still be moving even though it can't move
			return 0;
		}
		//Immune to being stopped for double the flinch time
		if (DIFF_TICK(ud->canmove_tick, tick-delay) > 0)
			return 0;
	}

	ud->canmove_tick = tick + delay;

	if (ud->walktimer != INVALID_TIMER) { // Stop walking, if chasing, readjust timers.
		if (delay == 1) // Minimal delay (walk-delay) disabled. Just stop walking.
			unit_stop_walking(bl,0);
		else {
			// Resume running after can move again [Kevin]
			if(ud->state.running)
				add_timer(ud->canmove_tick, unit_resume_running, bl->id, (intptr_t)ud);
			else {
				unit_stop_walking(bl,4);

				if(ud->target)
					add_timer(ud->canmove_tick+1, unit_walktobl_sub, bl->id, ud->target);
			}
		}
	}

	return 1;
}

 

Edited by iraciz
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  140
  • Topics Per Day:  0.03
  • Content Count:  562
  • Reputation:   108
  • Joined:  10/05/12
  • Last Seen:  

Edit:

I managed to stop them a little bit changing some numbers..

        //Make sure walk delay is not decreased
        if (DIFF_TICK(ud->canmove_tick, tick+delay) > 450)

        //Immune to being stopped for double the flinch time
    if (DIFF_TICK(ud->canmove_tick, tick-delay) > 300)

I don't understand C+ but I think those are the timers for the walk delay time applied and the can move time after the delay, and it's applied in a kind of cycle.

 

I wish to make this timers tighter, Not so much walk delay and not so much imune to walk delay time.

 

In the attached video bellow you wil see, the damage move delay and the can move grace time

The whole lines in unit.c

/**
 * Applies a walk delay to a unit
 * @param bl: Object to apply walk delay to
 * @param tick: Current tick
 * @param delay: Amount of time to set walk delay
 * @param type: Type of delay
 *	0: Damage induced delay; Do not change previous delay
 *	1: Skill induced delay; Walk delay can only be increased, not decreased
 * @return Success(1); Fail(0);
 */
int unit_set_walkdelay(struct block_list *bl, t_tick tick, t_tick delay, int type)
{
	struct unit_data *ud = unit_bl2ud(bl);

	if (delay <= 1 || !ud)
		return 0;

	if (type) {
		//Bosses can ignore skill induced walkdelay (but not damage induced)
		if(bl->type == BL_MOB && status_has_mode(status_get_status_data(bl),MD_STATUS_IMMUNE))
			return 1;
		//Make sure walk delay is not decreased
		if (DIFF_TICK(ud->canmove_tick, tick+delay) > 450)
			return 1;
	} else {
		// Don't set walk delays when already trapped.
		if (!unit_can_move(bl)) {
			unit_stop_walking(bl,4); //Unit might still be moving even though it can't move
			return 0;
		}
		//Immune to being stopped for double the flinch time
	if (DIFF_TICK(ud->canmove_tick, tick-delay) > 300)
			return 0;
	}

	ud->canmove_tick = tick + delay;

	if (ud->walktimer != INVALID_TIMER) { // Stop walking, if chasing, readjust timers.
		if (delay == 100) // Minimal delay (walk-delay) disabled. Just stop walking.
			unit_stop_walking(bl,0);
		else {
			// Resume running after can move again [Kevin]
			if(ud->state.running)
				add_timer(ud->canmove_tick, unit_resume_running, bl->id, (intptr_t)ud);
			else {
				unit_stop_walking(bl,4);

				if(ud->target)
					add_timer(ud->canmove_tick+1, unit_walktobl_sub, bl->id, ud->target);
			}
		}
	}

	return 1;
}

 

Edited by iraciz
Link to comment
Share on other sites

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