summaryrefslogtreecommitdiff
path: root/npc/001-2-36/training_room_npc.txt
blob: d7f9e4436ee30eadfad7d328a0a71cfe58a41ed5 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
// TrainingRoom
//
// Author:
//     jak1
//
// Story:
//     Akko Teru
//     Reid
//
// Spellchecking & Dialogs
//     Reid

// ~~ VARS ~~
// $@FightingIsActive
//    0 = can Warp in Room (non active fight)
//    1 = can't Warp in Room (active fight)

//TODO adding rand messages like "try hit it harder..." for wave's


001-2-36,32,36,0	script	FightNPCName	NPC_LUCAS,{

    set $@NPCNAME$,     "FightNPCName";
    set $@NPCNEXTNAME$, "Samantha";
    set $@MOB_ID,       1021;
    set $@MOB_NAME$,    "Dummy";
    set $@CURRENT_WAVE_LEVEL, 1;
    set $@MAX_WAVES,    10;

    //Room and Mobspawn Coordinates
    // TL        BR
    setarray $@MOB_SPAWN_COORDINATES,     24,    34,    31,    41;
    setarray $@MAP_NAME$, "001-2-36";

    set @roomPlayers, getmapusers($@MAP_NAME$);

    if(@roomPlayers > 1)
        goto NotAlone;

    if ($@FightingIsActive == 1)
    {
        npctalk3 "You are not done now!";
        end;
    }

    //call in Warp door if (1 = block)
    set $@FightingIsActive, 1;

    if (!debug || !is_dev())
        goto start;

    //can be removed later!
    menu
        "get debug vars", debug_it,
        "reset char var", resetVar,
        "start training", -;


start:
    if (FIGHT_TRAINING >= 1)
        goto JobIsDone;

    getmapxy(.@map$, .@x, .@y, 0);
    if (.@x < 24 || .@x > 32 || .@y < 33 || .@y > 43)
    {
        speech 1, l("Please enter the combat zone on the left.");
        close;
    }

    setcells "001-2-36", 33, 35, 33, 38, 1, "fence";
    initnpctimer;
    setnpctimer 0;
    startnpctimer;

    npctalk3 l("Let's begin");
    end;


//cancel all actions, the Player needs to be alone in this Room
NotAlone:
    npctalk3 "You dont feel so great with audience!";
    set $@FightingIsActive, 0;
    end;


//If a Spawned Mob gets Killed
OnTrainingMobDead:
    if ($@CURRENT_WAVE_LEVEL == $@MAX_WAVES )
        goto FinishedTraining;

    set $@CURRENT_WAVE_LEVEL, $@CURRENT_WAVE_LEVEL + 1;
    setnpctimer 0;
    startnpctimer;
    end;


SpawnMonster:
    if ( $@FightingIsActive == 1 )
    {
        if ($@CURRENT_WAVE_LEVEL == $@MAX_WAVES)
        {
            npctalk "Last Wave!", $@NPCNAME$;
        }
        else
        {
            npctalk "Wave " + $@CURRENT_WAVE_LEVEL + "!", $@NPCNAME$;
        }

        areamonster "001-2-36", $@MOB_SPAWN_COORDINATES[0], $@MOB_SPAWN_COORDINATES[1], $@MOB_SPAWN_COORDINATES[2], $@MOB_SPAWN_COORDINATES[3], $@MOB_NAME$, $@MOB_ID, 1, $@NPCNAME$ + "::OnTrainingMobDead";
        stopnpctimer;
        setnpctimer 0;
    }
    else
    {
        set $@CURRENT_WAVE_LEVEL, 0;
    }
    stopnpctimer;
    setnpctimer 0;
    end;


//15 Secounds Waiting (Regeneration for fightRoom)
OnTimer5000:
    goto SpawnMonster;


FinishedTraining:
    //... TODO

    npctalk "Con. u finished it...", $@NPCNAME$;
    stopnpctimer;
    setnpctimer 0;
    set $@CURRENT_WAVE_LEVEL, 0;
    delcells "fence";
    if (FIGHT_TRAINING >= 1)
        end;
    set FIGHT_TRAINING, 1;
    end;

JobIsDone:
    mes "Well done, you should talk to \"" + $@NPCNEXTNAME$ + "\"...";
    close;


// ----- DEBUG START ! -----

debug_it:
    mes "DEBUG INFO";
    mes "- CharVariable:FIGHT_TRAINING "+ FIGHT_TRAINING;
    mes "- maxWaves "+ $@MAX_WAVES;
    mes "- currentWave "+ $@CURRENT_WAVE_LEVEL;
    mes "- npcName "+ $@NPCNAME$;
    mes "- mobName "+ $@MOB_NAME$;
    mes "- mobID "+ $@MOB_ID;
    close;

resetVar:
    set FIGHT_TRAINING , 0;
// ----- DEBUG END ! -----


OnInit:
    end;

}