Jump to content
  • 0

Doubts about adapting the Eff_Freeze limit.


Youness

Question


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  28
  • Reputation:   0
  • Joined:  10/13/17
  • Last Seen:  

Hello, I want to adapt this code in rAthena src (pc.c). Could anyone help me, please (?) Thank you.

 I just want to edit Eff_Freeze limit in 80%

Here's the custom edit.
 

 if ((effect[i].rate >= 8000) && (effect[i].id == 1))
          effect[i].rate = 8000;
     


Here's the exact part in pc.c in rAthena Emu.
 

	if (effect.size() == MAX_PC_BONUS) {
		ShowWarning("pc_bonus_addeff: Reached max (%d) number of add effects per character!\n", MAX_PC_BONUS);
		return;
	}

	if (!(flag&(ATF_SHORT | ATF_LONG)))
		flag |= ATF_SHORT | ATF_LONG; //Default range: both
	if (!(flag&(ATF_TARGET | ATF_SELF)))
		flag |= ATF_TARGET; //Default target: enemy.
	if (!(flag&(ATF_WEAPON | ATF_MAGIC | ATF_MISC)))
		flag |= ATF_WEAPON; //Default type: weapon.

	if (!duration)
		duration = (unsigned int)skill_get_time2(status_sc2skill(sc), 7);

	for (auto &it : effect) {
		if (it.sc == sc && it.flag == flag) {
			it.rate = cap_value(it.rate + rate, -10000, 10000);
			it.arrow_rate += arrow_rate;
			it.duration = umax(it.duration, duration);
			return;
		}
	}

	struct s_addeffect entry = {};

	if (rate < -10000 || rate > 10000)
		ShowWarning("pc_bonus_addeff: Item bonus rate %d exceeds -10000~10000 range, capping.\n", rate);

	entry.sc = sc;
	entry.rate = cap_value(rate, -10000, 10000);
	entry.arrow_rate = arrow_rate;
	entry.flag = flag;
	entry.duration = duration;

	effect.push_back(entry);
}

 

Thanks again.

Edited by Youness
Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   76
  • Joined:  06/13/13
  • Last Seen:  

you need to edit 2 place in that place the first one for when entry is edited, the second one is when new entry created, capped into 8000 (80%) for SC_FREEZE, better use SC_FREEZE instead 1 for comparison, so it will human readable

	for (auto &it : effect) {
		if (it.sc == sc && it.flag == flag) {
			if (sc == SC_FREEZE)
				it.rate = cap_value(it.rate + rate, -10000, 8000);
			else
				it.rate = cap_value(it.rate + rate, -10000, 10000);
			it.arrow_rate += arrow_rate;
			it.duration = umax(it.duration, duration);
			return;
		}
	}
	struct s_addeffect entry = {};

	if (rate < -10000 || rate > 10000)
		ShowWarning("pc_bonus_addeff: Item bonus rate %d exceeds -10000~10000 range, capping.\n", rate);

	entry.sc = sc;
	if (sc == SC_FREEZE)
		entry.rate = cap_value(rate, -10000, 8000);
	else
		entry.rate = cap_value(rate, -10000, 10000);
	entry.arrow_rate = arrow_rate;
	entry.flag = flag;
	entry.duration = duration;

	effect.push_back(entry);

 

  • Upvote 1
  • MVP 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.01
  • Content Count:  416
  • Reputation:   73
  • Joined:  05/16/19
  • Last Seen:  

I dont know but you can try this

 


	entry.sc = sc;
	entry.rate = cap_value(rate, -10000, 10000);
	entry.skill_id = skill_id;
	entry.target = target;
	entry.duration = duration;
	
	if (rate >= 8000 && sc == 1)
		rate = 8000;

maybe like this

	if ((rate >= 8000) && (sc == 1))
		rate = 8000;

And you might need to place it higher  like so

struct s_addeffectonskill entry = {};

	if ((rate >= 8000) && (sc == 1))
		rate = 8000;

	if (rate < -10000 || rate > 10000)
		ShowWarning("pc_bonus_addeff_onskill: Item bonus rate %d exceeds -10000~10000 range, capping.\n", rate);

Im not really sure which effect freeze is  but if its the same as status.c then its probably 1

 

 

Edited by Naruto
  • Like 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.01
  • Content Count:  416
  • Reputation:   73
  • Joined:  05/16/19
  • Last Seen:  

4 hours ago, Litro Endemic said:

