WhiteEagle Posted October 6, 2012 Group: Members Topic Count: 79 Topics Per Day: 0.02 Content Count: 480 Reputation: 67 Joined: 08/28/12 Last Seen: 11 hours ago Share Posted October 6, 2012 (edited) Hello guys, I need a NPC which make a difference between unlearned and learned recipes. You have learned: - Apple Juice - Isis Taming - etc Only the learned should be displayed. The recipe ingredients shall be at the SQL Database. And I need a SQL-Table with following fields: recipe_id, value1, amount1, value2, amount2, value3, amount3, value4, amount4, value5, amount5, value6, amount6, value7, amount7, value8, amount8, value9, amount9, value10, amount10 An Item can give the learned status. By Example: If I find a recipe for making Apple Juice, I can use it and after using I got the status learned. It would be nice if someone can help me. Many thanks Edited October 6, 2012 by WhiteEagle Quote Link to comment Share on other sites More sharing options...
WhiteEagle Posted October 9, 2012 Group: Members Topic Count: 79 Topics Per Day: 0.02 Content Count: 480 Reputation: 67 Joined: 08/28/12 Last Seen: 11 hours ago Author Share Posted October 9, 2012 Have nobody an idea how can I script this? Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted October 9, 2012 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted October 9, 2012 your request kinda make me reminds of my mission board script, that were highly demanded to be convert to SQL version anyway /* create table item_recipe_custom ( id smallint not null primary key auto_increment, item_id smallint(6) unique, value1 smallint(6) not null default '0', amount1 smallint(6) not null default '0', value2 smallint(6) not null default '0', amount2 smallint(6) not null default '0', value3 smallint(6) not null default '0', amount3 smallint(6) not null default '0', value4 smallint(6) not null default '0', amount4 smallint(6) not null default '0', value5 smallint(6) not null default '0', amount5 smallint(6) not null default '0', value6 smallint(6) not null default '0', amount6 smallint(6) not null default '0', value7 smallint(6) not null default '0', amount7 smallint(6) not null default '0', value8 smallint(6) not null default '0', amount8 smallint(6) not null default '0', value9 smallint(6) not null default '0', amount9 smallint(6) not null default '0', value10 smallint(6) not null default '0', amount10 smallint(6) not null default '0' ) engine = innodb; */ prontera,157,175,5 script item_recipe_make 100,{ set item_recipe_custom0, 0; set .@nb, query_sql( "select * from item_recipe_custom", .@id, .@item_id, .@v1, .@a1, .@v2, .@a2, .@v3, .@a3, .@v4, .@a4, .@v5, .@a5, .@v6, .@a6, .@v7, .@a7, .@v8, .@a8, .@v9, .@a9, .@v0, .@a0 ); if ( .@nb == -1 ) { mes "the table is not set"; close; } if ( .@nb == 0 ) { mes "current list is empty"; close; } mes "select an item to make"; next; set .@menu$, getitemname( .@item_id ); for( set .@i, 1; .@i < .@nb; set .@i, .@i +1 ) set .@menu$, .@menu$ +":"+ getitemname( .@item_id[ .@i ] ); set .@s, select( .@menu$ ) -1 ; if ( getd( "item_recipe_custom"+ ( .@id[ .@s ] / 31 ) ) & pow( 2, .@id[ .@s ] % 31 ) ) { mes "you've learned how to make this item and used them"; close; } mes "to make ^ff0000"+ getitemname( .@item_id[ .@s ] ); mes "^000000you need the following items:^0000ff"; set .@i, 1; while ( getd( ".@v"+ .@i +"["+ .@s +"]" ) ) { mes getd( ".@a"+ .@i +"["+ .@s +"]" ) +"x "+ getitemname( getd( ".@v"+ .@i +"["+ .@s +"]" ) ); set .@i, .@i +1; } next; select "learn it"; set .@i, 1; while ( getd( ".@v"+ .@i +"["+ .@s +"]" ) ) { if ( countitem( getd( ".@v"+ .@i +"["+ .@s +"]" ) ) < getd( ".@a"+ .@i +"["+ .@s +"]" ) ) { mes "you don't have enough "+ getitemname( getd( ".@v"+ .@i +"["+ .@s +"]" ) ); close; } set .@i, .@i +1; } set .@i, 1; while ( getd( ".@v"+ .@i +"["+ .@s +"]" ) ) { delitem getd( ".@v"+ .@i +"["+ .@s +"]" ), getd( ".@a"+ .@i +"["+ .@s +"]" ); set .@i, .@i +1; } setd "item_recipe_custom"+( .@id[ .@s ] /31 ), getd( "item_recipe_custom"+( .@id[ .@s ] /31 ) ) | pow( 2, .@id[ .@s ] % 31 ); mes "you've learned how to make "+ getitemname( .@item_id[ .@s ] ); close; } pls let me spam abit WTF and WTF the hell with me used 2 hours and 30 mins to make this simple script I need to continue make more script at the moment to improve myself yet 1 Quote Link to comment Share on other sites More sharing options...
WhiteEagle Posted October 9, 2012 Group: Members Topic Count: 79 Topics Per Day: 0.02 Content Count: 480 Reputation: 67 Joined: 08/28/12 Last Seen: 11 hours ago Author Share Posted October 9, 2012 @AnnieRuru Special thanks for your script. But not exactly what I meant. The NPC shall only display what I already learned not what I can learn. By example: After collecting a recipe from a monster, I can use the item. After using, the NPC shall display that I learned it and what the recipe contains. All other recipe which I don't learned, don't shall be displayed at the NPC. (only after using the item.) But many many thanks again for your script. It help me so much in many things. Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted October 9, 2012 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted October 9, 2012 can you please at least post a database side item_db script, ( how the item provoke the script ) so I have a general idea how to start on the npc side even a psuedo-code item_db side is sufficient ======= let me guess, so there are 2 items ? in order to use apple juice(531), I need to collect apple juice scroll(32000 ... some random create item) then once I got the apple juice scroll and look for this npc, this npc will show the recipe to make apple juice ? Quote Link to comment Share on other sites More sharing options...
WhiteEagle Posted October 9, 2012 Group: Members Topic Count: 79 Topics Per Day: 0.02 Content Count: 480 Reputation: 67 Joined: 08/28/12 Last Seen: 11 hours ago Author Share Posted October 9, 2012 (edited) You are perfect. That is what I mean. It don't make a different for me, whether I need use the item to learn it or to go to the NPC to get the status "learned." Edited October 9, 2012 by WhiteEagle Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted October 9, 2012 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted October 9, 2012 actually I don't mind writing more scripts atm, but somehow I feel this is pointless you see, you can invoke a book tab in a misc item http://www.eathena.ws/board/index.php?showtopic=242194&hl=book if you do it this way, this will be a purely client-side modification Quote Link to comment Share on other sites More sharing options...
WhiteEagle Posted October 10, 2012 Group: Members Topic Count: 79 Topics Per Day: 0.02 Content Count: 480 Reputation: 67 Joined: 08/28/12 Last Seen: 11 hours ago Author Share Posted October 10, 2012 That is sad to read. Your way was right. let me guess, so there are 2 items ? in order to use apple juice(531), I need to collect apple juice scroll(32000 ... some random create item) After using the "Apple Juice Scroll" display the NPC that I learned to make "Apple Juice". Next time if I using the "Diablo Set Scroll", display the NPC that I learned to make "Diabolus Set". So, the NPC display now: Your learned recipes:- Apple Juice - Diabolus Set Quote Link to comment Share on other sites More sharing options...
Question
WhiteEagle
Hello guys,
I need a NPC which make a difference between unlearned and learned recipes.
Only the learned should be displayed. The recipe ingredients shall be at the SQL Database.
And I need a SQL-Table with following fields:
An Item can give the learned status.
It would be nice if someone can help me.
Many thanks
Edited by WhiteEagleLink to comment
Share on other sites
7 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.