summaryrefslogtreecommitdiff
path: root/npc/003-1/magic.txt
blob: 3eb936703425a5fb395c8c56a5b2d901bfc63264 (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
// TMW2 scripts.
// Authors:
//    Jesusalva
// Description:
//    Controlled Warp to Magic School (+whatever magic stuff we need to add later)

003-1,34,33,0	script	#MagicSchoolGate1	NPC_HIDDEN,0,0,{
    end;
OnTouch:
    // Event Restrictions
    if (countitem(Event1HSword)+countitem(Event2HSword)+countitem(EventBow)+countitem(EventWand)+countitem(RentCart)) {
        mesc l("You cannot enter here while you have event weapons or a cart."), 1;
        close;
    }
    // Main Quest Event
    if (LUA_ASKED_TO_SAVE_PROFESSOR) {
    	.@mapn$="0030@"+getcharid(0);
        // Instance doesn't exists
        if (!(isinstance(LUA_ASKED_TO_SAVE_PROFESSOR)) || instanceowner(LUA_ASKED_TO_SAVE_PROFESSOR) != getcharid(3)) {
		    .@inst = instance_create("Academy "+getcharid(0), getcharid(3), IOT_CHAR);
	        instance_attachmap("003-0", .@inst, false, .@mapn$);
	        // Instance lasts 15 minutes
		    instance_set_timeout(900, 900, .@inst);
		    instance_init(.@inst);
            LUA_ASKED_TO_SAVE_PROFESSOR=.@inst;
        }
        /* else {
            // Instance already exists: You've failed previously?
		    instance_set_timeout(900, 900, .@inst);
        }
        */
        warp .@mapn$, 48, 51;
        end;
    }
    /*
    if (countitem(JesusalvaGrimorium) <= 0 || MAGIC_LVL < 2) {
        slide 36, 39;
        percentheal -5, -10;
        dispbottom l("Powerful magic repels you away from this magic place!");
    }
    */
    warp "003-0", 48, 51;
    end;
}