you need to edit 2 place in that place the first one for when entry is edited, the second one is when new entry created, capped into 8000 (80%) for SC_FREEZE, better use SC_FREEZE instead 1 for comparison, so it will human readable


	for (auto &it : effect) {
		if (it.sc == sc && it.flag == flag) {
			if (sc == SC_FREEZE)
				it.rate = cap_value(it.rate + rate, -10000, 8000);
			else
				it.rate = cap_value(it.rate + rate, -10000, 10000);
			it.arrow_rate += arrow_rate;
			it.duration = umax(it.duration, duration);
			return;
		}
	}

	struct s_addeffect entry = {};

	if (rate < -10000 || rate > 10000)
		ShowWarning("pc_bonus_addeff: Item bonus rate %d exceeds -10000~10000 range, capping.\n", rate);

	entry.sc = sc;
	if (sc == SC_FREEZE)
		entry.rate = cap_value(rate, -10000, 8000);
	else
		entry.rate = cap_value(rate, -10000, 10000);
	entry.arrow_rate = arrow_rate;
	entry.flag = flag;
	entry.duration = duration;

	effect.push_back(entry);

 

I could see how

entry.sc = sc;
	if (sc == 1)
		entry.rate = cap_value(rate, -10000, 80000);
	else
	entry.rate = cap_value(rate, -10000, 10000);
	entry.skill_id = skill_id;

could work thanks 

Edited by Naruto
  • Like 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  28
  • Reputation:   0
  • Joined:  10/13/17
  • Last Seen:  

Thank you very much, I appreciate your answers.
So, basically it can be done in both ways?

Again, I appreciate your answers.

Edited by Youness
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.01
  • Content Count:  416
  • Reputation:   73
  • Joined:  05/16/19
  • Last Seen:  

1 hour ago, Youness said:

Thank you very much, I appreciate your answers.
So, basically it can be done in both ways?

Again, I appreciate your answers.

Well his way looks like he changes the actually chance to 1-80%

mine just makes it if your rate is anything above 80% itll only return 80% just like the hercules script 

 

I didnt even test it though

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  28
  • Reputation:   0
  • Joined:  10/13/17
  • Last Seen:  

Oh, I see @Naruto

Could you assure me where put each lines and in which part exactly, please?
It confuses me because each one has placed it in a different place.
 

Thank you !!!

Edited by Youness
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  28
  • Reputation:   0
  • Joined:  10/13/17
  • Last Seen:  

@Litro Endemic Can you help me with that ? 
if your rate is anything above 80% itll only return 80% "

I guess it must be almost the same, but I'm not totally sure.

Thank you!

Edited by Youness
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   76
  • Joined:  06/13/13
  • Last Seen:  

if your rate is anything above 80% itll only return 80% "

isn't this same with cap value ? that should be included in code above

when updating entry, in example wearing 2 garm card ? here the rate minimum is -100% and maximum is 80%

it.rate = cap_value(it.rate + rate, -10000, 8000);

when creating new entry, the first garm card, expalanation same with above

entry.rate = cap_value(rate, -10000, 8000);

try it in your local server or i didn't really get it what are you talking about.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.01
  • Content Count:  416
  • Reputation:   73
  • Joined:  05/16/19
  • Last Seen:  

4 hours ago, Litro Endemic said:

if your rate is anything above 80% itll only return 80% "

isn't this same with cap value ? that should be included in code above

when updating entry, in example wearing 2 garm card ? here the rate minimum is -100% and maximum is 80%


it.rate = cap_value(it.rate + rate, -10000, 8000);

when creating new entry, the first garm card, expalanation same with above


entry.rate = cap_value(rate, -10000, 8000);

try it in your local server or i didn't really get it what are you talking about.

well im just converting herc code to rathena you can do what you want 

 

 

im working with these at the top of the function

 * Adds an AddEff/AddEff2/AddEffWhenHit bonus to a character.
 *
 * @param effect     Effects array to append to.
 * @param max        Size of the effect array.
 * @param id         Effect ID (@see enum sc_type).
 * @param rate       Trigger rate.
 * @param arrow_rate Trigger rate modifier for ranged attacks (adds to the base rate).
 * @param flag       Trigger flags (@see enum auto_trigger_flag).
 * @param duration   Fixed (non-reducible) duration in ms. If 0, uses the default (reducible) duration of the given effect.
 * @retval 1 on success.
 * @retval 0 on failure.
 */

herc 

/**
 * Add inflict effect bonus for player while attacking using skill
 * @param effect: Effect array
 * @param sc: SC/Effect type
 * @param rate: Success chance
 * @param skill_id: Skill to cast
 * @param target: Target type
 * @param duration: Duration. If 0 use default duration lookup for associated skill with level 7
 */

rA

Edited by Naruto
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  28
  • Reputation:   0
  • Joined:  10/13/17
  • Last Seen:  

?

Edited by Youness
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...