Jump to content
  • 0
Sign in to follow this  
IndieRO

help to this script

Question

i try use script vending control by emistry

 

 

//===== eAthena Script =====================================
//= Vendor Control
//===== By: ================================================
//= Original by Emistry
//= Rewrite by AnnieRuru
//===== Current Version: ===================================
//= 1.0
//===== Compatible With: ===================================
//= Hercules 2014-02-18
//===== Description: =======================================
//= Vendors only vend on certain coordinate, looks tidy 
//===== Topic ==============================================
//= http://hercules.ws/board/topic/4509-
//===== Additional Comments: ===============================
//= Emistry would love his script rewritten by his master ?
//==========================================================

vend_zone,100,103,4    script    Vending Helper    4_GEFFEN_13,{
    mes "["+ strnpcinfo(1) +"]";
    if ( !getskilllv( "MC_VENDING" ) ) {
        mes "You dont have ^0055FFVending Skill^000000.";
        close;
    }
    mes "Select a slot and start vending.";
    while ( true ) {
        .@menu$ = .@currentpage ? "Previous Page:" : ":";
        .@pageindex = .@currentpage * .slotperpage;
        for ( .@i = 0; .@i < .slotperpage && .@pageindex + .@i < .count; .@i++ ) {
            if ( !getmapxy( .@map$, .@x, .@y, 1, "#vend_slot"+( .@pageindex + .@i ) ) && getareausers( .map$, .@x, .@y, .@x, .@y ) )
                .@menu$ = .@menu$ +"Slot No."+( .@pageindex + .@i +1 )+" - ^FF0000[UnAvailable]^000000:";
            else {
                .@menu$ = .@menu$ +"Slot No."+( .@pageindex + .@i +1 )+" - ^00CC00[Available]^000000:";
                .@available++;
            }
        }
        if ( .@currentpage != .maxpage )
            .@menu$ = .@menu$ + "Next Page";
        .@pick = select( .@menu$ ) -1;
        if ( !.@pick )
            .@currentpage--;
        else if ( .@pick == .slotperpage +1 )
            .@currentpage++;
        else
            break;
    }
    .@s =  .@currentpage * .slotperpage + .@pick -1 ;
    if ( !getmapxy( .@map$, .@x, .@y, 1, "#vend_slot"+ .@s ) && getareausers( .map$, .@x, .@y, .@x, .@y ) ) {
        mes " ";
        mes "This slot is ^FF0000[UnAvailable]^000000.";
        close;
    }
    warp .@map$, .@x, .@y;
    hideonnpc "#vend_slot"+ .@s;
    donpcevent "#vend_slot"+ .@s +"::OnCheckAvailable";
    end;
OnInit:
//    ======================= Configuration HERE =============================
    .map$ = "vend_zone"; // map
    setarray .@x, 56,59,62,65,68,71,74,77,80,83,86,89,92,95,104,107,110,113,116,119,122,125,128,131,134,137,140,143; // x coordinates
    setarray .@y, 140,145,113,0; // y coordinates
    .slotperpage = 20; // display how many slots per page (prevent making the menu too long)

//    too many people said this script causes vendor cannot vend at all on the map, ( coordinates has set too near )
//    because there is a setting in 'conf\battle\player.conf' to disallow player to vend too near other npcs
    setbattleflag "min_npc_vendchat_distance", 0; // comment this line to make the default value back to 3

    freeloop 1;
    setcell .map$, 0,0, 500,500, cell_novending, 1;
    .@x_size = getarraysize( .@x );
    .@y_size = getarraysize( .@y );
    .@i = 0;
    while ( .@i < .@y_size ) {
        .@j = 0;
        while ( .@j < .@x_size ) {
            if ( checkcell( .map$, .@x[.@j], .@y[.@i], cell_chkpass ) ) {
                movenpc "#vend_slot"+ .count, .@x[.@j], .@y[.@i];
                setcell .map$, .@x[.@j], .@y[.@i], .@x[.@j], .@y[.@i], cell_novending, 0;
                if ( getareausers( .map$, .@x[.@j], .@y[.@i], .@x[.@j], .@y[.@i] ) ) {
                    hideonnpc "#vend_slot"+ .count;
                    donpcevent "#vend_slot"+ .count +"::OnCheckAvailable";
                }
                .count++;
            }
            .@j++;
        }
        .@i++;
    }
    .maxpage = .count / .slotperpage + ( .count % .slotperpage > 0 ) -1;
    end;
}

-    script    vend_slot    -1,{
    mes "[Vending Slot]";
    getmapxy .@map$, .@x, .@y, 1;
    if ( !getskilllv( "MC_VENDING" ) ) {
        mes "You dont have ^0055FFVending Skill^000000.";
        close;
    }
    else if ( getareausers( .@map$, .@x, .@y, .@x, .@y ) ) {
        mes "Someone already using this slot";
        close;
    }
    mes "Spot : ^777777Available^000000";
    mes "^0055FF[ Vending Area Rules ]^000000";
    mes "^FF0000 ~ Use proper Shop Name.^000000";
    mes "^777777Player who failed to follow these rules will be punished.^000000";
    unitwalk getcharid(3), .@x, .@y;
    hideonnpc strnpcinfo(0);
    donpcevent strnpcinfo(0)+"::OnCheckAvailable";
    close;
OnCheckAvailable:
    sleep 10000;
    getmapxy .@map$, .@x, .@y, 1;
    while ( getareausers( .@map$, .@x, .@y, .@x, .@y ) ) sleep 10000;
    hideoffnpc strnpcinfo(0);
    end;
}

// Add more if needed.
vend_zone,0,0,4    duplicate(vend_slot)    #vend_slot0    4_BULLETIN_BOARD2

 

 

it's possible to setting locate without using array just use spesific X and Y?

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

 

You would have to rewrite the npc. I think the way it's set up is quite nice.

I know this script is already good but does not match with map  I use

btw i use this map to vending area

 

https://rathena.org/board/topic/67742-custom-vending-map/

 

You can set the map x and y location according to your liking, configuration can be found in line 58-61 in your script provided in the first post.

Share this post


Link to post
Share on other sites
  • 0

@@Legend can you give me some example to configuration coordinat x and y without array? and still connected with npc vending helper

 

thxx

Edited by melv0

Share this post


Link to post
Share on other sites
  • 0

 

//    ======================= Configuration HERE =============================
    .map$ = "vend_zone"; // map
    setarray .@x, 56,59,62,65,68,71,74,77,80,83,86,89,92,95,104,107,110,113,116,119,122,125,128,131,134,137,140,143; // x coordinates
    setarray .@y, 140,145,113,0; // y coordinates

 

.@x = all the possible x coordinates. This means any cells listed here are acceptable.]

.@y = all the possibly y coordinates.

 

These work like multiplication. Example, the x coordinate of 56 can also possess the y coordinate 140, 145, 113 and 0.

Meaning these cells are acceptable.

56,140

56,145

56,113

56,0

 

At least I think that's how it works. Haven't used this script before.

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.