summaryrefslogtreecommitdiff
path: root/npc/015-8-1/puzzle.txt
blob: f0827c2cf89400a7970d4b117022a1ac79fe6403 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
// TMW2 scripts.
// Author:
//    Jesusalva
// Description:
//    PUZZLES and TRAPS submodule - Sagratha's Cave Boss Room - 015-8-1

// Exit area
015-8-1,50,79,0	script	#Exit01581	NPC_HIDDEN,1,0,{
    end;
OnTouch:
    .@q=getq(HurnscaldQuest_Sagratha);
    // Cheater Detected
    if (!MAGIC_LVL || .@q < 5) { 
        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;
        end;
    }
    if (.@q == 5) {
        dispbottom l("You are NOT allowed to leave here!");
    } else {
        warp "015-8", 94, 21;
    }
    end;
}


015-8-1,0,0,0	script	#SaggyBossTrap01	NPC_TRAP,0,0,{
    end;
OnTouchNPC:
OnTouch:
    // instance_id()
    if (instance_id() >= 0)
        SteelTrap(rand2(10, 40), 5, any(0,0,0,1), instance_npcname(.name$));
    else
        SteelTrap(rand2(10, 40), 5, any(0,0,0,1));
    end;

OnTimer10000:
    stopnpctimer;
    setnpctimer 0;
    setnpcdisplay .name$, NPC_TRAP;
    end;


OnInstanceInit:
    .@x=rand(20,80);
    .@y=rand(20,80);
    movenpc instance_npcname(.name$), .@x, .@y;
    // It's on a wall, let's remove it
    if (!checkcell(instance_mapname("015-8-1"), .@x, .@y, cell_chkpass)) {
        disablenpc instance_npcname(.name$);
    }
    end;

OnInit:
    disablenpc .name$;
    end;
}

// Create more traps. (They can be on walls so amount is random >.<)
015-8-1,0,0,0	duplicate(#SaggyBossTrap01)	#SaggyBossTrap02	NPC_TRAP,0,0
015-8-1,0,0,0	duplicate(#SaggyBossTrap01)	#SaggyBossTrap03	NPC_TRAP,0,0
015-8-1,0,0,0	duplicate(#SaggyBossTrap01)	#SaggyBossTrap04	NPC_TRAP,0,0
015-8-1,0,0,0	duplicate(#SaggyBossTrap01)	#SaggyBossTrap05	NPC_TRAP,0,0
015-8-1,0,0,0	duplicate(#SaggyBossTrap01)	#SaggyBossTrap06	NPC_TRAP,0,0
015-8-1,0,0,0	duplicate(#SaggyBossTrap01)	#SaggyBossTrap07	NPC_TRAP,0,0
015-8-1,0,0,0	duplicate(#SaggyBossTrap01)	#SaggyBossTrap08	NPC_TRAP,0,0
015-8-1,0,0,0	duplicate(#SaggyBossTrap01)	#SaggyBossTrap09	NPC_TRAP,0,0
015-8-1,0,0,0	duplicate(#SaggyBossTrap01)	#SaggyBossTrap10	NPC_TRAP,0,0
015-8-1,0,0,0	duplicate(#SaggyBossTrap01)	#SaggyBossTrap11	NPC_TRAP,0,0
015-8-1,0,0,0	duplicate(#SaggyBossTrap01)	#SaggyBossTrap12	NPC_TRAP,0,0
// twelve traps should be enough