Jump to content

Utility: Item Collector NPC / Item Sink Strategy


Emistry

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2345
  • Joined:  10/28/11
  • Last Seen:  

Item Collector NPC / Item Sink Strategy


Introduction :

The NPC is designed to accept items from players, with contributions being non-recoverable but meticulously logged. A straightforward ranking system showcases players based on their item contributions. Game Masters have the flexibility to leverage and reset these rankings for custom events or creative initiatives at their discretion.

efM9PV6.png

**  Consider this a deviously delightful item sinking event for your server, complete with devilish flair and strategic mischief. /oops


  • Submitter
  • Submitted
    09/01/16
  • Category
  • Video
  • Content Author
    Emistry

 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  53
  • Reputation:   4
  • Joined:  02/08/12
  • Last Seen:  

What thing is determine the ranking?

The ammount of sinked item?

Is sinking a lord kaho counted same as a jelopy?

Link to comment
Share on other sites

  • 3 weeks later...

  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   381
  • Joined:  02/03/12
  • Last Seen:  

Great idea xD

Link to comment
Share on other sites

  • 4 years later...

  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.05
  • Content Count:  478
  • Reputation:   14
  • Joined:  11/30/17
  • Last Seen:  

npc_event: event not found [trade_item_main::OnTalk]

Link to comment
Share on other sites

  • 3 years later...

  • Group:  Members
  • Topic Count:  176
  • Topics Per Day:  0.15
  • Content Count:  666
  • Reputation:   9
  • Joined:  12/04/20
  • Last Seen:  

hello need urgent help sir @Emistry while testing this in offline server it works fine and no error then after i upload it online im having a problem
 

Quote

/*
CREATE TABLE IF NOT EXISTS `e_npc_trade_item` (
  `cid` INT(11) UNSIGNED NOT NULL DEFAULT '0',
  `name` VARCHAR(30) NOT NULL DEFAULT '',
  `nameid` INT(11) UNSIGNED NOT NULL DEFAULT '0',
  `amount` INT(11) UNSIGNED NOT NULL DEFAULT '0',
  PRIMARY KEY (`cid`,`nameid`,`amount`)
) ENGINE=MyISAM;
*/
malangdo,134,114,5    script    Scroll Collector    2_m_sage_old,{
    doevent "trade_item_main::OnTalk";
}


