summaryrefslogtreecommitdiff
path: root/npc/magic/forget.txt
blob: 81e3cdf9f429cf513fce8ab9f5b2525c28cdbef4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// TMW2 script
// Author: Jesusalva <admin@tmw2.org>
//
// Magic Script: Forgetful NPCs
// Allows you to get rid of unwanted skills

// ForgetfulNPC( NAME, SCHOOL )
function	script	ForgetfulNPC	{
    .@n$=getarg(0);
    .@school=getarg(1);
    mesc l("Teaching %s your skills will make you both forget them.", .@n$), 1;
    mesc l("Once your skill is forgotten, the Magic Skill Points used will be freed."), 1;
    mesc l("But be careful: learning fees and research points WILL NOT be given back!"), 1;
    do
    {
        next;
        mesc l("Which skill will you FORGET permanently today?"), 1;
        setarray .@forget$, l("Cancel"), "-1";
        freeloop(true);
        for (.@i=0; .@i < getarraysize($@MSK_MAGIC) ; .@i++) {
            .@sk=$@MSK_MAGIC[.@i];
            if (getskilllv(.@sk)) {
                if ($@MSK_CLASS[.@sk] == .@school) {
                    array_push(.@forget$, getskillname(.@sk));
                    array_push(.@forget$, str(.@sk));
                }
            }
        }
        freeloop(false);
        menuint2(.@forget$);
        deletearray(.@forget$);
        if (@menuret < 1)
            close;
        mes "";
        mesc l("Skill @@ will be permanently lost!", getskillname(@menuret)), 1;
        mesc l("Continue anyway?"), 1;
        if (askyesno() == ASK_YES) {
            .@msp=0;
            .@lv=$@MSK_MSPCOST[@menuret]+max(0, getskilllv(@menuret)-5);
            skill @menuret, 0, 0;
            MAGIC_PTS-=.@lv;
            mesc l("Skill @@ has been lost", getskillname(@menuret)), 3;
            mesc l("You recovered @@ magic skill points", .@lv), 3;
        } else {
            mesn l("%s, the Forgetful", .@n$);
            mesq l("Uh, what?");
        }
    } while (@menuret);
    return;
}