• 0
Sign in to follow this  
Kokak

Success Message

Question

Posted (edited)

Hi, I have successfully implemented a custom skill.

I just have a problem about the Success Message and Skill Failed Message:

When you have successfully break the enemy's weapon, the message must be "SUCCESS", and "Skill Failed" when you fail to break it.

But, it always throws me the Skill Failed message even though I successfully break the weapon.

Here is my code:

case WS_CRUSHWEAPON:
	{
		int s = 0;
		skill_break_equip(src,bl, EQP_WEAPON, 150*skill_lv, BCT_ENEMY);
		clif_displaymessage(sd->fd, "SUCCESS.");
		
		if( sd && !s ){
			clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
			return 0;
		}
		
		clif_skill_nodamage(src,bl,skill_id,skill_lv,1);
	}
	break;

 

Edited by Kokak
Added info

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 2
if (skill_break_equip(src,bl, EQP_WEAPON, 150*skill_lv, BCT_ENEMY))	{ clif_displaymessage(sd->fd, "SUCCESS."); }
else {clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);}

  is what you want then.

  • Love 2

Share this post


Link to post
Share on other sites
  • 0
7 hours ago, Sakurada said:

try adding a break after the skill works

case WS_CRUSHWEAPON:
	{
		int s = 0;
		skill_break_equip(src,bl, EQP_WEAPON, 150*skill_lv, BCT_ENEMY);
		clif_displaymessage(sd->fd, "SUCCESS.");

		break;

		if( sd && !s ){
			clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
			return 0;
		}
		
		clif_skill_nodamage(src,bl,skill_id,skill_lv,1);
	}
	break;

ah well we may have to change this around

 

edit: cant fucking write with this........

 

but you just need to do something like this and break it in 2... and use clif_skill_nodamage in 2 spots...

could be another way

	case SM_BASH:
		{
		int s = 0;
			skill_break_equip(src,bl, EQP_WEAPON, 150*skill_lv, BCT_ENEMY);
			clif_displaymessage(sd->fd, "SUCCESS.");
			clif_skill_nodamage(src,bl,skill_id,skill_lv,1);
		break;
		
		if( sd && !s ){
			clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
			return 0;
		}
	}
	break;

Dont really know what your int s is so idk if you need to add it to that part.. its your % chance? then yeah i guess you do but not sure if i would place it under over over the return 0; so deal with it

I tried doing this. Now it throws me "Success" always even though the skill failed to break the weapon.

Share this post


Link to post
Share on other sites
  • 0

I don't see the most important "if" anywhere in there.

if (skill_break_equip(src,bl, EQP_WEAPON, 150*skill_lv, BCT_ENEMY))	{ clif_displaymessage(sd->fd, "SUCCESS."); }
else {clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);}

The return value from skill_break_equip tells you if it broke something or not.

Share this post


Link to post
Share on other sites
  • 0

What matters, assuming the skill does try to break the equipment by calling skill_break_equip, "150*skillvl" is the chance of success. It'll return true if it did break something and false if it did not. It won't always break something. In addition to that, you also need to display "fail" if you didn't even call the function, like in your example if the monster is the wrong size. But I don't think he asked for that?

 

Share this post


Link to post
Share on other sites
  • 0
10 minutes ago, Seravy said:

What matters, assuming the skill does try to break the equipment by calling skill_break_equip, "150*skillvl" is the chance of success. It'll return true if it did break something and false if it did not. It won't always break something. In addition to that, you also need to display "fail" if you didn't even call the function, like in your example if the monster is the wrong size. But I don't think he asked for that?

 

Yes, "150*SkillLvl" is the chance of success. It will only return a "SUCCESS" message whenever it did break the weapon. (Skill failed if not).

Share this post


Link to post
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.

Loading...
Sign in to follow this