summaryrefslogblamecommitdiff
path: root/npc/functions/goodbye.txt
blob: 94bc338db60f8955b0a845ed1e6adcce5ae84ce2 (plain) (tree)
1
2
3
4
5
6
7
8
9
10


                  
          
               




                                 
                                     
             
                                                                    
 
                                         













                                



                                                  



















































                                                                         











                                                                                
                                 

                
                           


          
// Evol functions.
// Author:
//    Reid
//    gumi
// Description:
//    script terminator functions



// goodbye_msg
//    Tell a random goodbye sentence.
// Variables:
//    .@rand = Random number between the number of "goodbye" choice.

function	script	goodbye_msg	{
    setarray .byemsg$[0],
        l("See you!"),
        l("See you later!"),
        l("See you soon!"),
        l("Bye!"),
        l("Farewell."),
        l("Bye then!"),
        l("Goodbye."),
        l("Bye for now."),
        l("Talk to you soon!"),
        l("Talk to you later!"),
        l("Have a good day!"),
        l("Cheers!"),
        l("Take care!");

    return .byemsg$[rand(getarraysize(.byemsg$))];
}



// cwarp
//     Closes the dialog, then warps the player.
//     You almost always want to use this instead of `warp`.
// usage:
//     cwarp;
//     cwarp x, y;
//     cwarp map, x, y;

function	script	cwarp	{
    .@map$ = getarg(0, "");
    .@x = getarg(1, 0);
    .@y = getarg(2, 0);

    if (getargcount() > 0 && getargcount() < 3)
    {
        .@npc$ = strnpcinfo(0);
        .@map$ = getvariableofnpc(.map$, .@npc$);
        .@x = getarg(0);
        .@y = getarg(1);
    }

    getmapxy .@pc_map$, .@pc_x, .@pc_y, UNITTYPE_PC; // get char location

    closedialog; // XXX: maybe send closeclientdialog in the future

    if (getargcount() < 1)
    {
        warp .@pc_map$, .@pc_x, .@pc_y; // no arguments, just refresh
        close;
    }

    if (.@map$ == .@pc_map$)
    {
        if (.@pc_x == .@x && .@pc_y == .@y)
        {
            close; // same location, don't move
        }

        else
        {
            slide .@x, .@y; // same map, slide instead of full warp
            close;
        }
    }

    warp .@map$, .@x, .@y; // different map, warp to given location
    close;
}



// cshop
//     closes the dialog, then opens a shop
//     if no npc is given, calls "#<npc> $"

function	script	cshop	{
    closedialog; // XXX: maybe send closeclientdialog in the future
    shop getarg(0, "#" + strnpcinfo(0) + " $");
    //close; => the shop buildin already sends close, and is a terminator itself
}


function	script	goodbye	{
    closedialog;

    npctalk3 goodbye_msg();

    close;
}