Jump to content
  • 0
Sign in to follow this  
utofaery

Q>sql query MD_BOSS

Question

I was trying to take / borrow script card seller from rathena and this MD_BOSS is not working like MD_MVP in rathena

[Error]: script_rid2sd: fatal error ! player not attached!
[Debug]: Source (NPC): card_seller_creation (invisible/not on a map)
[Warning]: script_get_val: cannot access player variable 'MD_BOSS', defaulting t
o 0

Map-server says not working what can I do to fix that part?

Note : Script Header was not kept 

Spoiler


prontera,165,169,3    script    Normal Card Seller    4W_SAILOR,{
    .@menu$ = getvariableofnpc( .alphabet_menu$, "card_seller_creation" );
    if (.@menu$ == "") {
        mes "[Card Seller]";
        mes "I am sorry, it seems like something went wrong.";
        mes "I cannot find any cards in our database at the moment.";
        mes "Please contact a game master.";
        close;
    }
    mes "[Card Seller]";
    mes "Welcome!";
    mes "I can sell you any normal monster card in the game. Would you like to have a look?";
    next;
    .@s = select(.@menu$) -1;
    close2;
    callshop "card_mob#"+ getvariableofnpc( .alphabet$[.@s], "card_seller_creation" ), 1;
    end;
}

-    script    card_seller_creation    -1,{
    end;
OnInit:
//    if (checkre(0)) {
//        .@mob_db$  = "mob_db_re";
//        .@item_db$ = "item_db_re";
//    } else {
        .@mob_db$  = "mob_db";
        .@item_db$ = "item_db";
//    }
    freeloop 1;    
    .@total = query_sql( "SELECT DISTINCT LEFT( `name_japanese`, 1 ) AS alphabets FROM `"+ .@item_db$ +"` WHERE `type` = " + IT_CARD + " AND `id` IN ( SELECT DISTINCT `dropcardid` FROM `"+ .@mob_db$ +"` WHERE (`MEXP`) <= "+0+" ) ORDER BY alphabets;", .@alphabet$ );
    for ( .@i = 0; .@i < .@total; .@i++ ) {
        .@nb = query_sql( "SELECT `"+ .@item_db$ +"`.`id` FROM `"+ .@item_db$ +"` WHERE `type` = " + IT_CARD + " AND LEFT( `name_japanese`, 1 ) = '"+ .@alphabet$[.@i] +"' AND `id` IN ( SELECT DISTINCT `dropcardid` FROM `"+ .@mob_db$ +"` WHERE (`MEXP`) <= "+0+" ) ORDER BY `name_japanese` LIMIT 128;", .@id );
        if (.@nb > 0) {
            .alphabet$[.@size_alphabet++] = .@alphabet$[.@i];
            .alphabet_menu$ = .alphabet_menu$ + .@alphabet$[.@i] +" Cards:";
            npcshopdelitem "card_mob#"+ .@alphabet$[.@i], 501;
            for ( .@j = 0; .@j < .@nb; .@j++ ) {
                if (callfunc( "F_IsCharm", .@id[.@j] ) == true)// Skip enchants in case someone added them as card drop
                    continue;
                npcshopadditem "card_mob#"+ .@alphabet$[.@i], .@id[.@j], 1000;
            }
        }
    }
    freeloop 0;
    end;
}


