Jump to content
  • 0
Sign in to follow this  
stevler

Varying Cost Heal

Question

I'd like to make it so my healer is free until level 50, and then depending on your ((baselevel+joblevel)/2)5.

 

How would I add that?

 

 

prontera,150,191,5,	script	Healer	641,{	mes "[^0000FF Healer ^000000]";	mes "Would you like to be healed?";	mes "^FF0000 *Note - It costs 1,000 zeny to get healed.* ^000000";		if(select("Yea please.:No thank you.") == 2){			close;}if (Zeny < 1000){	mes "I'm sorry but you don't have enough zeny.";}Zeny -= 1000;percentheal 100,100;close;}

Share this post


Link to post
Share on other sites

12 answers to this question

Recommended Posts

  • 0
prontera,150,191,5,    script    Healer    641,{    mes "[^0000FF Healer ^000000]";    mes "Would you like to be healed?";    mes "^FF0000 *Note - It costs "+ (((BaseLevel + JobLevel) / 2) * 5) +" zeny to get healed.* ^000000";        if (select("Yea please.:No thank you.") == 2) {            close;}if (Zeny < (((BaseLevel + JobLevel) / 2) * 5) && BaseLevel > 50) {    mes "I'm sorry but you don't have enough zeny.";}if (BaseLevel > 50) {    Zeny -= (((BaseLevel + JobLevel) / 2) * 5);}percentheal 100,100;close;}

O.o that should do it. Though it looks like you went through my topic to get this, glad it was of help somewhat :D

Edited by GmOcean

Share this post


Link to post
Share on other sites
  • 0

Thank you very much, it did help. I'll be able to make much neater scripts, and I was able to fix any problems that came up myself while doing it. I didn't want mine to have a buffer though, and wasn't sure what variables I could use, and how to use them the way I want to. I'm not sure if that's the right word, aren't baselevel, and joblevel variables?

 

I was also wondering if there would be a way to make the sum of that equation to be shown instead of it saying "note it cost 1000".

 

How would I go about doing so?

Edited by stevler

Share this post


Link to post
Share on other sites
  • 0

I updated my post so it displays the proper cost.

Also, BaseLevel and JobLevel are constant variables, that will always have a set value.

These can be found in const.txt located in your db folder.

Share this post


Link to post
Share on other sites
  • 0

Ahh, thank you, that works. One more thing. sorry to ask so much. How would I make that number only appear for people above level 50?

Edited by stevler

Share this post


Link to post
Share on other sites
  • 0

wrap the mes command in an if() statement that checks against their BaseLevel to see if it's more than 50.

example:

if( BaseLevel > 50 ){ mes "..."; }

Share this post


Link to post
Share on other sites
  • 0

Again, thank you very much. I was just thinking for trying an if() statement right before I came to check this, thanks for making me more confident. I'll ask for more help if needed.

Share this post


Link to post
Share on other sites
  • 0

I may be misinformed about this, but...

 

Shouldn't it be mandatory to have a Zeny check before applying the cost? Because if you try to subtract more Zeny than the user has, there could be problems with script execution?

 

I mean this line:

Zeny -= (((BaseLevel + JobLevel) / 2) * 5);

 

P.S.: stevler, can you make it to check if the user has enough zeny and then heal him/her or tell he doesn't have enough zeny? It's a simple modification, you should be able to do that after reading GmOcean's awesome guide ;)

Share this post


Link to post
Share on other sites
  • 0

Umm, but if you'll raise your eyes a bit higher the check is already there...

if (Zeny < (((BaseLevel + JobLevel) / 2) * 5) && BaseLevel > 50) {    mes "I'm sorry but you don't have enough zeny.";}

Share this post


Link to post
Share on other sites
  • 0

 

Umm, but if you'll raise your eyes a bit higher the check is already there...

if (Zeny < (((BaseLevel + JobLevel) / 2) * 5) && BaseLevel > 50) {    mes "I'm sorry but you don't have enough zeny.";}

 

he means this line:

mes "^FF0000 *Note - It costs "+ (((BaseLevel + JobLevel) / 2) * 5) +" zeny to get healed.* ^000000";

Share this post


Link to post
Share on other sites
  • 0

I've already talked to Stevler about that line as well, it was discussed that he would wrap it in an if() statement as well. It's just this was determined after he said the topic was solved.

Share this post


Link to post
Share on other sites
  • 0

 

I may be misinformed about this, but...

 

Shouldn't it be mandatory to have a Zeny check before applying the cost? Because if you try to subtract more Zeny than the user has, there could be problems with script execution?

 

I mean this line:

Zeny -= (((BaseLevel + JobLevel) / 2) * 5);

 

 

 

he means this line:

mes "^FF0000 *Note - It costs "+ (((BaseLevel + JobLevel) / 2) * 5) +" zeny to get healed.* ^000000";

 

..? I may be wrong, but he even stated the line he meant, no?

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

  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  

×
×
  • Create New...

Important Information

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