Virtue Posted January 16, 2012 Posted January 16, 2012 How do I make NPC to check something in players inventory. example if player has an apple in his inventory he can read the next dialog of the NPC. thanks Quote
Emistry Posted January 16, 2012 Posted January 16, 2012 use the countitem() command usage : countitem( itemID ) Example : if( countitem(512 ) < 10 ){ mes "You have less than 10 Apple in your Inventory."; } close; 2 Quote
Virtue Posted January 16, 2012 Author Posted January 16, 2012 (edited) alright so if i am not mistaken this should work if( countitem(512 ) < 10 ){ mes "You have less than 10 Apple in your Inventory."; } close; else( countitem(512) => 10){ mes "You have the right items."; next; switch(select("Use:Drop:Nothing")){ (fucntions would be here) } close; Edited January 16, 2012 by mnjfx Quote
Emistry Posted January 16, 2012 Posted January 16, 2012 like this if( countitem( 512 ) < 10 ){ mes "You didnt have 10 Apple"; }else{ mes "You have the items."; switch( select("Use:Drop:Nothing") ){ Case 1: Case 2: Case 3: etc.... } } 2 Quote
Virtue Posted January 16, 2012 Author Posted January 16, 2012 (edited) yup that was what i was thinking. just a little lazy to type since im eating. I also could use it like thi right? if( countitem( 512 ) > 9 ){ mes "You have the items."; switch( select("Use:Drop:Nothing") ){ Case 1: Case 2: Case 3: etc.... if( countitem(512) > 9){ mes "You have something."; switch( select("Die:Fly:Soar")){ case 1: case 2: case 3: }else{ mes "You Have Nothing"; } } Edited January 16, 2012 by mnjfx Quote
Emistry Posted January 16, 2012 Posted January 16, 2012 prontera,155,181,5 script Sample 757,{ if( countitem( 512 ) > 9 ){ mes "You have the items."; switch( select("Use:Drop:Nothing") ){ Case 1: Case 2: Case 3: } }else if( countitem(512) < 9){ mes "You have something."; switch( select("Die:Fly:Soar")){ case 1: case 2: case 3: } }else{ mes "You Have Nothing"; } close; } 1 Quote
Virtue Posted January 16, 2012 Author Posted January 16, 2012 so if I want to put more than 2? will it be like If.. else if.. else if.. else if.. etc.. then else? right? Quote
Arcenciel Posted January 16, 2012 Posted January 16, 2012 so if I want to put more than 2? will it be like If.. else if.. else if.. else if.. etc.. then else? right? Yes, if the dialogue for each item is going to be different but if you want different items for the same dialogue this would suffice if( countitem( 512 ) > 9 || countitem( 512 ) > 9 || countitem( 512 ) > 9){ Just change the ID and the amount. 1 Quote
Question
Virtue
How do I make NPC to check something in players inventory.
example
if player has an apple in his inventory he can read the next dialog of the NPC.
thanks
8 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.