-    shop    card_mob#A    -1,501:1000
-    shop    card_mob#B    -1,501:1000
-    shop    card_mob#C    -1,501:1000
-    shop    card_mob#D    -1,501:1000
-    shop    card_mob#E    -1,501:1000
-    shop    card_mob#F    -1,501:1000
-    shop    card_mob#G    -1,501:1000
-    shop    card_mob#H    -1,501:1000
-    shop    card_mob#I    -1,501:1000
-    shop    card_mob#J    -1,501:1000
-    shop    card_mob#K    -1,501:1000
-    shop    card_mob#L    -1,501:1000
-    shop    card_mob#M    -1,501:1000
-    shop    card_mob#N    -1,501:1000
-    shop    card_mob#O    -1,501:1000
-    shop    card_mob#P    -1,501:1000
-    shop    card_mob#Q    -1,501:1000
-    shop    card_mob#R    -1,501:1000
-    shop    card_mob#S    -1,501:1000
-    shop    card_mob#T    -1,501:1000
-    shop    card_mob#U    -1,501:1000
-    shop    card_mob#V    -1,501:1000
-    shop    card_mob#W    -1,501:1000
-    shop    card_mob#X    -1,501:1000
-    shop    card_mob#Y    -1,501:1000
-    shop    card_mob#Z    -1,501:1000

function    script    F_IsCharm    { //CARD CHECKER!!! DONT REMOVE
    .@id = getarg(0);
    return ((.@id >= 4700 && .@id < 5000) || (.@id >= 29000 && .@id <= 29162));
}

 

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0

my original script over there still working fine in hercules
https://rathena.org/board/topic/73478-requesting-card-seller-script/?do=findComment&comment=154617

Spoiler

prontera,155,177,5	script	Card Seller	100,{
	mes "Welcome to card seller ... meh lazy to say";
	next;
	if ( select ( "Normal Cards", "Mini-boss Cards", "MVP Cards" ) == 1 ) {
		.@s = select( .alphabet_menu$ ) -1;
		close2;
		callshop "card_mob#"+ .alphabet$[.@s], 1;
		end;
	}
	close2;
	callshop "card_mob#"+( ( @menu == 2 )? "miniboss":"MVP" ), 1;
	end;
OnInit:
	freeloop 1;
	.@total = query_sql("select distinct left( name_japanese, 1 ) as aaa from item_db right join mob_db on item_db.id = mob_db.dropcardid where ~mode & 32 and type = 6 group by name_japanese order by aaa", .alphabet$ );
	for ( .@i = 0; .@i < .@total; .@i++ ) {
		.alphabet_menu$ = .alphabet_menu$ + .alphabet$[.@i] +" Cards:";
		.@nb = query_sql( "select item_db.id from item_db right join mob_db on item_db.id = mob_db.dropcardid where ~mode & 32 and type = 6 and left( name_japanese, 1 ) = '"+ .alphabet$[.@i] +"' group by name_japanese order by name_japanese limit 128", .@id );
		npcshopdelitem "card_mob#"+ .alphabet$[.@i], 501;
		for ( .@j = 0; .@j < .@nb; .@j++ )
			npcshopadditem "card_mob#"+ .alphabet$[.@i], .@id[.@j], 1000000;
	}
	freeloop 0;
	end;
}
-	shop	card_mob#A	-1,501:1000
-	shop	card_mob#B	-1,501:1000
-	shop	card_mob#C	-1,501:1000
-	shop	card_mob#D	-1,501:1000
-	shop	card_mob#E	-1,501:1000
-	shop	card_mob#F	-1,501:1000
-	shop	card_mob#G	-1,501:1000
-	shop	card_mob#H	-1,501:1000
-	shop	card_mob#I	-1,501:1000
-	shop	card_mob#J	-1,501:1000
-	shop	card_mob#K	-1,501:1000
-	shop	card_mob#L	-1,501:1000
-	shop	card_mob#M	-1,501:1000
-	shop	card_mob#N	-1,501:1000
-	shop	card_mob#O	-1,501:1000
-	shop	card_mob#P	-1,501:1000
-	shop	card_mob#Q	-1,501:1000
-	shop	card_mob#R	-1,501:1000
-	shop	card_mob#S	-1,501:1000
-	shop	card_mob#T	-1,501:1000
-	shop	card_mob#U	-1,501:1000
-	shop	card_mob#V	-1,501:1000
-	shop	card_mob#W	-1,501:1000
-	shop	card_mob#X	-1,501:1000
-	shop	card_mob#Y	-1,501:1000
-	shop	card_mob#Z	-1,501:1000
-	shop	card_mob#miniboss	-1,4054:1000000,4241:1000000,4391:1000000,4428:1000000,4426:1000000,4290:1000000,4300:1000000,4392:1000000,4171:1000000,4397:1000000,4174:1000000,4398:1000000,4179:1000000,4266:1000000,4451:1000000,4250:1000000,4423:1000000,4354:1000000,4047:1000000,4163:1000000,4384:1000000,4431:1000000,4394:1000000,4395:1000000,4197:1000000,4198:1000000,4393:1000000,4203:1000000,4207:1000000,4440:1000000,4396:1000000,4254:1000000,4238:1000000,4237:1000000,4429:1000000,4406:1000000,4427:1000000,4306:1000000,4183:1000000,4529:1000000,4526:1000000,4532:1000000
-	shop	card_mob#MVP	-1,4236:1000000,4359:1000000,4425:1000000,4145:1000000,4168:1000000,4386:1000000,4142:1000000,4134:1000000,4137:1000000,4123:1000000,4330:1000000,4441:1000000,4352:1000000,4408:1000000,4128:1000000,4324:1000000,4363:1000000,4365:1000000,4430:1000000,4403:1000000,4419:1000000,4376:1000000,4357:1000000,4276:1000000,4361:1000000,4146:1000000,4399:1000000,4132:1000000,4131:1000000,4143:1000000,4135:1000000,4144:1000000,4148:1000000,4121:1000000,4407:1000000,4342:1000000,4263:1000000,4367:1000000,4318:1000000,4302:1000000,4305:1000000,4374:1000000,4372:1000000

 

