Jump to content
  • 0

Need help with multiple "if(countitem(7830) > 0" script, pls thank you


BabaVoss

Question


  • Group:  Members
  • Topic Count:  37
  • Topics Per Day:  0.03
  • Content Count:  79
  • Reputation:   0
  • Joined:  06/17/20
  • Last Seen:  

Hello guys,  i need help with this part of my script.

//for job restrict
		if (BaseJob == Job_Ninja) {
			mes "[Kagerou Shin]";
			mes "Do you want to craft [Kagerou] Job ring?";
			next;
			mes "[Kagerou Shin]";
			mes "Show me that you are worthy of my suit, Im going to test your strength by killing monster.";
			mes "Are you strong enough to accept the mission?";
			next;
			switch(select("Yes!:No!")) {
			case 1:
				mes "[Kagerou Shin]";
				mes "First thing you'll need to do is complete all requirements to craft my suit. After completing all requirements, come back to me and I'll give you my suit.";
				next;
				switch(select("Kagerou Job Ring:Missions:Cancel")) {
				case 1:
					// Item turn in
					mes "[Kagerou Shin]";
					mes "Im going to need these items:";
					mes "^00CC001 Goddess Tear^000000";
					mes "^00CC001 Valkyrie's Token^000000";
					mes "^00CC001 Giant Bradium Fragment^000000";
					mes "^00CC001000 Golds^000000.";
					mes "and ^00CC00200 Credits^000000.";
					next;
					switch(select("I have all the materials you need.:I'll be right back!")) {
					case 1:
							if(countitem(7830) > 0 || countitem(7831) > 0 || countitem(6151) > 0 || countitem(969) > 999 || countitem(60003) > 199) {
							next;
							mes "[Kagerou Shin]";
							mes "Congratulations! You have completed the missions.";
							mes "You are a true Ninja, you're worth of this suit.";
							delitem 7830,1;		 //goddess tear
							delitem 7831,1;		 //valkyrie's token
							delitem 6151,1;		 //giant bradium fragment
							delitem 969,1000;	 //Gold
							delitem 60003,200; 	 //Credits
							getitem 50506,1;	 //Kagerou suit
							close;
						}
						else {
							mes "[Kagerou Shin]";
							mes "You have not yet completed all the requirements!";
							close;
						}
					case 2:
						mes "[Kagerou Shin]";
						mes "I need all the requirements to craft the suit.";
						close;
					}

okay so the problem is, if the "if(countitem(7830) > 0 || countitem(7831) > 0 || countitem(6151) > 0 || countitem(969) > 999 || countitem(60003) > 199)"  items are not complete, it will consume the other requirements and it show the "case 1: mes Congrats" message. Check picture below

image.png.83c911d20f8422f094e9eba849029b20.png

Where in if the requirements are not complete, it should show this message mes "You have not yet completed all the requirements!";

but if for example, there is NO requirements at all, it works fine.  See picture below

image.png.2ed47a2ed4256c79f6a57ab7790cae93.png

and if for example, the requirements are complete. it works fine too. Im only having problems, if there's a missing/not complete requirement.
thank you in advance.

Edited by BabaVoss
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  657
  • Reputation:   662
  • Joined:  11/12/12
  • Last Seen:  

Well, you're mixing up || and &&. You must have all items, so you need:

if (countitem(7830) > 0 && countitem(7831) > 0 && countitem(6151) > 0 && countitem(969) > 999 && countitem(60003) > 199) {

(Also the "next;" below that line shouldn't be there.)

  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  1511
  • Reputation:   227
  • Joined:  08/03/12
  • Last Seen:  

|| means OR which is 

IF 1 requirement are fulfilled = accepted.

&& means AND

So ALL requirements needed to be fulfilled.

  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  37
  • Topics Per Day:  0.03
  • Content Count:  79
  • Reputation:   0
  • Joined:  06/17/20
  • Last Seen:  

thank you sir @Tokei @Chaos92, now i know what this script means. im really a newbie, im just learning tru rathena and from people like u. thanks

 

additional question sir, how about giving reward for gender exclusive for example if the character is Male, it should give getitem 50506 -Kagerou job ring. and for female getitem 50508 Oboro job ring. i wasnt able to make 1 job ring for both gender on ninja because of the script i used. these two should have gender restriction to avoid crash.

for Kagerou -0x02000000,63,1,2097152,,20,0,0,{ changebase 4211; },{ changebase Class; }{}
for oboro -0x02000000,63,0,2097152,,20,0,0,{ changebase 4212; },{ changebase Class; }{}

 

Edited by BabaVoss
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  1511
  • Reputation:   227
  • Joined:  08/03/12
  • Last Seen:  

13 hours ago, BabaVoss said:

thank you sir @Tokei @Chaos92, now i know what this script means. im really a newbie, im just learning tru rathena and from people like u. thanks

 

additional question sir, how about giving reward for gender exclusive for example if the character is Male, it should give getitem 50506 -Kagerou job ring. and for female getitem 50508 Oboro job ring. i wasnt able to make 1 job ring for both gender on ninja because of the script i used. these two should have gender restriction to avoid crash.

for Kagerou -0x02000000,63,1,2097152,,20,0,0,{ changebase 4211; },{ changebase Class; }{}
for oboro -0x02000000,63,0,2097152,,20,0,0,{ changebase 4212; },{ changebase Class; }{}

 

Sex - 0 if female, 1 if male.

https://github.com/rathena/rathena/blob/master/doc/script_commands.txt

So maybe use IF for that variable.

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