-    script    trade_item_main    -1,{
    function    func_DisallowItem    {
        switch ( getarg( 0,0 ) ) {
            default: 
                return 0;
            // case <itemID>:
            case 501:    // Red Potion
            case 502:    // Orange Potion
            case 4001:    // Poring Card 
                return 1;
        }
        return 0;
    }
    
    OnInit:
        // Top Rank
        .top_rank = 10;
        
        // NPC take what item ID, 0 = all items.
        .only_one_itemid = 61631; // special event scroll
        end;
    
    OnTalk:
        .@is_gm = ( getgmlevel() >= 99 );
        
        mes "^0055FF[ Special Scroll Collector ]^000000";
        mes "Do you have Special Scroll? You may give it to me.";
        mes " ";
        mes "I'll always remember who giveaway this items to me.";
        next;
        switch( select(
            "View Top "+.top_rank+" Rank",
            "Give Special Scroll",
            ( .@is_gm ) ? "[GM] Reset" : ""
        )) {
            default:
                do {
                    
                    switch( select( 
                        "Filter by Name", 
                        ( .only_one_itemid ) ? "":"Filter by ItemID",
                        "Without Filter" 
                    ) ) {
                        case 1: mes "Enter Char Name"; break;
                        case 2: mes "Enter ItemID"; break;
                        default: break;
                    }
                    
                    if ( @menu && @menu < 3 ) {
                        next;
                        input .@input$;
                    }
                    
                    .@sql$ = "SELECT `name`, `nameid`, SUM(`amount`) AS `total` "
                            + "FROM `e_npc_trade_item` "
                            + "WHERE 1 = 1 "
                            + ( .only_one_itemid ? "AND `nameid` = "+.only_one_itemid+" " : "" )
                            + ( ( @menu == 1 ) ? "AND `name` = '"+escape_sql( .@input$ )+"' " : "" )
                            + ( ( @menu == 2 ) ? "AND `nameid` = '"+escape_sql( .@input$ )+"' " : "" )
                            + "GROUP BY `cid`,`nameid` "
                            + "ORDER BY `total` DESC LIMIT "+.top_rank;
                    query_sql( .@sql$,.@name$,.@nameid,.@total );
                    .@size = getarraysize( .@name$ );
                    
                    mes "Top "+.top_rank+" Records:";
                    if ( .@size ) {
                        for ( .@i = 0; .@i < .@size; .@i++ ) {
                            //mes "["+(.@i+1)+".] ~ '"+getitemname( .@nameid[.@i] )+"' | [ "+.@total[.@i]+"ea ] - '^0000FF"+.@name$[.@i]+"'^000000 ";
                            mes "[ "+(.@i+1)+" ] ~ '^0696A7"+.@name$[.@i]+"'^000000 [ ^ff0000"+.@total[.@i]+"^000000 ^0000FF pcs.^000000 ]";
                        }
                    }
                    else {
                        mes "no record found.";
                    }
                    next;
                } while ( 1 );
                break;
            case 2:
                if ( !.only_one_itemid ) {
                    mes "Pick an item and give to me";
                    getinventorylist;
                    for ( .@i = 0; .@i < @inventorylist_count; .@i++ ) {
                        if ( @inventorylist_bound[.@i] <= 0
                            && @inventorylist_expire[.@i] <= 0
                            && @inventorylist_equip[.@i] <= 0
                            && func_DisallowItem( @inventorylist_id[.@i] ) <= 0
                        ) {
                            .@menu$ = .@menu$ + getitemname( @inventorylist_id[.@i] ) + " ("+@inventorylist_amount[.@i]+" left)";
                            .@count++;
                        }
                        .@menu$ = .@menu$ + ":";
                    }
                    if ( .@count ) {
                        .@i = select( .@menu$ ) - 1;
                        .@itemid = @inventorylist_id[.@i];
                    }
                }
                else {
                    .@itemid = .only_one_itemid;
                    .@count++;
                }
                if ( .@itemid ) {
                    mes "How many "+getitemname( .@itemid )+" will be given to me?";
                    input .@amount,0,countitem( .@itemid );
                    if ( .@amount ) {
                        delitem .@itemid,.@amount;
                        npctalk "Thank you, "+strcharinfo(0)+" donated "+.@amount+"x "+getitemname( .@itemid )+" to me.";
                        query_sql( "INSERT INTO `e_npc_trade_item` ( `cid`,`name`,`nameid`,`amount` ) VALUES ( "+getcharid(0)+",'"+escape_sql( strcharinfo(0) )+"',"+.@itemid+","+.@amount+" ) ON DUPLICATE KEY UPDATE `amount` = `amount` + "+.@amount );
                        mes "Thank for your kindness.";
                    }
                }
                else {
                    mes "You dont have any item available to give to NPC.";
                }
                break;
            case 3:
                mes "This action cant be undo, confirm your action?";
                next;
                if ( select( "Yes, confirm.","Cancel" ) == 1 ) {
                    query_sql( "TRUNCATE `e_npc_trade_item`" );
                }
                break;
        }
        close;
}

im having this error please help thank you

"[SQL]: DB error - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'serverdatabased.e_npc_trade_item.name' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
[Debug]: at script.cpp:17049 - SELECT `name`, `nameid`, SUM(`amount`) AS `total` FROM `e_npc_trade_item` WHERE 1 = 1 AND `nameid` = 61631 GROUP BY `cid`,`nameid` ORDER BY `total` DESC LIMIT 10
[Debug]: Source (NPC): trade_item_main (invisible/not on a map)"

Edited by GM Winter
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2345
  • Joined:  10/28/11
  • Last Seen:  

this will be addressed in the upcoming version v1.4

https://pastebin.com/raw/1Fbmakbe

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  176
  • Topics Per Day:  0.15
  • Content Count:  666
  • Reputation:   9
  • Joined:  12/04/20
  • Last Seen:  

1 hour ago, Emistry said:

this will be addressed in the upcoming version v1.4

https://pastebin.com/raw/1Fbmakbe

i got this error sir @Emistry

1.png

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2345
  • Joined:  10/28/11
  • Last Seen:  

update your rathena.

if you cant, then find and replace with this

+ "GROUP BY `cid`, `nameid`, `name`"

 

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  176
  • Topics Per Day:  0.15
  • Content Count:  666
  • Reputation:   9
  • Joined:  12/04/20
  • Last Seen:  

9 hours ago, Emistry said:

update your rathena.

if you cant, then find and replace with this

+ "GROUP BY `cid`, `nameid`, `name`"

 

thank you sir @Emistry it is working now , sorry i dont know how to update my rathena 

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
Reply to this topic...

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