yes, rathena changed their monster's mode, so my script wont compatible in rathena anymore
https://github.com/rathena/rathena/issues/2844

Share this post


Link to post
Share on other sites
  • 0

After Testing script provided.

According to ratemyserver.net
Baphomet   (BAPHOMET)   Mob-ID#1039 
is counted as mvp

but it is not listed any section of all three
Normal Cards
Mini-Boss Cards
or the 
MVP Cards

what can I do to make it work??

Edited by utofaery

Share this post


Link to post
Share on other sites
  • 0

hahaha ~ took me so long to find out,
yes, ONLY baphomet card is missing from my query because there is a non-MVP boss monster can drop MVP card
The Baphomet, MVP is monster BAPHOMET(1039) and there is another boss monster call BAPHOMET_I(1929) that can also drop baphomet card

Spoiler

prontera,155,177,5	script	Card Seller	100,{
	mes "Welcome to card seller ... meh lazy to say";
	next;
	if ( select ( "Normal Cards", "Mini-boss Cards", "MVP Cards" ) == 1 ) {
		.@s = select( .alphabet_menu$ ) -1;
		close2;
		callshop "card_mob#"+ .alphabet$[.@s], 1;
		end;
	}
	close2;
	callshop "card_mob#"+( ( @menu == 2 )? "miniboss":"MVP" ), 1;
	end;
OnInit:
	freeloop true;
	.@total = query_sql("select distinct left( name_japanese, 1 ) as aaa from item_db right join mob_db on item_db.id = mob_db.dropcardid where ~mode & 32 and type = 6 group by name_japanese order by aaa", .alphabet$ );
	for ( .@i = 0; .@i < .@total; ++.@i ) {
		.alphabet_menu$ = .alphabet_menu$ + .alphabet$[.@i] +" Cards:";
		.@nb = query_sql( "select item_db.id from item_db right join mob_db on item_db.id = mob_db.dropcardid where ~mode & 32 and type = 6 and left( name_japanese, 1 ) = '"+ .alphabet$[.@i] +"' group by name_japanese order by name_japanese", .@id );
		npcshopdelitem "card_mob#"+ .alphabet$[.@i], 501;
		for ( .@j = 0; .@j < .@nb; ++.@j )
			npcshopadditem "card_mob#"+ .alphabet$[.@i], .@id[.@j], 1000000;
	}
	.@nb = query_sql( "select item_db.id from mob_db right join item_db on item_db.id = mob_db.dropcardid where mode & 32 and type = 6 and mexp != 0 and item_db.id not in ( select item_db.id from item_db right join mob_db on item_db.id = mob_db.dropcardid where ~mode & 32 and type = 6 ) group by item_db.id order by name_japanese", .@id );
	npcshopdelitem "card_mob#MVP", 501;
	for ( .@i = 0; .@i < .@nb; ++.@i )
		npcshopadditem "card_mob#MVP", .@id[.@i], 1000000;
	.@nb = query_sql( "select item_db.id from item_db right join mob_db on item_db.id = mob_db.dropcardid where mode & 32 and type = 6 and mexp = 0 and item_db.id not in ( select item_db.id from item_db right join mob_db on item_db.id = mob_db.dropcardid where ~mode & 32 and type = 6 ) and item_db.id not in ( select item_db.id from item_db right join mob_db on item_db.id = mob_db.dropcardid where mode & 32 and type = 6 and mexp != 0 ) group by item_db.id order by name_japanese", .@id );
	npcshopdelitem "card_mob#miniboss", 501;
	for ( .@i = 0; .@i < .@nb; ++.@i )
		npcshopadditem "card_mob#miniboss", .@id[.@i], 1000000;	
	end;
}
-	shop	card_mob#A	-1,501:1000
-	shop	card_mob#B	-1,501:1000
-	shop	card_mob#C	-1,501:1000
-	shop	card_mob#D	-1,501:1000
-	shop	card_mob#E	-1,501:1000
-	shop	card_mob#F	-1,501:1000
-	shop	card_mob#G	-1,501:1000
-	shop	card_mob#H	-1,501:1000
-	shop	card_mob#I	-1,501:1000
-	shop	card_mob#J	-1,501:1000
-	shop	card_mob#K	-1,501:1000
-	shop	card_mob#L	-1,501:1000
-	shop	card_mob#M	-1,501:1000
-	shop	card_mob#N	-1,501:1000
-	shop	card_mob#O	-1,501:1000
-	shop	card_mob#P	-1,501:1000
-	shop	card_mob#Q	-1,501:1000
-	shop	card_mob#R	-1,501:1000
-	shop	card_mob#S	-1,501:1000
-	shop	card_mob#T	-1,501:1000
-	shop	card_mob#U	-1,501:1000
-	shop	card_mob#V	-1,501:1000
-	shop	card_mob#W	-1,501:1000
-	shop	card_mob#X	-1,501:1000
-	shop	card_mob#Y	-1,501:1000
-	shop	card_mob#Z	-1,501:1000
-	shop	card_mob#miniboss	-1,501:1000
-	shop	card_mob#MVP	-1,501:1000

 

 

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0

https://annieruru.blogspot.com/2019/01/what-is-difference-between-i-and-i.html

 

EDIT: rAthena developers added  F_IsCharm function into this script, I felt it is redundant though
who in the right mind would add a Rune or Charm in the monster `dropcardid` field ?
I would add it in Drop1ID~Drop9ID

doesn't look good in Hercules, our mob_db.conf uses libconfig format, and doesn't differentiate between card/runes and normal drop

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0

nope, if it is alone, by itself, it just increase the value normally
++.@i; and .@i++; is the same, notice the semi-colon

it only different when you have a command in it, like when using array
.@array[.@i++] and .@array[++.@i] is different

	.@array[.@i] = 1;
	.@i++;
//	is equal to
	.@array[.@i] = 1;
	++.@i;

	.@array[.@i++] = 1;
//	is NOT equal to
	.@array[++.@i] = 1;

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.