summaryrefslogtreecommitdiff
path: root/npc/015-8/config.txt
blob: 6076fc9da7d0b36554a044339466040b052be505 (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
53
54
55
56
57
58
59
60
61
62
63
// TMW2 scripts.
// Author:
//    Jesusalva
// Description:
//    015-8 Sagratha Cave Configuration File

015-8	mapflag	zone	MMO
015-8-1	mapflag	zone	MMO

// Check instances and rebuild if needed
// Returns map name
// SaggyInstCheck( {house=true} )
function	script	SaggyInstCheck	{
	.@house=getarg(0, true);

	.@q2=getq2(HurnscaldQuest_Sagratha);
	// Map name limit: 4 chars (sgt1)
	.@mapn$="sgt1@"+getcharid(0);
	.@map2$="sgt2@"+getcharid(0);
	if (!(isinstance(.@q2) && .@q2 != 0)) {
		.@inst = instance_create("Sagratha House "+getcharid(0), getcharid(3), IOT_CHAR);
	    instance_attachmap("014-5-1", .@inst, false, .@mapn$);
	    //instance_attachmap("015-8", .@inst, false, .@mapn$);
	    instance_attachmap("015-8-1", .@inst, false, .@map2$);
	    // 40 minutes (2400s) inside, or 5 minutes (300s) outside
		instance_set_timeout(2400, 300, .@inst);
		instance_init(.@inst);
	    setq2 HurnscaldQuest_Sagratha, .@inst;
	}

	if (.@house) {
		return .@mapn$;
	} else {
		return .@map2$
	}
}

015-8,99,179,0	script	#Exit0158	NPC_HIDDEN,0,0,{
    end;

OnTouch:
    .@q=getq(HurnscaldQuest_Sagratha);
    .@q2=getq2(HurnscaldQuest_Sagratha);
    // Cheater Detected
    if (!MAGIC_LVL || .@q < 3) { 
        setq HurnscaldQuest_Sagratha, 0, 0, 0;
        sc_end SC_CASH_PLUSEXP;
        sc_end SC_OVERLAPEXPUP;
        sc_start SC_OVERLAPEXPUP, 300000, -20;
        warp "Save", 0, 0;
        return false;
    }

	mesc l("Return to Sagratha's House?");
	if (askyesno() == ASK_YES) {
		.@mapn$=SaggyInstCheck();
	    warp .@mapn$, 33, 35;
		changemusic .@mapn$, "eric_matyas_ghouls.ogg";
	}
	closeclientdialog;
	close;
}