Virtue Posted January 16, 2012 Group: Members Topic Count: 92 Topics Per Day: 0.02 Content Count: 354 Reputation: 22 Joined: 11/17/11 Last Seen: May 12, 2024 Share 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 Link to comment Share on other sites More sharing options...
Emistry Posted January 16, 2012 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2370 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share 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 Link to comment Share on other sites More sharing options...
Virtue Posted January 16, 2012 Group: Members Topic Count: 92 Topics Per Day: 0.02 Content Count: 354 Reputation: 22 Joined: 11/17/11 Last Seen: May 12, 2024 Author Share 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 Link to comment Share on other sites More sharing options...
Emistry Posted January 16, 2012 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2370 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share 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 Link to comment Share on other sites More sharing options...
Virtue Posted January 16, 2012 Group: Members Topic Count: 92 Topics Per Day: 0.02 Content Count: 354 Reputation: 22 Joined: 11/17/11 Last Seen: May 12, 2024 Author Share 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 Link to comment Share on other sites More sharing options...
Emistry Posted January 16, 2012 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2370 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share 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 Link to comment Share on other sites More sharing options...
Virtue Posted January 16, 2012 Group: Members Topic Count: 92 Topics Per Day: 0.02 Content Count: 354 Reputation: 22 Joined: 11/17/11 Last Seen: May 12, 2024 Author Share 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 Link to comment Share on other sites More sharing options...
Arcenciel Posted January 16, 2012 Group: Members Topic Count: 69 Topics Per Day: 0.01 Content Count: 1315 Reputation: 372 Joined: 12/10/11 Last Seen: August 31, 2013 Share 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 Link to comment Share on other sites More sharing options...
Virtue Posted January 16, 2012 Group: Members Topic Count: 92 Topics Per Day: 0.02 Content Count: 354 Reputation: 22 Joined: 11/17/11 Last Seen: May 12, 2024 Author Share Posted January 16, 2012 alright thanks alot Quote Link to comment Share on other sites More sharing options...
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
Link to comment
Share on other sites
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.