Jump to content
  • 0

OGH Hard Mode problem


DanTheMan

Question


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  13
  • Reputation:   0
  • Joined:  01/28/20
  • Last Seen:  

Hello everyone,

I've just added this script to my server. It works fine until the first mobs are spawned.

areamonster .@map$,76,99,87,10,"Grand Chamberlain in pain",2466,15,.@label$;
	if('oghMode == 2)
	{
		for( .@i = 0; .@i < getarraysize($@mobId); .@i++ )
		{
			setunitdata($@mobId[.@i], UDT_MAXHP, 416200);
			setunitdata($@mobId[.@i], UDT_HP, 416200);
		}
	}

This seems to work (at least they're spawning) but the map-server tells me:

Quote

[Error]: get_val_: fatal error ! player not attached!
[Debug]: Function: setunitdata (3 parameters):
[Debug]: Data: number value=110023921
[Debug]: Data: variable name='UDT_MAXHP' index=0
[Debug]: Data: number value=416200
[Debug]: Source (NPC): #ghmemorialmob01 at 1@gl_k (0,0)
[Warning]: script:get_val: cannot access player variable 'UDT_MAXHP', defaulting to 0

I think this could be the reason why there are no other mobs.

If I kill one monster then, this is triggered:

if (.@mob_dead_num > 35) {
		mapannounce .@map$,"Himelmez's curse is getting weaker. Find any survivors!",bc_map,"0xFFFFFF";
		killmonster .@map$,.@label$;
		donpcevent instance_npcname("Altar boy Domun#clearGH")+"::OnEnable";
		donpcevent instance_npcname("#ghmemorialmob01")+"::OnDisable";
	}

Makes sense. Because if there are only 10 mobs, there will be only 9 left after I killed one.

After that the boy unhides as he should. When the next mob group gets spawned then, the map-server tells me the same in green.

[Error]: get_val_: fatal error ! player not attached!
[Debug]: Function: setunitdata (3 parameters):
[Debug]: Data: number value=110024063
[Debug]: Data: variable name='UDT_MAXHP' index=0
[Debug]: Data: number value=416200
[Debug]: Source (NPC): #ghmemorialmob02 at 1@gl_k (0,0)
[Warning]: script:get_val: cannot access player variable 'UDT_MAXHP', defaulting to 0

 

The script is just copy+pasted. I've changed nothing.

 

Does anyone have a clue how to fix that? Heres the full script:

//= Old Glast Heim
//===== By: ================================================== 
//= Ziu, Heris (translation)
//===== Current Version: ===================================== 
//= 1.4
//===== Compatible With: ===================================== 
//= rAthena SVN
//===== Description: ========================================= 
//= Discover the history of events that took place in the
//= Glast Heim castle and how it ended up in ruins.
//===== Changelogs: ================================= 
//= 1.0 First version. [Euphy]
//=     This is a custom version, and may contain bugs.
//= 1.1 Bug fixes; removed redundant OnInstanceInit scripts.
//= 1.2 Add NPC Hugin's Follower [exneval]
//=     NPC that give access to Glast Heim Nightmare Mode.
//= 1.3 Add some NPCs placeholder. [exneval]
//= 1.4 Update to its official text. [exneval]
//=     Support merchant, enchant, socket features.
//= 1.5 idAthena merge. Removed Hugin's Follower NPCs. [Secretdataz]
//=     Changed `set` calls to direct assignments.
//=     Cleaned up the script.
//=     TODO: Confirm Hugin NPC's code flow.
//=     TODO: Dialogues "Engrish" cleanup.
//============================================================ 

glast_01,204,273,6    script    Hugin#ghinstance    755,{
    if (BaseLevel < 130) {
        mes "[Hugin]";
        mes "Why don't you come back after becoming stronger?";
        mes "Maybe, level 130.";
        close;
    }
    if (ghinstance == 1) {
        mes "[Hugin]";
        mes "Umm? Did you see me at another place? I don't think so. What about this time?";
        if (checkquest(12322) == 1) {
            erasequest 12322;
        }
        next;
    } else {
        mes "[Hugin]";
        mes "A long time ago, this castle did not like this.";
        next;
        mes "[Hugin]";
        mes "Ah I'm sorry. I'm muttering in front of a stranger.";
        next;
        mes "[Hugin]";
        mes "My name is Hugin. I'm studying the dimensional gap between time and space.";
        next;
        select("There's something like that here?");
        mes "[Hugin]";
        mes "Have you ever wondered about history of Glast Heim?";
        next;
        mes "[Hugin]";
        mes "There was a King named Shumiche who was known as a tyrant in the history of the Rune-Midgarts Kingdom.";
        next;
        mes "[Hugin]";
        mes "Time will reveal the true answers if we look in the right places.";
        next;
        if (select("I don't care about history","That is interesting. Find anything?") == 1) {
            mes "[Hugin]";
            mes "Really? Hmm, please come back later when you are interested then.";
            close;
        }
        mes "[Hugin]";
        mes "Actually, dimensional time travel is possible but I'm so afraid to go there.";
        next;
        mes "[Hugin]";
        mes "Yes! It might be possible for you.";
        next;
        mes "[Hugin]";
        mes "Do you want to time travel?";
        next;
        if (select("No, thanks.","Yes, of course I do!") == 1) {
            mes "[Hugin]";
            mes "Really? But, jumping gigawatts this is such a great opportunity.";
            close;
        }
        mes "[Hugin]";
        mes "I knew that you would understand what I said. Well, please tell what you gonna do.";
        setquest 12316;
        set ghinstance,1;
        next;
    }
    set .@ghins_time,checkquest(12317,PLAYTIME);
    if (.@ghins_time == -1) {
        set .@party_id,getcharid(1);
        set .@p_name$,getpartyname(.@party_id);
        set .@md_name$,"Old Glast Heim";
        if (!instance_check_party(.@party_id)) {
            mes "[Hugin]";
            mes "Why don't you make a party with more than 1 person and talk to me again?";
            close;
        }
        if (getcharid(0) == getpartyleader(.@party_id,2)) {
            if (checkquest(12316) == 1)
                erasequest 12316;
            if (checkquest(12318,HUNTING) == -1)
                setquest 12318;
            set .@menu$,"Generate Time Gap:Enter Old Glast Heim:Cancel";
        } else {
            if (checkquest(12316) == 1) {
                mes "[Hugin]";
                mes "Have we met before? No way. It's my first time seeing you. What do you want?";
                erasequest 12316;
            }
            if (checkquest(12318,HUNTING) == -1)
                setquest 12318;
            set .@menu$,":Enter Old Glast Heim:Cancel";
        }
        switch(select(.@menu$)) {
        case 1:
            next;
            mes("[Hugin]");
            mes("Right, choose a mode then.");
            $oghMode = select("Normal Mode","Hard Mode");
            next;
        
            switch (instance_create(.@md_name$)) {
            case -3:
                dispbottom "Memorial Dungeon, 'Old Glast Heim' is already in progress.",0xFFFFFF;
                close;
            case -4:
            case -2:
            case -1:
                mes "Party Name: "+.@p_name$;
                mes "Party Leader: "+strcharinfo(0);
                mes "^0000ff"+.@md_name$+"^000000 - time gap generation failed.";
                close;
            }
            mes "[Hugin]";
            mes "After the time gap opens, please tell me again.";
            close;
        case 2:
            switch(instance_enter(.@md_name$)) {
            case 3: //Custom text
                mes "[Hugin]";
                mes "Sorry, I won't let you enter the time gap. There's something wrong with the dimension right now.";
                close;
            case 2:
                mes "[Hugin]";
                mes "The time gap is not yet open.";
                close;
            case 1:
                mes "[Hugin]";
                mes "Your body is not fit to enter the time gap. You won't be able to get in if you're not in a party.";
                close;
            case 0:
                mapannounce "glast_01",.@p_name$ + " party member " + strcharinfo(0) + " enters the Old Glast Heim",bc_map,"0x00ff99";
                setquest 12317;
                //warp "1@gl_k",150,20;
                close;
            }
            break;
        case 3:
            close;
        }
    } else if (.@ghins_time == 0 || .@ghins_time == 1) {
        mes "[Hugin]";
        mes "Oh, my...";
        mes "You still have after-effects of time travel. You can't travel again with this condition.";
        next;
        mes "[Hugin]";
        mes "Staying healthy is important so please take a break and come back again later.";
        close;
    } else {
        mes "^0000ffAll trace of access to Old Glast Heim have been removed. Now you can talk with Hugin again.^000000";
        if (checkquest(12318,HUNTING) == -1)
            setquest 12318;
        erasequest 12317;
        close;
    }
}

// Floor 1
//============================================================
1@gl_k,149,41,6    script    Varmundt#ghinstance1    654,{
    if (getcharid(0) == getpartyleader(getcharid(1),2)) {
        cutin "gl_barmund1",2;
        mes "[Varmundt]";
        mes "Are you the one ^0000ffHerico^000000 sent to help me?";
        npctalk "Are you the one Herico sent to help me?";
        next;
        select("Oh. Well I...");
        mes "["+strcharinfo(0)+"]";
        mes "Ah yes, I am. Herico told me to meet you.";
        unittalk getcharid(3),"Ah yes, I am. Herico told me to meet you.";
        next;
        cutin "gl_barmund2",2;
        mes "[Varmundt]";
        mes "We don't have much time. We must report to Sir. Heinrich about Himelmez's invasion.";
        npctalk "We don't have much time. We must report to Sir. Heinrich about Himelmez's invasion.";
        next;
        select("Himelmez...");
        mes "["+strcharinfo(0)+"]";
        mes "Who is Himelmez?";
        unittalk getcharid(3),"Who is Himelmez?";
        next;
        cutin "gl_barmund3",2;
        mes "[Varmundt]";
        mes "Herico didn't tell you?";
        npctalk "Herico didn't tell you?";
        next;
        cutin "gl_barmund2",2;
        mes "[Varmundt]";
        mes "She is the Ruler of Death, Dead man's Valkyrie. Himelmez is looking to take the hart of Ymir from us.";
        npctalk "She is the Ruler of Death, Dead man's Valkyrie. Himelmez is looking to take the hart of Ymir from us.";
        next;
        mes "[Varmundt]";
        mes "She might even destroy this whole castle if she wanted to.";
        npctalk "She might even destroy this whole castle if she wanted to.";
        next;
        mes "[Varmundt]";
        mes "Hurry! Report to Sir. Heinrich about Himelmez. I must check the defense barrier here!";
        npctalk "Hurry! Report to Sir. Heinrich about Himelmez. I must check the defense barrier here!";
        close2;
        cutin "gl_barmund2",255;
        donpcevent instance_npcname("Varmundt#ghinstance1")+"::OnDisable";
        end;
    } else {
        cutin "gl_barmund2",2;
        mes "[Varmundt]";
        mes "Where's your leader? I need his help.";
        close2;
        cutin "gl_barmund2",255;
        end;
    }
OnInstanceInit:
    donpcevent instance_npcname("Varmundt#ghinstance1")+"::OnEnable";
    'oghMode = $oghMode;
    'hardModeLootChance = 50; //default 50/1000, or 0.05%, change to increase chance
    end;
OnDisable:
    hideonnpc instance_npcname("Varmundt#ghinstance1");
    hideoffnpc instance_npcname("Heinrich#ghinstance1");
    hideoffnpc instance_npcname("Varmundt#ghinstance2");
    end;
OnEnable:
    hideoffnpc instance_npcname("Varmundt#ghinstance1");
    end;
}

1@gl_k,145,54,6    script    Khalitzburg Knightage#1    655,{
    mes "["+strnpcinfo(1)+"]";
    switch ((atoi(strnpcinfo(2)) + 1) / 2) {
        case 1: mes "Is there something you need?"; break;
        case 2: mes "What can I do for you?"; break;
        case 3: mes "..."; break;
        case 4: mes "I do not like to chat during work."; break;
        case 5: mes "Doesn't this castle seem weird all of a sudden? Something's not quite right."; break;
        case 6: mes "How do you know Varmundt? I heard that he's not really a friendly man..."; break;
        case 7: mes "Orders please."; break;
        case 8: mes "Please do not make a mess here."; break;
        case 9: mes "I had a weird dream last night. My mom was in it... Wonder if she is ok..."; break;
        case 10: mes "Are you wit Varmundt? Commander is waiting for you."; break;
        case 11: mes "My work shift will be over soon, but the next crew is not coming."; break;
    }
    close;
OnDisable:
    hideonnpc instance_npcname(strnpcinfo(0));
    end;
OnEnable:
    hideoffnpc instance_npcname(strnpcinfo(0));
    end;
}
1@gl_k,154,54,3    duplicate(Khalitzburg Knightage#1)    Khalitzburg Knightage#2    655
1@gl_k,145,59,6    duplicate(Khalitzburg Knightage#1)    White Knight#3    657
1@gl_k,154,59,3    duplicate(Khalitzburg Knightage#1)    White Knight#4    657
1@gl_k,145,64,6    duplicate(Khalitzburg Knightage#1)    Khalitzburg Knightage#5    655
1@gl_k,154,64,3    duplicate(Khalitzburg Knightage#1)    Khalitzburg Knightage#6    655
1@gl_k,145,69,6    duplicate(Khalitzburg Knightage#1)    White Knight#7    657
1@gl_k,154,69,3    duplicate(Khalitzburg Knightage#1)    White Knight#8    657
1@gl_k,145,74,6    duplicate(Khalitzburg Knightage#1)    Khalitzburg Knightage#9    655
1@gl_k,154,74,3    duplicate(Khalitzburg Knightage#1)    Khalitzburg Knightage#10    655
1@gl_k,145,79,6    duplicate(Khalitzburg Knightage#1)    White Knight#11    657
1@gl_k,154,79,3    duplicate(Khalitzburg Knightage#1)    White Knight#12    657
1@gl_k,145,84,6    duplicate(Khalitzburg Knightage#1)    Khalitzburg Knightage#13    655
1@gl_k,154,84,3    duplicate(Khalitzburg Knightage#1)    Khalitzburg Knightage#14    655
1@gl_k,145,89,6    duplicate(Khalitzburg Knightage#1)    White Knight#15    657
1@gl_k,154,89,3    duplicate(Khalitzburg Knightage#1)    White Knight#16    657
1@gl_k,145,94,6    duplicate(Khalitzburg Knightage#1)    Khalitzburg Knightage#17    655
1@gl_k,154,94,3    duplicate(Khalitzburg Knightage#1)    Khalitzburg Knightage#18    655
1@gl_k,145,99,6    duplicate(Khalitzburg Knightage#1)    White Knight#19    657
1@gl_k,154,99,3    duplicate(Khalitzburg Knightage#1)    White Knight#20    657
1@gl_k,145,104,6    duplicate(Khalitzburg Knightage#1)    Khalitzburg Knightage#21    655
1@gl_k,154,104,3    duplicate(Khalitzburg Knightage#1)    Khalitzburg Knightage#22    655

1@gl_k,149,100,6    script    Heinrich#ghinstance1    652,{
    if (getcharid(0) == getpartyleader(getcharid(1),2)) {
        cutin "gl_heinrich2",2;
        select("Sir. Heinrich. Varmundt...");
        mes "["+strcharinfo(0)+"]";
        mes "Sir. Heinrich. Do you know what is happening in the castle now?";
        unittalk getcharid(3),"Sir. Heinrich. Do you know what is happening in the castle now?";
        next;
        mes "[Heinrich]";
        mes "Aren't you the adventurer that came along with Varmundt?";
        npctalk "Aren't you the adventurer that came along with Varmundt?";
        next;
        mes "[Heinrich]";
        mes "What is it? Something wrong with the castle?";
        npctalk "What is it? Something wrong with the castle?";
        next;
        select("Himelmez's invasion...");
        mes "["+strcharinfo(0)+"]";
        mes "Dead man's Valkyrie, Himelmez is coming to take the Ymir's Heart piece hidden inside this castle!";
        unittalk getcharid(3),"Dead man's Valkyrie, Himelmez is coming to take the Ymir's Heart piece hidden inside this castle!";
        next;
        cutin "gl_heinrich1",2;
        mes "[Heinrich]";
        mes "Haha. Funny. Do you really think that is possible?";
        npctalk "Haha. Funny. Do you really think that is possible?";
        next;
        cutin "gl_barmund2",2;
        mes "[Varmundt]";
        mes "I'm not kidding, Sir. Heinrich. If I'm correct, then she will be here very soon.";
        donpcevent instance_npcname("Varmundt#ghinstance2")+"::OnTalk1";
        next;
        mes "[Varmundt]";
        mes "We must hide the heart piece to a safe place before Himelmez's attack starts!";
        donpcevent instance_npcname("Varmundt#ghinstance2")+"::OnTalk2";
        next;
        select("Even if you don't believe me...");
        mes "["+strcharinfo(0)+"]";
        mes "I can't make you believe me, but there's no time to argue!";
        unittalk getcharid(3),"I can't make you believe me, but there's no time to argue!";
        cutin "gl_barmund2",255;
        next;
        cutin "gl_heinrich1",2;
        mes "[Heinrich]";
        mes "Thank you for the help. But, we don't even have our king with us right now.";
        npctalk "Thank you for the help. But, we don't even have our king with us right now.";
        next;
        mes "[Heinrich]";
        mes "We cannot risk moving the heart just because some stranger says so.";
        npctalk "We cannot risk moving the heart just because some stranger says so.";
        close2;
        donpcevent instance_npcname("Heinrich#ghinstance1")+"::OnDisable";
        donpcevent instance_npcname("Heinrich#ghinstance2")+"::OnEnable";
        donpcevent instance_npcname("Himelmez#ghinstance1")+"::OnEnable";
        donpcevent instance_npcname("#talkinstance1")+"::OnEnable";
        mapannounce instance_mapname("1@gl_k"),"????'s: Muahahahaha~!",bc_map,"0xFFFF00",FW_NORMAL,18;
        cutin "gl_heinrich1",255;
        end;
    } else {
        cutin "gl_heinrich2",2;
        mes "[Heinrich]";
        mes "Where is your leader? I must talk to him.";
        close2;
        cutin "gl_heinrich2",255;
        end;
    }
OnInstanceInit:
OnDisable:
    hideonnpc instance_npcname("Heinrich#ghinstance1");
    end;
OnEnable:
    hideoffnpc instance_npcname("Heinrich#ghinstance1");
    end;
}

1@gl_k,152,97,3    script    Varmundt#ghinstance2    654,{
    end;
OnInstanceInit:
OnDisable:
    hideonnpc instance_npcname("Varmundt#ghinstance2");
    end;
OnEnable:
    hideoffnpc instance_npcname("Varmundt#ghinstance2");
    end;
OnTalk1:
    npctalk "I'm not kidding, Sir. Heinrich. If I'm correct, then she will be here very soon.";
    end;
OnTalk2:
    npctalk "We must hide the heart piece to a safe place before Himelmez's attack starts!";
    end;
OnTalk3:
    npctalk "Himelmez!! Already!";
    end;
OnTalk4:
    npctalk "Sir. Heinrich, they're all monsters. You need to give them rest!";
    end;
OnTalk5:
    npctalk "Sir. Heinrich! We don't have much time!";
    end;
OnTalk6:
    npctalk "If you hurry now, there's a chance!";
    end;
}

1@gl_k,149,97,6    script    Heinrich#ghinstance2    652,{
    end;
OnInstanceInit:
OnDisable:
    hideonnpc instance_npcname("Heinrich#ghinstance2");
    end;
OnEnable:
    hideoffnpc instance_npcname("Heinrich#ghinstance2");
    end;
OnTalk1:
    npctalk "Who are you?";
    end;
OnTalk2:
    npctalk "Aren't you a little too feminine to be the Ruler of death? We are not afraid of you...";
    end;
OnTalk3:
    npctalk "What?";
    end;
OnTalk4:
    npctalk "My king is visiting the Rune-Midgarts royal family. He's not back yet.";
    end;
OnTalk5:
    npctalk "And now you are trying to trick me, what has happened to him?!";
    end;
OnTalk6:
    npctalk "She probably already knows where the Ymir's heart piece is.";
    end;
OnTalk7:
    npctalk "All Khalitzburg and White Knights should follow me now...";
    end;
OnTalk8:
    npctalk "My men... This can't be happening!";
    end;
OnTalk9:
    npctalk "I'm so sorry...";
    end;
OnTalk10:
    npctalk "I am sorry, my knights! Forgive me!";
    end;
}

1@gl_k,149,100,6    script    Heinrich#ghinstance3    652,{
    end;
OnInstanceInit:
OnDisable:
    hideonnpc instance_npcname("Heinrich#ghinstance3");
    end;
OnEnable:
    hideoffnpc instance_npcname("Heinrich#ghinstance3");
    end;
OnTalk1:
    npctalk "I killed my own men...";
    end;
OnTalk2:
    npctalk "Varmundt is right. Now is not the time for mourning.";
    end;
OnTalk3:
    npctalk "I have a request to you followers.";
    end;
OnTalk4:
    npctalk "Himelmez can turn living beings into monsters.";
    end;
OnTalk5:
    npctalk "But, there might still be survivors here.";
    end;
OnTalk6:
    npctalk "Destroy the monsters and find any survivors.";
    end;
OnTalk7:
    npctalk "Varmundt and I will chase Himelmez.";
    end;
OnTalk8:
    npctalk "Very well, Varmundt. Let's find Himelmez.";
    end;
}

1@gl_k,149,89,1    script    Himelmez#ghinstance1    650,{
    end;
OnInstanceInit:
OnDisable:
    hideonnpc instance_npcname("Himelmez#ghinstance1");
    end;
OnEnable:
    hideoffnpc instance_npcname("Himelmez#ghinstance1");
    end;
OnTalk1:
    npctalk "Well well~ Am I interrupting you? Weren't you expecting me?";
    end;
OnTalk2:
    npctalk "My name is Lisa Kahn Himelmez. Master of Dullahan, Dead man's Valkyrie, that's what they call me.";
    end;
OnTalk3:
    npctalk "Let's see if you can relax like that after you find out where your king is.";
    end;
OnTalk4:
    npctalk "Hmm, now I have your attention do I not?";
    end;
OnTalk5:
    npctalk "It's a pity to meet you in a situation like this.";
    end;
Ontalk6:
    npctalk "Well~ I would love to sit down and explain for you, but I'm kind of busy today~";
    end;
Ontalk7:
    npctalk "I have business to take care of. My minions will treat you well enough for me~";
    end;
}

// Control Timer
//============================================================
1@gl_k,0,0,0    script    #talkinstance1    -1,{
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname("#talkinstance1");
    end;
OnEnable:
    enablenpc instance_npcname("#talkinstance1");
    initnpctimer;
    end;
OnTimer1500:
    donpcevent instance_npcname("Heinrich#ghinstance2")+"::OnTalk1";
    end;
OnTimer4500:
    donpcevent instance_npcname("Himelmez#ghinstance1")+"::OnTalk1";
    end;
OnTimer10000:
    donpcevent instance_npcname("Varmundt#ghinstance2")+"::OnTalk3";
    end;
OnTimer17500:
    donpcevent instance_npcname("Himelmez#ghinstance1")+"::OnTalk2";
    end;
OnTimer22000:
    donpcevent instance_npcname("Heinrich#ghinstance2")+"::OnTalk2";
    end;
OnTimer28500:
    donpcevent instance_npcname("Himelmez#ghinstance1")+"::OnTalk3";
    end;
OnTimer36000:
    donpcevent instance_npcname("Heinrich#ghinstance2")+"::OnTalk3";
    end;
OnTimer41000:
    donpcevent instance_npcname("Himelmez#ghinstance1")+"::OnTalk4";
    end;    
OnTimer54000:
    donpcevent instance_npcname("Himelmez#ghinstance1")+"::OnTalk5";
    end;
OnTimer59000:
    donpcevent instance_npcname("Heinrich#ghinstance2")+"::OnTalk4";
    end;
OnTimer66500:
    donpcevent instance_npcname("Heinrich#ghinstance2")+"::OnTalk5";
    end;
OnTimer71500:
    donpcevent instance_npcname("Himelmez#ghinstance1")+"::OnTalk6";
    end;
OnTimer78000:
    donpcevent instance_npcname("Himelmez#ghinstance1")+"::OnTalk7";
    end;
OnTimer84500:
    donpcevent instance_npcname("Heinrich#ghinstance2")+"::OnTalk6";
    donpcevent instance_npcname("Himelmez#ghinstance1")+"::OnDisable";
    end;
OnTimer90500:
    donpcevent instance_npcname("Heinrich#ghinstance2")+"::OnTalk7";
    end;
OnTimer92000:
    for (set .@i,1; .@i<=20; set .@i,.@i+4) {
        hideonnpc instance_npcname("Khalitzburg Knightage#"+.@i);
        hideonnpc instance_npcname("Khalitzburg Knightage#"+(.@i+1));
        hideonnpc instance_npcname("White Knight#"+(.@i+2));
        hideonnpc instance_npcname("White Knight#"+(.@i+3));
    }
    hideonnpc instance_npcname("Khalitzburg Knightage#21");
    hideonnpc instance_npcname("Khalitzburg Knightage#22");

    set .@map$,instance_mapname("1@gl_k");
    set .@label$,instance_npcname("#talkinstance1")+"::OnMyMobDead"; 
    monster .@map$,145,59,"Abyss Knight",2470,1,.@label$;
    set .@mobId, $@mobId[0];
    if('oghMode == 2)
    {
        setunitdata(.@mobId, UMOB_MAXHP, 451578);
        setunitdata(.@mobId, UMOB_HP, 451578);
    }
    
    monster .@map$,154,59,"Abyss Knight",2470,1,.@label$;
    set .@mobId, $@mobId[0];
    if('oghMode == 2)
    {
        setunitdata(.@mobId, UMOB_MAXHP, 451578);
        setunitdata(.@mobId, UMOB_HP, 451578);
    }
    monster .@map$,145,69,"Abyss Knight",2470,1,.@label$;
    set .@mobId, $@mobId[0];
    if('oghMode == 2)
    {
        setunitdata(.@mobId, UMOB_MAXHP, 451578);
        setunitdata(.@mobId, UMOB_HP, 451578);
    }
    monster .@map$,154,69,"Abyss Knight",2470,1,.@label$;
    set .@mobId, $@mobId[0];
    if('oghMode == 2)
    {
        setunitdata(.@mobId, UMOB_MAXHP, 451578);
        setunitdata(.@mobId, UMOB_HP, 451578);
    }
    monster .@map$,145,79,"Abyss Knight",2470,1,.@label$;
    set .@mobId, $@mobId[0];
    if('oghMode == 2)
    {
        setunitdata(.@mobId, UMOB_MAXHP, 451578);
        setunitdata(.@mobId, UMOB_HP, 451578);
    }
    monster .@map$,154,79,"Abyss Knight",2470,1,.@label$;
    set .@mobId, $@mobId[0];
    if('oghMode == 2)
    {
        setunitdata(.@mobId, UMOB_MAXHP, 451578);
        setunitdata(.@mobId, UMOB_HP, 451578);
    }
    monster .@map$,145,89,"Abyss Knight",2470,1,.@label$;
    set .@mobId, $@mobId[0];
    if('oghMode == 2)
    {
        setunitdata(.@mobId, UMOB_MAXHP, 451578);
        setunitdata(.@mobId, UMOB_HP, 451578);
    }
    monster .@map$,154,89,"Abyss Knight",2470,1,.@label$;
    set .@mobId, $@mobId[0];
    if('oghMode == 2)
    {
        setunitdata(.@mobId, UMOB_MAXHP, 451578);
        setunitdata(.@mobId, UMOB_HP, 451578);
    }
    monster .@map$,145,99,"Abyss Knight",2470,1,.@label$;
    set .@mobId, $@mobId[0];
    if('oghMode == 2)
    {
        setunitdata(.@mobId, UMOB_MAXHP, 451578);
        setunitdata(.@mobId, UMOB_HP, 451578);
    }
    monster .@map$,154,99,"Abyss Knight",2470,1,.@label$;
    set .@mobId, $@mobId[0];
    if('oghMode == 2)
    {
        setunitdata(.@mobId, UMOB_MAXHP, 451578);
        setunitdata(.@mobId, UMOB_HP, 451578);
    }
    
    
    monster .@map$,145,54,"Khalitzburg",2471,1,.@label$;
    unittalk $@mobid[0],"Water... Someone give me water...",1;
    set .@mobId, $@mobId[0];
    if('oghMode == 2)
    {
        setunitdata(.@mobId, UMOB_MAXHP, 473702);
        setunitdata(.@mobId, UMOB_HP, 473702);
    }
    monster .@map$,154,54,"Khalitzburg",2471,1,.@label$;
    unittalk $@mobid[0],"Kkkrrrruughgh...",1;
    set .@mobId, $@mobId[0];
    if('oghMode == 2)
    {
        setunitdata(.@mobId, UMOB_MAXHP, 473702);
        setunitdata(.@mobId, UMOB_HP, 473702);
    }
    monster .@map$,145,64,"Khalitzburg",2471,1,.@label$;
    unittalk $@mobid[0],"Sir. Heinrich. Save me...",1;
    set .@mobId, $@mobId[0];
    if('oghMode == 2)
    {
        setunitdata(.@mobId, UMOB_MAXHP, 473702);
        setunitdata(.@mobId, UMOB_HP, 473702);
    }
    monster .@map$,154,64,"Khalitzburg",2471,1,.@label$;
    unittalk $@mobid[0],"I miss my sister...",1;
    set .@mobId, $@mobId[0];
    if('oghMode == 2)
    {
        setunitdata(.@mobId, UMOB_MAXHP, 473702);
        setunitdata(.@mobId, UMOB_HP, 473702);
    }
    monster .@map$,145,74,"Khalitzburg",2471,1,.@label$;
    unittalk $@mobid[0],"Don't leave me alone, help me.",1;
    set .@mobId, $@mobId[0];
    if('oghMode == 2)
    {
        setunitdata(.@mobId, UMOB_MAXHP, 473702);
        setunitdata(.@mobId, UMOB_HP, 473702);
    }
    monster .@map$,154,74,"Khalitzburg",2471,1,.@label$;
    unittalk $@mobid[0],"Aaarrrrrhhhh",1;
    set .@mobId, $@mobId[0];
    if('oghMode == 2)
    {
        setunitdata(.@mobId, UMOB_MAXHP, 473702);
        setunitdata(.@mobId, UMOB_HP, 473702);
    }
    monster .@map$,145,84,"Khalitzburg",2471,1,.@label$;
    unittalk $@mobid[0],"I am so thirsty.",1;
    set .@mobId, $@mobId[0];
    if('oghMode == 2)
    {
        setunitdata(.@mobId, UMOB_MAXHP, 473702);
        setunitdata(.@mobId, UMOB_HP, 473702);
    }
    monster .@map$,154,84,"Khalitzburg",2471,1,.@label$;
    unittalk $@mobid[0],"Oh...No...I can't die yet...",1;
    set .@mobId, $@mobId[0];
    if('oghMode == 2)
    {
        setunitdata(.@mobId, UMOB_MAXHP, 473702);
        setunitdata(.@mobId, UMOB_HP, 473702);
    }
    monster .@map$,145,94,"Khalitzburg",2471,1,.@label$;
    unittalk $@mobid[0],"I feel sick to my stomach urrgg",1;
    set .@mobId, $@mobId[0];
    if('oghMode == 2)
    {
        setunitdata(.@mobId, UMOB_MAXHP, 473702);
        setunitdata(.@mobId, UMOB_HP, 473702);
    }
    monster .@map$,154,94,"Khalitzburg",2471,1,.@label$;
    unittalk $@mobid[0],"Can someone...",1;
    set .@mobId, $@mobId[0];
    if('oghMode == 2)
    {
        setunitdata(.@mobId, UMOB_MAXHP, 473702);
        setunitdata(.@mobId, UMOB_HP, 473702);
    }
    monster .@map$,145,104,"Khalitzburg",2471,1,.@label$;
    unittalk $@mobid[0],"Arrgg... My body",1;
    set .@mobId, $@mobId[0];
    if('oghMode == 2)
    {
        setunitdata(.@mobId, UMOB_MAXHP, 473702);
        setunitdata(.@mobId, UMOB_HP, 473702);
    }
    monster .@map$,154,104,"Khalitzburg",2471,1,.@label$;
    unittalk $@mobid[0],"My throat is burning!",1;
    set .@mobId, $@mobId[0];
    if('oghMode == 2)
    {
        setunitdata(.@mobId, UMOB_MAXHP, 473702);
        setunitdata(.@mobId, UMOB_HP, 473702);
    }
    end;
OnTimer94000:
    donpcevent instance_npcname("Heinrich#ghinstance2")+"::OnTalk8";
    end;
OnTimer96500:
    donpcevent instance_npcname("Varmundt#ghinstance2")+"::OnTalk4";
    end;
OnTimer100000:
    donpcevent instance_npcname("Heinrich#ghinstance2")+"::OnTalk9";
    end;
OnTimer103000:
    donpcevent instance_npcname("Heinrich#ghinstance2")+"::OnTalk10";
    end;
OnTimer106000:
    mapannounce instance_mapname("1@gl_k"),"Sir. Heinrich: Death to all!",bc_map,"0xFFFF00",FW_NORMAL,18;
    end;
OnTimer109000:
    mapannounce instance_mapname("1@gl_k"),"Sir. Heinrich: Go back to the darkness!",bc_map,"0xFFFF00",FW_NORMAL,18;
    end;
OnTimer109500:
    enablenpc instance_npcname(".#ghinstance22");
    enablenpc instance_npcname(".#ghinstance21");
    donpcevent instance_npcname(".#ghinstance22")+"::OnEffect1";
    donpcevent instance_npcname(".#ghinstance21")+"::OnEffect1";
    end;
OnTimer110000:
    enablenpc instance_npcname(".#ghinstance20");
    enablenpc instance_npcname(".#ghinstance19");
    enablenpc instance_npcname(".#ghinstance18");
    enablenpc instance_npcname(".#ghinstance17");
    donpcevent instance_npcname(".#ghinstance20")+"::OnEffect1";
    donpcevent instance_npcname(".#ghinstance19")+"::OnEffect1";
    donpcevent instance_npcname(".#ghinstance18")+"::OnEffect1";
    donpcevent instance_npcname(".#ghinstance17")+"::OnEffect1";
    end;
OnTimer110500:
    enablenpc instance_npcname(".#ghinstance16");
    enablenpc instance_npcname(".#ghinstance15");
    enablenpc instance_npcname(".#ghinstance14");
    enablenpc instance_npcname(".#ghinstance13");
    donpcevent instance_npcname(".#ghinstance16")+"::OnEffect1";
    donpcevent instance_npcname(".#ghinstance15")+"::OnEffect1";
    donpcevent instance_npcname(".#ghinstance14")+"::OnEffect1";
    donpcevent instance_npcname(".#ghinstance13")+"::OnEffect1";
    end;
OnTimer111000:
    enablenpc instance_npcname(".#ghinstance12");
    enablenpc instance_npcname(".#ghinstance11");
    enablenpc instance_npcname(".#ghinstance10");
    enablenpc instance_npcname(".#ghinstance9");
    donpcevent instance_npcname(".#ghinstance12")+"::OnEffect1";
    donpcevent instance_npcname(".#ghinstance11")+"::OnEffect1";
    donpcevent instance_npcname(".#ghinstance10")+"::OnEffect1";
    donpcevent instance_npcname(".#ghinstance9")+"::OnEffect1";
    end;
OnTimer111500:
    enablenpc instance_npcname(".#ghinstance8");
    enablenpc instance_npcname(".#ghinstance7");
    enablenpc instance_npcname(".#ghinstance6");
    enablenpc instance_npcname(".#ghinstance5");
    donpcevent instance_npcname(".#ghinstance8")+"::OnEffect1";
    donpcevent instance_npcname(".#ghinstance7")+"::OnEffect1";
    donpcevent instance_npcname(".#ghinstance6")+"::OnEffect1";
    donpcevent instance_npcname(".#ghinstance5")+"::OnEffect1";
    end;
OnTimer112000:
    enablenpc instance_npcname(".#ghinstance4");
    enablenpc instance_npcname(".#ghinstance3");
    enablenpc instance_npcname(".#ghinstance2");
    enablenpc instance_npcname(".#ghinstance1");
    donpcevent instance_npcname(".#ghinstance4")+"::OnEffect1";
    donpcevent instance_npcname(".#ghinstance3")+"::OnEffect1";
    donpcevent instance_npcname(".#ghinstance2")+"::OnEffect1";
    donpcevent instance_npcname(".#ghinstance1")+"::OnEffect1";
    donpcevent instance_npcname("Heinrich#ghinstance3")+"::OnEnable";
    donpcevent instance_npcname("Heinrich#ghinstance2")+"::OnDisable";

    for (set .@i,1; .@i<=22; set .@i,.@i+1)
        disablenpc instance_npcname(".#ghinstance"+.@i);

    killmonster instance_mapname("1@gl_k"),instance_npcname("#talkinstance1")+"::OnMyMobDead";
    end;
OnTimer112500:
    donpcevent instance_npcname("Heinrich#ghinstance3")+"::OnTalk1";
    end;
OnTimer115500:
    donpcevent instance_npcname("Varmundt#ghinstance2")+"::OnTalk5";
    end;
OnTimer118500:
    donpcevent instance_npcname("Varmundt#ghinstance2")+"::OnTalk6";
    end;
OnTimer121500:
    donpcevent instance_npcname("Heinrich#ghinstance3")+"::OnTalk2";
    end;
OnTimer124500:
    donpcevent instance_npcname("Heinrich#ghinstance3")+"::OnTalk3";
    end;
OnTimer127500:
    donpcevent instance_npcname("Heinrich#ghinstance3")+"::OnTalk4";
    end;
OnTimer130500:
    donpcevent instance_npcname("Heinrich#ghinstance3")+"::OnTalk5";
    end;
OnTimer134500:
    donpcevent instance_npcname("Heinrich#ghinstance3")+"::OnTalk6";
    end;
OnTimer138500:
    donpcevent instance_npcname("Heinrich#ghinstance3")+"::OnTalk7";
    end;
OnTimer143500:
    donpcevent instance_npcname("Heinrich#ghinstance3")+"::OnTalk8";
    end;
OnTimer147500:
    donpcevent instance_npcname("Heinrich#ghinstance3")+"::OnDisable";
    end;
OnTimer148500:
    donpcevent instance_npcname("Varmundt#ghinstance2")+"::OnDisable";
    stopnpctimer;
    donpcevent instance_npcname("#ghinstancewarp1")+"::OnEnable";
    donpcevent instance_npcname("#ghinstancewarp2")+"::OnEnable";
    mapannounce instance_mapname("1@gl_k"),"A portal has opened to the west.",bc_map,"0xFFFF00";
    donpcevent instance_npcname("#talkinstance1")+"::OnDisable";
    donpcevent instance_npcname("#ghmemorialmob01")+"::OnEnable";
    end;
OnMyMobDead:
    end;
}

1@gl_k,145,54,6    script    .#ghinstance1    111,{
    end;
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname(strnpcinfo(0));
    end;
OnEnable:
    enablenpc instance_npcname(strnpcinfo(0));
    end;
OnEffect1:
    specialeffect EF_GRANDCROSS;
    specialeffect EF_LEXAETERNA;
    end;
}
1@gl_k,154,54,3    duplicate(.#ghinstance1)    .#ghinstance2    111
1@gl_k,145,59,6    duplicate(.#ghinstance1)    .#ghinstance3    111
1@gl_k,154,59,3    duplicate(.#ghinstance1)    .#ghinstance4    111
1@gl_k,145,64,6    duplicate(.#ghinstance1)    .#ghinstance5    111
1@gl_k,154,64,3    duplicate(.#ghinstance1)    .#ghinstance6    111
1@gl_k,145,69,6    duplicate(.#ghinstance1)    .#ghinstance7    111
1@gl_k,154,69,3    duplicate(.#ghinstance1)    .#ghinstance8    111
1@gl_k,145,74,6    duplicate(.#ghinstance1)    .#ghinstance9    111
1@gl_k,154,74,3    duplicate(.#ghinstance1)    .#ghinstance10    111
1@gl_k,145,79,6    duplicate(.#ghinstance1)    .#ghinstance11    111
1@gl_k,154,79,3    duplicate(.#ghinstance1)    .#ghinstance12    111
1@gl_k,145,84,6    duplicate(.#ghinstance1)    .#ghinstance13    111
1@gl_k,154,84,3    duplicate(.#ghinstance1)    .#ghinstance14    111
1@gl_k,145,89,6    duplicate(.#ghinstance1)    .#ghinstance15    111
1@gl_k,154,89,3    duplicate(.#ghinstance1)    .#ghinstance16    111
1@gl_k,145,94,6    duplicate(.#ghinstance1)    .#ghinstance17    111
1@gl_k,154,94,3    duplicate(.#ghinstance1)    .#ghinstance18    111
1@gl_k,145,99,6    duplicate(.#ghinstance1)    .#ghinstance19    111
1@gl_k,154,99,3    duplicate(.#ghinstance1)    .#ghinstance20    111
1@gl_k,145,104,6    duplicate(.#ghinstance1)    .#ghinstance21    111
1@gl_k,154,104,3    duplicate(.#ghinstance1)    .#ghinstance22    111

1@gl_k,96,80,0    script    #ghinstancewarp1    45,2,2,{
    end;
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname(strnpcinfo(0));
    end;
OnEnable:
    enablenpc instance_npcname(strnpcinfo(0));
    end;
OnTouch:
    set .@map1$,instance_mapname("1@gl_k");
    set .@map2$,instance_mapname("2@gl_k");
    switch(atoi(replacestr(strnpcinfo(2),"ghinstancewarp",""))) {
        case 1: warp .@map1$,80,80; break;
        case 2: warp .@map1$,105,80; break;
        case 3: warp .@map1$,215,79; break;
        case 4: warp .@map1$,195,79; break;
        case 5: warp .@map1$,215,216; break;
        case 6: warp .@map1$,235,216; break;
        case 7: warp .@map2$,150,46; break;
        case 8: warp .@map2$,126,123; break;
        case 9: warp .@map2$,150,116; break;
        case 10: warp .@map2$,174,101; break;
        case 11: warp .@map2$,150,110; break;
        case 12: warp .@map2$,150,179; break;
        case 13: warp .@map2$,150,160; break;
        case 14: warp .@map1$,150,281; break;
        case 15: warp .@map1$,48,168; break;
    }
    end;
}
1@gl_k,90,80,0    duplicate(#ghinstancewarp1)    #ghinstancewarp2    45,2,2
1@gl_k,202,79,0    duplicate(#ghinstancewarp1)    #ghinstancewarp3    45,2,2
1@gl_k,206,79,0    duplicate(#ghinstancewarp1)    #ghinstancewarp4    45,2,2
1@gl_k,228,216,0    duplicate(#ghinstancewarp1)    #ghinstancewarp5    45,2,2
1@gl_k,222,216,0    duplicate(#ghinstancewarp1)    #ghinstancewarp6    45,2,2
1@gl_k,150,284,0    duplicate(#ghinstancewarp1)    #ghinstancewarp7    45,2,2
2@gl_k,145,123,0    duplicate(#ghinstancewarp1)    #ghinstancewarp8    45,2,2
2@gl_k,136,122,0    duplicate(#ghinstancewarp1)    #ghinstancewarp9    45,2,2
2@gl_k,154,101,0    duplicate(#ghinstancewarp1)    #ghinstancewarp10    45,2,2
2@gl_k,165,101,0    duplicate(#ghinstancewarp1)    #ghinstancewarp11    45,2,2
2@gl_k,150,163,0    duplicate(#ghinstancewarp1)    #ghinstancewarp12    45,2,2
2@gl_k,150,167,0    duplicate(#ghinstancewarp1)    #ghinstancewarp13    45,2,2
2@gl_k,150,32,0    duplicate(#ghinstancewarp1)    #ghinstancewarp14    45,2,2
1@gl_k,69,168,0    duplicate(#ghinstancewarp1)    #ghinstancewarp15    45,2,2

// Sector 1 Mobs
//============================================================
1@gl_k,0,0,0    script    #ghmemorialmob01    -1,{
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname("#ghmemorialmob01");
    end;
OnEnable:
    enablenpc instance_npcname("#ghmemorialmob01");
    set .@map$,instance_mapname("1@gl_k");
    set .@label$,instance_npcname("#ghmemorialmob01")+"::OnMyMobDead";
    areamonster .@map$,76,99,87,10,"Grand Chamberlain in pain",2466,15,.@label$;
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobId); .@i++ )
        {
            setunitdata($@mobId[.@i], UDT_MAXHP, 416200);
            setunitdata($@mobId[.@i], UDT_HP, 416200);
        }
    }
    areamonster .@map$,67,39,12,6,"Corrupted Monk",2465,20,.@label$;
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobId); .@i++ )
        {
            setunitdata($@mobId[.@i], UDT_MAXHP, 200336);
            setunitdata($@mobId[.@i], UDT_HP, 200336);
        }
    }
    areamonster .@map$,67,39,12,6,"Grand Chamberlain in pain",2466,3,.@label$;
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobId); .@i++ )
        {
            setunitdata($@mobId[.@i], UDT_MAXHP, 416200);
            setunitdata($@mobId[.@i], UDT_HP, 416200);
        }
    }
    areamonster .@map$,32,75,51,58,"Corrupted Steward",2464,6,.@label$;
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobId); .@i++ )
        {
            setunitdata($@mobId[.@i], UDT_MAXHP, 271200);
            setunitdata($@mobId[.@i], UDT_HP, 271200);
        }
    }
    areamonster .@map$,45,84,6,137,"Corrupted Steward",2464,12,.@label$;
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobId); .@i++ )
        {
            setunitdata($@mobId[.@i], UDT_MAXHP, 271200);
            setunitdata($@mobId[.@i], UDT_HP, 271200);
        }
    }
    end;
OnMyMobDead:
    if('oghMode == 2)
    {
        if(rand(1000) < 'hardModeLootChance)
        {
            getitem 6755, 1;
        }
    }
    set .@map$,instance_mapname("1@gl_k");
    set .@label$,instance_npcname("#ghmemorialmob01")+"::OnMyMobDead";
    set .@mob_dead_num,56 - mobcount(.@map$,.@label$);
    if (.@mob_dead_num > 35) {
        mapannounce .@map$,"Himelmez's curse is getting weaker. Find any survivors!",bc_map,"0xFFFFFF";
        killmonster .@map$,.@label$;
        donpcevent instance_npcname("Altar boy Domun#clearGH")+"::OnEnable";
        donpcevent instance_npcname("#ghmemorialmob01")+"::OnDisable";
    }
    end;
}

1@gl_k,17,51,3    script    Altar boy Domun#clearGH    706,{
    if (getcharid(0) == getpartyleader(getcharid(1),2)) {
        mes "[Altar boy Domun]";
        mes "Save me! Save me!!!";
        npctalk "Save me! Save me!!!",1;
        next;
        select("Hold on! Are you the only survivor?");
        mes "["+strcharinfo(0)+"]";
        mes "Hold on! Are you the only survivor?";
        unittalk getcharid(3),"Hold on! Are you the only survivor?";
        next;
        mes "[Altar boy Domun]";
        mes "Chamberlains... monks... They all turned into monsters. I couldn't do anything.";
        npctalk "Chamberlains... monks... They all turned into monsters. I couldn't do anything.";
        next;
        mes "[Altar boy Domun]";
        mes "All I could do was... Just hide in here... Nothing, nothing I could do...";
        npctalk "All I could do was... Just hide in here... Nothing, nothing I could do...";
        next;
        select("Pull it together!");
        mes "["+strcharinfo(0)+"]";
        mes "Wake up kid! Go east and find the middle passage to the outside! That is safe!";
        unittalk getcharid(3),"Wake up kid! Go east and find the middle passage to the outside! That is safe!";
        next;
        mes "[Altar boy Domun]";
        mes "To the east passage? Alone? How?";
        npctalk "To the east passage? Alone? How?";
        next;
        select("I will give you a weapon.");
        mes "["+strcharinfo(0)+"]";
        mes "Here's a weapon. Just close your eye and swing for those monsters.";
        unittalk getcharid(3),"Here's a weapon. Just close your eye and swing for those monsters.";
        next;
        mes "[Altar boy Domun]";
        mes "Ok, I... I'l try.";
        npctalk "Ok, I... I'l try.";
        close2;
        donpcevent instance_npcname("Altar boy Domun#clearGH")+"::OnDisable";
        donpcevent instance_npcname("#ghmemorialmob02")+"::OnEnable";
        end;
    } else {
        mes "[Altar boy Domun]";
        mes "Save me, save me, please...";
        close;
    }
OnInstanceInit:
OnDisable:
    hideonnpc instance_npcname("Altar boy Domun#clearGH");
    end;
OnEnable:
    hideoffnpc instance_npcname("Altar boy Domun#clearGH");
    end;
}

// Sector 2 Mobs
//============================================================
1@gl_k,0,0,0    script    #ghmemorialmob02    -1,{
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname("#ghmemorialmob02");
    end;
OnEnable:
    enablenpc instance_npcname("#ghmemorialmob02");
    donpcevent instance_npcname("#ghinstancewarp3")+"::OnEnable";
    donpcevent instance_npcname("#ghinstancewarp4")+"::OnEnable";
    set .@map$,instance_mapname("1@gl_k");
    set .@label$,instance_npcname("#ghmemorialmob02")+"::OnMyMobDead";
    mapannounce .@map$,"A portal has opened to the east.",bc_map,"0xFFFF00";
    areamonster .@map$,241,113,291,19,"Outraged Refiner",2466,12,.@label$;
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobId); .@i++ )
        {
            setunitdata($@mobId[.@i], UDT_MAXHP, 416200);
            setunitdata($@mobId[.@i], UDT_HP, 416200);
        }
    }
    areamonster .@map$,241,113,291,19,"Decomposed Blacksmith",2464,12,.@label$;
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobId); .@i++ )
        {
            setunitdata($@mobId[.@i], UDT_MAXHP, 200336);
            setunitdata($@mobId[.@i], UDT_HP, 200336);
        }
    }
    areamonster .@map$,227,217,291,135,"Outraged Refiner",2466,12,.@label$;
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobId); .@i++ )
        {
            setunitdata($@mobId[.@i], UDT_MAXHP, 416200);
            setunitdata($@mobId[.@i], UDT_HP, 416200);
        }
    }
    areamonster .@map$,227,217,291,135,"Decomposed Blacksmith",2464,12,.@label$;
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobId); .@i++ )
        {
            setunitdata($@mobId[.@i], UDT_MAXHP, 200336);
            setunitdata($@mobId[.@i], UDT_HP, 200336);
        }
    }
    end;
OnMyMobDead:
    set .@map$,instance_mapname("1@gl_k");
    set .@label$,instance_npcname("#ghmemorialmob02")+"::OnMyMobDead";
    if('oghMode == 2)
    {
        if(rand(1000) < 'hardModeLootChance)
        {
            getitem 6755, 1;
        }
    }
    set .@mob_dead_num,48 - mobcount(.@map$,.@label$);
    if (.@mob_dead_num > 28) {
        mapannounce .@map$,"Himelmez's curse is getting weaker. Find any survivors!",bc_map,"0xFFFFFF";
        killmonster .@map$,.@label$;
        donpcevent instance_npcname("Holgren the Destroyer")+"::OnEnable";
        donpcevent instance_npcname("#ghmemorialmob02")+"::OnDisable";
    }
    end;
}

1@gl_k,291,145,3    script    Holgren the Destroyer    726,{
    if (getcharid(0) == getpartyleader(getcharid(1),2)) {
        mes "[Holgren the Destroyer]";
        mes "Die!! You shall die!!!";
        npctalk "Die!! You shall die!!!";
        specialeffect EF_CRASHEARTH;
        next;
        select("Relax! I'm not a monster!");
        mes "["+strcharinfo(0)+"]";
        mes "Relax! I am Human. Are you alone? Anyone else here?";
        unittalk getcharid(3),"Relax! I am Human. Are you alone? Anyone else here?";
        next;
        mes "[Holgren the Destroyer]";
        mes "It's only me alive.";
        npctalk "It's only me alive.";
        next;
        select("It's dangerous here...");
        mes "["+strcharinfo(0)+"]";
        mes "It's dangerous here. You know the way to the middle passage? Can you move?";
        unittalk getcharid(3),"It's dangerous here. You know the way to the middle passage? Can you move?";
        next;
        mes "[Holgren the Destroyer]";
        mes "Yes, I can move. I need to get out of here.";
        npctalk "Yes, I can move. I need to get out of here.";
        next;
        select("Be safe...");
        mes "["+strcharinfo(0)+"]";
        mes "Sorry, I can't go with you.";
        unittalk getcharid(3),"Sorry, I can't go with you.";
        next;
        mes "[Holgren the Destroyer]";
        mes "It's ok. You've already done enough. I can help myself. Good luck to you too.";
        npctalk "It's ok. You've already done enough. I can help myself. Good luck to you too.";
        close2;
        donpcevent instance_npcname("Holgren the Destroyer")+"::OnDisable";
        donpcevent instance_npcname("#ghmemorialmob03")+"::OnEnable";
        end;
    } else {
        mes "[Holgren the Destroyer]";
        mes "You human?";
        close;
    }
OnInstanceInit:
OnDisable:
    hideonnpc instance_npcname("Holgren the Destroyer");
    end;
OnEnable:
    hideoffnpc instance_npcname("Holgren the Destroyer");
    end;
}

// Tramp Mobs
//============================================================
1@gl_k,221,82,3    script    A dead man#GHtramp1    849,4,4,{
    end;
OnTouch:
    set .@i,rand(1,10);
    if (.@i == 1) set .@mobs,3;
    else if (.@i == 2) set .@mobs,4;
    else if (.@i == 3) set .@mobs,5;
    else if (.@i < 7) set .@mobs,6;
    else set .@mobs,7;
    getmapxy(.@map$,.@x,.@y,1);
    specialeffect EF_VENOMDUST;
    monster .@map$,.@x,.@y,"Maggot",2467,.@mobs,instance_npcname(strnpcinfo(0))+"::OnMyMobDead";
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobId); .@i++ )
        {
            setunitdata($@mobId[.@i], UDT_MAXHP, 161622);
            setunitdata($@mobId[.@i], UDT_HP, 161622);
        }
    }
    disablenpc instance_npcname(strnpcinfo(0));
    end;
OnMyMobDead:
    if('oghMode == 2)
    {
        if(rand(1000) < 'hardModeLootChance)
        {
            getitem 6755, 1;
        }
    }
    end;
OnInstanceInit:
OnEnable:
    enablenpc instance_npcname(strnpcinfo(0));
    end;
OnDisable:
    disablenpc instance_npcname(strnpcinfo(0));
    end;
}
1@gl_k,213,63,7    duplicate(A dead man#GHtramp1)    A dead man#GHtramp2    849,4,4
1@gl_k,230,50,2    duplicate(A dead man#GHtramp1)    A dead man#GHtramp3    849,4,4
1@gl_k,222,39,2    duplicate(A dead man#GHtramp1)    A dead man#GHtramp4    849,4,4
1@gl_k,214,27,3    duplicate(A dead man#GHtramp1)    A dead man#GHtramp5    849,4,4
1@gl_k,223,17,2    duplicate(A dead man#GHtramp1)    A dead man#GHtramp6    849,4,4
1@gl_k,235,16,4    duplicate(A dead man#GHtramp1)    A dead man#GHtramp7    849,4,4
1@gl_k,251,20,5    duplicate(A dead man#GHtramp1)    A dead man#GHtramp8    849,4,4
1@gl_k,240,43,7    duplicate(A dead man#GHtramp1)    A dead man#GHtramp9    849,4,4
1@gl_k,271,19,1    duplicate(A dead man#GHtramp1)    A dead man#GHtramp10    849,4,4
1@gl_k,246,62,7    duplicate(A dead man#GHtramp1)    A dead man#GHtramp11    849,4,4
1@gl_k,282,48,5    duplicate(A dead man#GHtramp1)    A dead man#GHtramp12    849,4,4
1@gl_k,285,81,7    duplicate(A dead man#GHtramp1)    A dead man#GHtramp13    849,4,4
1@gl_k,241,86,5    duplicate(A dead man#GHtramp1)    A dead man#GHtramp14    849,4,4
1@gl_k,249,101,3    duplicate(A dead man#GHtramp1)    A dead man#GHtramp15    849,4,4
1@gl_k,276,106,7    duplicate(A dead man#GHtramp1)    A dead man#GHtramp16    849,4,4
1@gl_k,252,120,7    duplicate(A dead man#GHtramp1)    A dead man#GHtramp17    849,4,4
1@gl_k,258,150,1    duplicate(A dead man#GHtramp1)    A dead man#GHtramp18    849,4,4
1@gl_k,255,157,6    duplicate(A dead man#GHtramp1)    A dead man#GHtramp19    849,4,4
1@gl_k,261,164,7    duplicate(A dead man#GHtramp1)    A dead man#GHtramp20    849,4,4
1@gl_k,269,173,7    duplicate(A dead man#GHtramp1)    A dead man#GHtramp21    849,4,4
1@gl_k,280,167,3    duplicate(A dead man#GHtramp1)    A dead man#GHtramp22    849,4,4
1@gl_k,293,161,3    duplicate(A dead man#GHtramp1)    A dead man#GHtramp23    849,4,4
1@gl_k,226,96,3    duplicate(A dead man#GHtramp1)    A dead man#GHtramp24    849,4,4
1@gl_k,222,119,5    duplicate(A dead man#GHtramp1)    A dead man#GHtramp25    849,4,4
1@gl_k,233,123,3    duplicate(A dead man#GHtramp1)    A dead man#GHtramp26    849,4,4
2@gl_k,147,203,5    duplicate(A dead man#GHtramp1)    A dead man#GHtramp27    849,4,4
2@gl_k,141,222,3    duplicate(A dead man#GHtramp1)    A dead man#GHtramp28    849,4,4
2@gl_k,167,225,5    duplicate(A dead man#GHtramp1)    A dead man#GHtramp29    849,4,4
2@gl_k,145,236,5    duplicate(A dead man#GHtramp1)    A dead man#GHtramp30    849,4,4
2@gl_k,143,260,3    duplicate(A dead man#GHtramp1)    A dead man#GHtramp31    849,4,4
2@gl_k,170,259,3    duplicate(A dead man#GHtramp1)    A dead man#GHtramp32    849,4,4
2@gl_k,143,197,5    duplicate(A dead man#GHtramp1)    A dead man#GHtramp33    849,4,4
2@gl_k,155,195,5    duplicate(A dead man#GHtramp1)    A dead man#GHtramp34    849,4,4
2@gl_k,154,188,3    duplicate(A dead man#GHtramp1)    A dead man#GHtramp35    849,4,4
2@gl_k,153,214,3    duplicate(A dead man#GHtramp1)    A dead man#GHtramp36    849,4,4
2@gl_k,172,233,3    duplicate(A dead man#GHtramp1)    A dead man#GHtramp37    849,4,4
2@gl_k,176,245,3    duplicate(A dead man#GHtramp1)    A dead man#GHtramp38    849,4,4

// Sector 3 Mobs
//============================================================
1@gl_k,0,0,0    script    #ghmemorialmob03    -1,{
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname("#ghmemorialmob03");
    end;
OnEnable:
    enablenpc instance_npcname("#ghmemorialmob03");
    donpcevent instance_npcname("#ghinstancewarp5")+"::OnEnable";
    donpcevent instance_npcname("#ghinstancewarp6")+"::OnEnable";
    set .@map$,instance_mapname("1@gl_k");
    set .@label$,instance_npcname("#ghmemorialmob03")+"::OnMyMobDead";
    mapannounce .@map$,"A portal has appeared to the northwest.",bc_map,"0xFFFF00";
    areamonster .@map$,17,259,53,180,"Hungry Palace Guard",2468,11,.@label$;
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobId); .@i++ )
        {
            setunitdata($@mobId[.@i], UDT_MAXHP, 368160);
            setunitdata($@mobId[.@i], UDT_HP, 368160);
        }
    }
    areamonster .@map$,17,259,53,180,"Outraged Archer",2469,14,.@label$;
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobId); .@i++ )
        {
            setunitdata($@mobId[.@i], UDT_MAXHP, 288740);
            setunitdata($@mobId[.@i], UDT_HP, 288740);
        }
    }
    areamonster .@map$,62,281,73,186,"Hungry Palace Guard",2468,11,.@label$;
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobId); .@i++ )
        {
            setunitdata($@mobId[.@i], UDT_MAXHP, 368160);
            setunitdata($@mobId[.@i], UDT_HP, 368160);
        }
    }
    areamonster .@map$,62,281,73,186,"Outraged Archer",2469,14,.@label$;
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobId); .@i++ )
        {
            setunitdata($@mobId[.@i], UDT_MAXHP, 288740);
            setunitdata($@mobId[.@i], UDT_HP, 288740);
        }
    }
    areamonster .@map$,74,251,109,224,"Corrupted Palace Guard",2468,11,.@label$;
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobId); .@i++ )
        {
            setunitdata($@mobId[.@i], UDT_MAXHP, 368160);
            setunitdata($@mobId[.@i], UDT_HP, 368160);
        }
    }
    areamonster .@map$,74,251,109,224,"Wandering Archer",2469,14,.@label$;
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobId); .@i++ )
        {
            setunitdata($@mobId[.@i], UDT_MAXHP, 288740);
            setunitdata($@mobId[.@i], UDT_HP, 288740);
        }
    }
    areamonster .@map$,108,281,231,234,"Corrupted Palace Guard",2468,11,.@label$;
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobId); .@i++ )
        {
            setunitdata($@mobId[.@i], UDT_MAXHP, 368160);
            setunitdata($@mobId[.@i], UDT_HP, 368160);
        }
    }
    areamonster .@map$,108,281,231,234,"Wandering Archer",2469,14,.@label$;
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobId); .@i++ )
        {
            setunitdata($@mobId[.@i], UDT_MAXHP, 288740);
            setunitdata($@mobId[.@i], UDT_HP, 288740);
        }
    }
    end;
OnMyMobDead:
    set .@map$,instance_mapname("1@gl_k");
    set .@label$,instance_npcname("#ghmemorialmob03")+"::OnMyMobDead";
    if('oghMode == 2)
    {
        if(rand(1000) < 'hardModeLootChance)
        {
            getitem 6755, 1;
        }
    }
    set .@mob_dead_num,100 - mobcount(.@map$,.@label$);
    if (.@mob_dead_num > 85) {
        mapannounce .@map$,"Himelmez: Not bad. Thought you would be dead by now by my creatures~",bc_map,"0xFFFFFF";
        killmonster .@map$,.@label$;
        donpcevent instance_npcname("#GHMclear3")+"::OnEnable";
        donpcevent instance_npcname("Heinrich#ghinstance4")+"::OnEnable";
        donpcevent instance_npcname("Himelmez#ghinstance2")+"::OnEnable";
        donpcevent instance_npcname("Varmundt#ghinstance3")+"::OnEnable";
        donpcevent instance_npcname("#ghmemorialmob03")+"::OnDisable";
    }
    end;
}

// 1st MVP
//============================================================
1@gl_k,0,0,0    script    #ghmemorialmob04    -1,{
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname("#ghmemorialmob04");
    end;
OnEnable:
    enablenpc instance_npcname("#ghmemorialmob04");
    monster instance_mapname("1@gl_k"),150,258,"Corrupted Soul",2475,1,instance_npcname("#ghmemorialmob04")+"::OnMyMobDead";
    if('oghMode == 2)
    {
        setunitdata($@mobId[0], UDT_MAXHP, 18200000);
        setunitdata($@mobId[0], UDT_HP, 18200000);
    }
    unittalk $@mobid[0],"Grrrrrrhh~~~",1;
    end;
OnMyMobDead:
    set .@map$,instance_mapname("1@gl_k");
    if('oghMode == 2)
    {
        if(rand(1000) < 'hardModeLootChance)
        {
            getitem 6755, 1;
        }
    }
    if (mobcount(.@map$,instance_npcname("#ghmemorialmob04")+"::OnMyMobDead") < 1) {
        mapannounce .@map$,"Opening 2nd floor entrance towards 12 O'clock direction.",bc_map,"0xFFFF00";
        donpcevent instance_npcname("#ghinstancewarp7")+"::OnEnable";
        donpcevent instance_npcname("#ghinstancewarp14")+"::OnEnable";
        donpcevent instance_npcname("Varmundt#ghinstance3")+"::OnTalk2";
        donpcevent instance_npcname("#effectGH01")+"::OnEnable";
        donpcevent instance_npcname("Heinrich#ghinstance5")+"::OnEnable";
        donpcevent instance_npcname("Varmundt#ghinstance4")+"::OnEnable";
        donpcevent instance_npcname("#ghmemorialmob04")+"::OnDisable";
    }
    end;
}

1@gl_k,150,257,3    script    #GHMclear3    111,9,9,{
    end;
OnTouch:
    donpcevent instance_npcname("#controlGH3")+"::OnEnable";
    specialeffect EF_BASH;
    donpcevent instance_npcname("#GHMclear3")+"::OnDisable";
    end;
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname("#GHMclear3");
    end;
OnEnable:
    enablenpc instance_npcname("#GHMclear3");
    initnpctimer;
    end;
OnTimer2000:
    mapannounce instance_mapname("1@gl_k"),"Himelmez: I'll wait for you at the north of the castle. I want to see you how lucky you are.",bc_map,"0xFFFFFF";
    stopnpctimer;
    end;
}

1@gl_k,0,0,0    script    #controlGH3    -1,{
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname("#controlGH3");
    end;
OnEnable:
    enablenpc instance_npcname("#controlGH3");
    initnpctimer;
    end;
OnTimer3000:
    donpcevent instance_npcname("Himelmez#ghinstance2")+"::OnTalk1";
    end;
OnTimer6000:
    donpcevent instance_npcname("Himelmez#ghinstance2")+"::OnTalk2";
    end;
OnTimer9000:
    donpcevent instance_npcname("Himelmez#ghinstance2")+"::OnTalk3";
    end;
OnTimer12000:
    donpcevent instance_npcname("Heinrich#ghinstance4")+"::OnTalk1";
    end;
OnTimer15000:
    donpcevent instance_npcname("Himelmez#ghinstance2")+"::OnTalk4";
    end;
OnTimer18000:
    donpcevent instance_npcname("Varmundt#ghinstance3")+"::OnTalk1";
    end;
OnTimer21000:
    donpcevent instance_npcname("Heinrich#ghinstance4")+"::OnTalk2";
    end;
OnTimer24000:
    donpcevent instance_npcname("Himelmez#ghinstance2")+"::OnTalk5";
    end;
OnTimer27000:
    donpcevent instance_npcname("Himelmez#ghinstance2")+"::OnTalk6";
    end;
OnTimer28000:
    donpcevent instance_npcname("Himelmez#ghinstance2")+"::OnDisable";
    end;
OnTimer31000:
    donpcevent instance_npcname("Heinrich#ghinstance4")+"::OnTalk3";
    end;
OnTimer32000:
    donpcevent instance_npcname("Heinrich#ghinstance4")+"::OnDisable";
    end;
OnTimer35000:
    mapannounce instance_mapname("1@gl_k"),"An echoing comes from deep inside of the knight's shrine.",bc_map,"0xFFFFFF";
    end;
OnTimer38000:
    donpcevent instance_npcname("#ghmemorialmob04")+"::OnEnable";
    stopnpctimer;
    donpcevent instance_npcname("#controlGH3")+"::OnDisable";
    end;
}

1@gl_k,144,258,6    script    Heinrich#ghinstance4    652,{
    cutin "gl_heinrich1",2;
    mes "[Heinrich]";
    mes "Himelmez... I will never forget what you've done to my men.";
    close2;
    cutin "gl_heinrich1",255;
    end;
OnInstanceInit:
OnDisable:
    hideonnpc instance_npcname("Heinrich#ghinstance4");
    end;
OnEnable:
    hideoffnpc instance_npcname("Heinrich#ghinstance4");
    end;
OnTalk1:
    npctalk "Himelmez! We will not let you get away from us!";
    end;
OnTalk2:
    npctalk "What... These are!";
    end;
OnTalk3:
    npctalk "Sir. Varmundt! Help those adventurers. I will go after Himelmez!";
    end;
}

1@gl_k,150,257,3    script    Himelmez#ghinstance2    650,{
    cutin "gl_himel2",2;
    mes "[Himelmez]";
    mes "Don't look at me nervous like that.";
    mes "It will be over soon...";
    close2;
    cutin "gl_himel2",255;
    end;
OnInstanceInit:
OnDisable:
    hideonnpc instance_npcname("Himelmez#ghinstance2");
    end;
OnEnable:
    hideoffnpc instance_npcname("Himelmez#ghinstance2");
    end;
OnTalk1:
    npctalk "Guess you are either lucky or powerful, to make it this far.";
    end;
OnTalk2:
    npctalk "But, it doesn't matter.";
    end;
OnTalk3:
    npctalk "You will all die here.";
    end;
OnTalk4:
    npctalk "Ha ha ha, worry about yourself. You think I am alone here?";
    end;
OnTalk5:
    npctalk "I will go on my way while my new toy entertains you.";
    end;
OnTalk6:
    npctalk "Fare well~, hope to see you again sometime, Heinrich.";
    end;
}

1@gl_k,156,259,3    script    Varmundt#ghinstance3    654,{
    if (checkquest(12318,HUNTING) == 2) {
        cutin "gl_barmund1",2;
        mes "[Varmundt]";
        mes "This item has extraordinary aura with it. Can be very useful for someone special.";
        erasequest 12318;
        if (checkquest(12319,HUNTING) == -1)
            setquest 12319;
        setquest 12320;
        erasequest 12320;
        getitem 6607,1; //Temporal_Crystal
        getitem 6608,1; //Coagulated_Spell
        getexp 250000,250000;
        close2;
        cutin "gl_barmund1",255;
        end;
    }
    cutin "gl_barmund1",2;
    mes "[Varmundt]";
    mes "I guess this is it. Is it impossible to stop the time traveler's will?! A portal seems to have appeared to the north.";
    close2;
    cutin "gl_barmund2",255;
    end;
OnInstanceInit:
OnDisable:
    hideonnpc instance_npcname("Varmundt#ghinstance3");
    end;
OnEnable:
    hideoffnpc instance_npcname("Varmundt#ghinstance3");
    end;
OnTalk1:
    npctalk "Sir. Heinrich! I sense something strange and strong coming!";
    end;
OnTalk2:
    npctalk "I collected some items dropped from its body. You can take it from me.";
    end;
}

// Floor 2
//============================================================
2@gl_k,148,67,1    script    Heinrich#ghinstance5    652,{
    cutin "gl_heinrich1",2;
    mes "[Heinrich]";
    mes "Himelmez's closed space covers everywhere...";
    close2;
    cutin "gl_heinrich1",255;
    end;
OnInstanceInit:
OnDisable:
    hideonnpc instance_npcname("Heinrich#ghinstance5");
    end;
OnEnable:
    hideoffnpc instance_npcname("Heinrich#ghinstance5");
    end;
OnTalk1:
    npctalk "This structure was not in the castle before!";
    end;
OnTalk2:
    npctalk "We tried to break it down but it's really strong.";
    end;
OnTalk3:
    npctalk "It is inexcusable behavior.";
    end;
OnTalk4:
    npctalk "I already exterminated all my soldiers and maybe more...";
    end;
OnTalk5:
    npctalk "...";
    end;
}

2@gl_k,151,71,7    script    Varmundt#ghinstance4    654,{
    cutin "gl_barmund1",2;
    mes "[Varmundt]";
    mes "How many times I do this job. In my dream, I did it over and over again...";
    close2;
    cutin "gl_barmund1",255;
    end;
OnInstanceInit:
OnDisable:
    hideonnpc instance_npcname("Varmundt#ghinstance4");
    end;
OnEnable:
    hideoffnpc instance_npcname("Varmundt#ghinstance4");
    end;
OnTalk1:
    npctalk "This is Himelmez's closed space. We blocked each area and aisle.";
    end;
OnTalk2:
    npctalk "Step back. Let me try to dispel the magic.";
    end;
OnTalk3:
    npctalk "I think that part of closed space is broke down.";
    end;
OnTalk4:
    npctalk "I have never seen this closed space.";
    end;
OnTalk5:
    npctalk "Himelmez hides stone chains in undead people's body.";
    end;
OnTalk6:
    npctalk "Maybe this closed space is maintained with these stone chains.";
    end;
OnTalk7:
    npctalk "If you want to break it, you have to kill one of those who have a stone chain.";
    end;
OnTalk8:
    npctalk "But, we can't recognize who has a stone chain so, we have to purify everything.";
    end;
OnTalk9:
    npctalk "Commander...";
    end;
OnTalk10:
    npctalk "Commander! You need to be strong.";
    end;
OnTalk11:
    npctalk "Our enemy is not human.";
    end;
OnTalk12:
    npctalk "Even though you deny it, they'll never turn back to human.";
    end;
OnTalk13:
    npctalk "Well, let's go then.";
    end;
OnTalk14:
    npctalk "And you guys, just take a break and follow us.";
    end;
OnTalk15:
    npctalk "It could be hard fighting so, stay strong.";
    end;
OnTalk16:
    npctalk "Ok, it's time to begin Heinrich.";
    end;
}

2@gl_k,150,67,0    script    #effectGH01    111,10,10,{
    end;
OnTouch:
    if (.touch) {
        set .touch,0;
        specialeffect EF_BASH;
        donpcevent instance_npcname("#controlGH4")+"::OnEnable";
    }
    end;
OnEffect:
    specialeffect EF_LORD;
    end;
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname("#effectGH01");
    end;
OnEnable:
    enablenpc instance_npcname("#effectGH01");
    set .touch,1; //Only activate OnTouch once
    end;
}

2@gl_k,0,0,0    script    #controlGH4    -1,{
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname("#controlGH4");
    end;
OnEnable:
    enablenpc instance_npcname("#controlGH4");
    initnpctimer;
    end;
OnTimer3000:
    donpcevent instance_npcname("Heinrich#ghinstance5")+"::OnTalk1";
    donpcevent instance_npcname("#ghmemorialmob05")+"::OnEnable";
    end;
OnTimer6000:
    donpcevent instance_npcname("Varmundt#ghinstance4")+"::OnTalk1";
    end;
OnTimer9000:
    donpcevent instance_npcname("Heinrich#ghinstance5")+"::OnTalk2";
    end;
OnTimer12000:
    donpcevent instance_npcname("Varmundt#ghinstance4")+"::OnTalk2";
    end;
OnTimer15000:
    donpcevent instance_npcname("#effectGH01")+"::OnEffect";
    end;
OnTimer18000:
    donpcevent instance_npcname("#effectGH01")+"::OnDisable";
    donpcevent instance_npcname("Varmundt#ghinstance4")+"::OnTalk3";
    end;
OnTimer21000:
    donpcevent instance_npcname("Varmundt#ghinstance4")+"::OnTalk4";
    end;
OnTimer24000:
    donpcevent instance_npcname("Varmundt#ghinstance4")+"::OnTalk5";
    end;
OnTimer27000:
    donpcevent instance_npcname("Varmundt#ghinstance4")+"::OnTalk6";
    end;
OnTimer30000:
    donpcevent instance_npcname("Varmundt#ghinstance4")+"::OnTalk7";
    end;
OnTimer33000:
    donpcevent instance_npcname("Varmundt#ghinstance4")+"::OnTalk8";
    end;
OnTimer36000:
    donpcevent instance_npcname("Heinrich#ghinstance5")+"::OnTalk3";
    end;
OnTimer39000:
    donpcevent instance_npcname("Heinrich#ghinstance5")+"::OnTalk4";
    end;
OnTimer42000:
    donpcevent instance_npcname("Varmundt#ghinstance4")+"::OnTalk9";
    end;
OnTimer45000:
    donpcevent instance_npcname("Varmundt#ghinstance4")+"::OnTalk10";
    end;
OnTimer48000:
    donpcevent instance_npcname("Varmundt#ghinstance4")+"::OnTalk11";
    end;
OnTimer51000:
    donpcevent instance_npcname("Varmundt#ghinstance4")+"::OnTalk12";
    end;
OnTimer54000:
    donpcevent instance_npcname("Heinrich#ghinstance5")+"::OnTalk5";
    end;
OnTimer57000:
    donpcevent instance_npcname("Varmundt#ghinstance4")+"::OnTalk13";
    end;
OnTimer60000:
    donpcevent instance_npcname("Varmundt#ghinstance4")+"::OnTalk14";
    end;
OnTimer63000:
    donpcevent instance_npcname("Varmundt#ghinstance4")+"::OnTalk15";
    end;
OnTimer66000:
    donpcevent instance_npcname("Varmundt#ghinstance4")+"::OnTalk16";
    end;
OnTimer69000:
    mapannounce instance_mapname("2@gl_k"),"A portal to the west has opened in the central hallway.",bc_map,"0xFFFF00";
    donpcevent instance_npcname("#ghinstancewarp8")+"::OnEnable";
    donpcevent instance_npcname("#ghinstancewarp9")+"::OnEnable";
    donpcevent instance_npcname("#ghmemorialmob06")+"::OnEnable";
    donpcevent instance_npcname("Varmundt#ghinstance4")+"::OnDisable";
    donpcevent instance_npcname("Heinrich#ghinstance5")+"::OnDisable";
    end;
OnTimer70000:
    stopnpctimer;
    donpcevent instance_npcname("#controlGH4")+"::OnDisable";
    end;
}

2@gl_k,0,0,0    script    #ghmemorialmob05    -1,{
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname("#ghmemorialmob05");
    end;
OnEnable:
    enablenpc instance_npcname("#ghmemorialmob05");
    set .@map$,instance_mapname("2@gl_k");
    set .@label$,instance_npcname("#ghmemorialmob05")+"::OnMyMobDead";
    areamonster .@map$,124,20,31,162,"Corrupted Palace Guard",2468,8,.@label$;
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobIds); .@i++ )
        {
            setunitdata($@mobIds[.@i], UDT_MAXHP, 368160);
            setunitdata($@mobIds[.@i], UDT_HP, 368160);
        }
    }
    areamonster .@map$,124,20,31,162,"Archer of Death",2469,8,.@label$;
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobIds); .@i++ )
        {
            setunitdata($@mobIds[.@i], UDT_MAXHP, 288740);
            setunitdata($@mobIds[.@i], UDT_HP, 288740);
        }
    }
    areamonster .@map$,124,20,31,162,"Corrupted Abysmal Knight",2470,8,.@label$;
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobIds); .@i++ )
        {
            setunitdata($@mobIds[.@i], UDT_MAXHP, 451578);
            setunitdata($@mobIds[.@i], UDT_HP, 451578);
        }
    }
    areamonster .@map$,124,20,31,162,"Suffered Khalitzburg",2471,8,.@label$;
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobIds); .@i++ )
        {
            setunitdata($@mobIds[.@i], UDT_MAXHP, 473702);
            setunitdata($@mobIds[.@i], UDT_HP, 473702);
        }
    }
    areamonster .@map$,124,20,31,162,"Bloody Knight",2472,8,.@label$;
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobIds); .@i++ )
        {
            setunitdata($@mobIds[.@i], UDT_MAXHP, 493502);
            setunitdata($@mobIds[.@i], UDT_HP, 493502);
        }
    }
    set 'MyMobs,80;
    end;
OnMyMobDead:
    set .@map$,instance_mapname("2@gl_k");
    if('oghMode == 2)
    {
        if(rand(1000) < 'hardModeLootChance)
        {
            getitem 6755, 1;
        }
    }
    set 'MyMobs,'MyMobs-1;
    if ('MyMobs == 0) {
        mapannounce .@map$,"Evil Forces are appearing in this area.",bc_map,"0xFFFF00",FW_NORMAL,18;
        donpcevent instance_npcname("#ghmemorialmob06")+"::OnDisable2";
        donpcevent instance_npcname("#ghmemorialmob07")+"::OnEnable";
        donpcevent instance_npcname("#ghmemorialmob05")+"::OnDisable";
    } else {
        set .@label$,instance_npcname("#ghmemorialmob05")+"::OnMyMobDead";
        switch(rand(5)) {
        case 0:
            areamonster .@map$,124,20,31,162,"Corrupted Palace Guard",2468,1,.@label$;
            if('oghMode == 2)
            {
                setunitdata($@mobIds[0], UDT_MAXHP, 368160);
                setunitdata($@mobIds[0], UDT_HP, 368160);
            }
            break;
        case 1:
            areamonster .@map$,124,20,31,162,"Archer of Death",2469,1,.@label$;
            if('oghMode == 2)
            {
                setunitdata($@mobIds[0], UDT_MAXHP, 288740);
                setunitdata($@mobIds[0], UDT_HP, 288740);
            }
            break;
        case 2:
            areamonster .@map$,124,20,31,162,"Corrupted Abysmal Knight",2470,1,.@label$;
            if('oghMode == 2)
            {
                setunitdata($@mobIds[0], UDT_MAXHP, 451578);
                setunitdata($@mobIds[0], UDT_HP, 451578);
            }
            break;
        case 3:
            areamonster .@map$,124,20,31,162,"Suffered Khalitzburg",2471,1,.@label$;
            if('oghMode == 2)
            {
                setunitdata($@mobIds[0], UDT_MAXHP, 473702);
                setunitdata($@mobIds[0], UDT_HP, 473702);
            }
            break;
        case 4:
            areamonster .@map$,124,20,31,162,"Bloody Knight",2472,1,.@label$;
            if('oghMode == 2)
            {
                setunitdata($@mobIds[0], UDT_MAXHP, 493502);
                setunitdata($@mobIds[0], UDT_HP, 493502);
            }
            break;
        }
    }
    end;
}

2@gl_k,0,0,0    script    #ghmemorialmob06    -1,{
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname("#ghmemorialmob06");
    end;
OnDisable2:
    stopnpctimer;
    disablenpc instance_npcname("#ghmemorialmob06");
    end;
OnEnable:
    enablenpc instance_npcname("#ghmemorialmob06");
    donpcevent instance_npcname("#ghmemorialmob06")+"::OnSpawn";
    end;
OnSpawn:
    initnpctimer;
    end;
OnTimer90000:
    set .@map$,instance_mapname("2@gl_k");
    set .@label$,instance_npcname("#ghmemorialmob05")+"::OnMyMobDead";
    setarray .@c[0],
        114,141,118,139,
        128,83,131,78,
        88,53,93,48,
        54,47,61,40,
        58,83,63,78,
        69,138,80,127,
        34,143,39,138;
    for (set .@i,0; .@i<getarraysize(.@c); set .@i,.@i+4) {
        areamonster .@map$,.@c[.@i],.@c[.@i+1],.@c[.@i+2],.@c[.@i+3],"Corrupted Palace Guard",2468,1,.@label$;
        if('oghMode == 2)
        {
            setunitdata($@mobIds[0], UDT_MAXHP, 368160);
            setunitdata($@mobIds[0], UDT_HP, 368160);
        }
        areamonster .@map$,.@c[.@i],.@c[.@i+1],.@c[.@i+2],.@c[.@i+3],"Archer of Death",2469,1,.@label$;
        if('oghMode == 2)
        {
            setunitdata($@mobIds[0], UDT_MAXHP, 288740);
            setunitdata($@mobIds[0], UDT_HP, 288740);
        }
        areamonster .@map$,.@c[.@i],.@c[.@i+1],.@c[.@i+2],.@c[.@i+3],"Corrupted Abysmal Knight",2470,1,.@label$;
        if('oghMode == 2)
        {
            setunitdata($@mobIds[0], UDT_MAXHP, 451578);
            setunitdata($@mobIds[0], UDT_HP, 451578);
        }
        areamonster .@map$,.@c[.@i],.@c[.@i+1],.@c[.@i+2],.@c[.@i+3],"Suffered Khalitzburg",2471,1,.@label$;
        if('oghMode == 2)
        {
            setunitdata($@mobIds[0], UDT_MAXHP, 473702);
            setunitdata($@mobIds[0], UDT_HP, 473702);
        }
        areamonster .@map$,.@c[.@i],.@c[.@i+1],.@c[.@i+2],.@c[.@i+3],"Bloody Knight",2472,1,.@label$;
        if('oghMode == 2)
        {
            setunitdata($@mobIds[0], UDT_MAXHP, 493502);
            setunitdata($@mobIds[0], UDT_HP, 493502);
        }
    }
    end;
OnTimer92000:
    stopnpctimer;
    donpcevent instance_npcname("#ghmemorialmob06")+"::OnSpawn";
    end;
}

2@gl_k,0,0,0    script    #ghmemorialmob07    -1,{
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname("#ghmemorialmob07");
    end;
OnEnable:
    enablenpc instance_npcname("#ghmemorialmob07");
    areamonster instance_mapname("2@gl_k"),124,20,31,162,"1st Commander of Destruction",2473,1,instance_npcname("#ghmemorialmob07")+"::OnMyMobDead";
    if('oghMode == 2)
    {
        setunitdata($@mobIds[0], UDT_MAXHP, 1900070);
        setunitdata($@mobIds[0], UDT_HP, 1900070);
    }
    end;
OnMyMobDead:
    set .@map$,instance_mapname("2@gl_k");
    if('oghMode == 2)
    {
        if(rand(1000) < 'hardModeLootChance)
        {
            getitem 6755, 1;
        }
    }
    if (mobcount(.@map$,instance_npcname("#ghmemorialmob07")+"::OnMyMobDead") < 1) {
        mapannounce .@map$,"A portal has opened to the east in the central hallway.",bc_map,"0xFFFF00";
        donpcevent instance_npcname("#ghinstancewarp10")+"::OnEnable";
        donpcevent instance_npcname("#ghinstancewarp11")+"::OnEnable";
        donpcevent instance_npcname("#ghmemorialmob08")+"::OnEnable";
        donpcevent instance_npcname("#ghmemorialmob07")+"::OnDisable";
    }
    end;
}

2@gl_k,0,0,0    script    #ghmemorialmob08    -1,{
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname("#ghmemorialmob08");
    end;
OnEnable:
    enablenpc instance_npcname("#ghmemorialmob08");
    set .@map$,instance_mapname("2@gl_k");
    set .@label$,instance_npcname("#ghmemorialmob08")+"::OnMyMobDead";
    areamonster .@map$,175,163,265,18,"Corrupted Palace Guard",2468,7,.@label$;
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobIds); .@i++ )
        {
            setunitdata($@mobIds[.@i], UDT_MAXHP, 368160);
            setunitdata($@mobIds[.@i], UDT_HP, 368160);
        }
    }
    areamonster .@map$,175,163,265,18,"Wandering Archer",2469,7,.@label$;
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobIds); .@i++ )
        {
            setunitdata($@mobIds[.@i], UDT_MAXHP, 288740);
            setunitdata($@mobIds[.@i], UDT_HP, 288740);
        }
    }
    areamonster .@map$,175,163,265,18,"Corrupted Abysmal Knight",2470,7,.@label$;
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobIds); .@i++ )
        {
            setunitdata($@mobIds[.@i], UDT_MAXHP, 451578);
            setunitdata($@mobIds[.@i], UDT_HP, 451578);
        }
    }
    areamonster .@map$,175,163,265,18,"Suffered Khalitzburg",2471,7,.@label$;
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobIds); .@i++ )
        {
            setunitdata($@mobIds[.@i], UDT_MAXHP, 473702);
            setunitdata($@mobIds[.@i], UDT_HP, 473702);
        }
    }
    areamonster .@map$,175,163,265,18,"Bloody Knight",2472,7,.@label$;
    if('oghMode == 2)
    {
        for( .@i = 0; .@i < getarraysize($@mobIds); .@i++ )
        {
            setunitdata($@mobIds[.@i], UDT_MAXHP, 493502);
            setunitdata($@mobIds[.@i], UDT_HP, 493502);
        }
    }
    set 'MyMobs,35;
    end;
OnMyMobDead:
    set .@map$,instance_mapname("2@gl_k");
    if('oghMode == 2)
    {
        if(rand(1000) < 'hardModeLootChance)
        {
            getitem 6755, 1;
        }
    }
    set 'MyMobs,'MyMobs-1;
    if ('MyMobs == 0) {
        mapannounce .@map$,"An evil presence has teleported into this area.",bc_map,"0xFFFF00",FW_NORMAL,18;
        donpcevent instance_npcname("#ghmemorialmob09")+"::OnEnable";
        donpcevent instance_npcname("#ghmemorialmob08")+"::OnDisable";
    } else {
        set .@label$,instance_npcname("#ghmemorialmob08")+"::OnMyMobDead";
        switch (rand(5)) {
        case 0:
            areamonster .@map$,175,163,265,18,"Corrupted Palace Guard",2468,1,.@label$;
            if('oghMode == 2)
            {
                setunitdata($@mobIds[0], UDT_MAXHP, 368160);
                setunitdata($@mobIds[0], UDT_HP, 368160);
            }
            break;
        case 1:
            areamonster .@map$,175,163,265,18,"Wandering Archer",2469,1,.@label$;
            if('oghMode == 2)
            {
                setunitdata($@mobIds[0], UDT_MAXHP, 288740);
                setunitdata($@mobIds[0], UDT_HP, 288740);
            }
            break;
        case 2:
            areamonster .@map$,175,163,265,18,"Corrupted Abysmal Knight",2470,1,.@label$;
            if('oghMode == 2)
            {
                setunitdata($@mobIds[0], UDT_MAXHP, 451578);
                setunitdata($@mobIds[0], UDT_HP, 451578);
            }
            break;
        case 3:
            areamonster .@map$,175,163,265,18,"Suffered Khalitzburg",2471,1,.@label$;
            if('oghMode == 2)
            {
                setunitdata($@mobIds[0], UDT_MAXHP, 473702);
                setunitdata($@mobIds[0], UDT_HP, 473702);
            }
            break;
        case 4:
            areamonster .@map$,175,163,265,18,"Bloody Knight",2472,1,.@label$;
            if('oghMode == 2)
            {
                setunitdata($@mobIds[0], UDT_MAXHP, 493502);
                setunitdata($@mobIds[0], UDT_HP, 493502);
            }
            break;
        }
    }
    end;
}

2@gl_k,0,0,0    script    #ghmemorialmob09    -1,{
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname("#ghmemorialmob09");
    end;
OnEnable:
    enablenpc instance_npcname("#ghmemorialmob09");
    areamonster instance_mapname("2@gl_k"),175,163,265,18,"2nd Commander of Destruction",2474,1,instance_npcname("#ghmemorialmob09")+"::OnMyMobDead";
    if('oghMode == 2)
    {
        setunitdata($@mobIds[0], UDT_MAXHP, 1696020);
        setunitdata($@mobIds[0], UDT_HP, 1696020);
    }
    end;
OnMyMobDead:
    set .@map$,instance_mapname("2@gl_k");
    if('oghMode == 2)
    {
        if(rand(1000) < 'hardModeLootChance)
        {
            getitem 6755, 1;
        }
    }
    if (mobcount(.@map$,instance_npcname("#ghmemorialmob09")+"::OnMyMobDead") < 1) {
        mapannounce .@map$,"A new portal has appeared at the end of the central corridor.",bc_map,"0xFFFF00";
        donpcevent instance_npcname("#ghinstancewarp12")+"::OnEnable";
        donpcevent instance_npcname("#ghinstancewarp13")+"::OnEnable";
        donpcevent instance_npcname("#controlGH6")+"::OnEnable";
        donpcevent instance_npcname("#ghmemorialmob08")+"::OnDisable";
        donpcevent instance_npcname("#ghmemorialmob09")+"::OnDisable";
    }
    end;
}

2@gl_k,0,0,0    script    #ghmemorialmob10    -1,{
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname("#ghmemorialmob10");
    end;
OnEnable:
    enablenpc instance_npcname("#ghmemorialmob10");
    donpcevent instance_npcname("Gerhalt#ghinstance1")+"::OnDisable";
    monster instance_mapname("2@gl_k"),158,255,"Amdarais",2476,1,instance_npcname("#ghmemorialmob10")+"::OnMyMobDead";
    if('oghMode == 2)
    {
        setunitdata($@mobIds[0], UDT_MAXHP, 49200000);
        setunitdata($@mobIds[0], UDT_HP, 49200000);
    }
    unittalk $@mobid[0],"Run away... run away from me...",1;
    initnpctimer;
    end;
OnTimer6000:
    unittalk $@mobid[0],"I don't want... I don't want to kill anyone. Uhuuuuuh",1;
    end;
OnTimer12000:
    unittalk $@mobid[0],"Please kill me! Please!",1;
    end;
OnTimer18000:
    unittalk $@mobid[0],"Eeeeee...eee...die... die...",1;
    end;
OnTimer24000:
    unittalk $@mobid[0],"Demolition... Death!...",1;
    stopnpctimer;
    end;
OnMyMobDead:
    if('oghMode == 2)
    {
        if(rand(1000) < 'hardModeLootChance)
        {
            getitem 6755, 1;
        }
    }
    if (mobcount(instance_mapname("2@gl_k"),instance_npcname("#ghmemorialmob10")+"::OnMyMobDead") < 1) {
        donpcevent instance_npcname("Hugin#ghinstance1")+"::OnEnable";
        donpcevent instance_npcname("#ghinstancewarp15")+"::OnEnable";

        for (set .@i,1; .@i<=8; set .@i,.@i+1)
            enablenpc instance_npcname("Strange crack#"+.@i);

        stopnpctimer;
        donpcevent instance_npcname("#ghmemorialmob10")+"::OnDisable";
    }
    end;
}

2@gl_k,155,250,7    script    Heinrich#ghinstance6    652,{
    cutin "gl_heinrich1",2;
    mes "[Heinrich]";
    mes "What are you decorating Himelmez!";
    close2;
    cutin "gl_heinrich1",255;
    end;
OnInstanceInit:
OnDisable:
    hideonnpc instance_npcname("Heinrich#ghinstance6");
    end;
OnEnable:
    hideoffnpc instance_npcname("Heinrich#ghinstance6");
    end;
OnTalk1:
    npctalk "Gerhalt!";
    end;
OnTalk2:
    npctalk "What are you doing to my soldier Himelmez!";
    end;
OnTalk3:
    npctalk "Himelmez! You already made what you want so there is no more need for a sacrifice!";
    end;
OnTalk4:
    npctalk "Let him go! I don't need to see anyone else suffer!";
    end;
OnTalk5:
    npctalk "I'll never forgive you.";
    end;
OnTalk6:
    npctalk "I'll never let you get away Himelmez!!";
    end;
}

2@gl_k,162,250,1    script    Varmundt#ghinstance5    654,{
    cutin "gl_barmund2",2;
    mes "[Varmundt]";
    mes "Can't take off this bridle...";
    close2;
    cutin "gl_barmund2",255;
    end;
OnInstanceInit:
OnDisable:
    hideonnpc instance_npcname("Varmundt#ghinstance5");
    end;
OnEnable:
    hideoffnpc instance_npcname("Varmundt#ghinstance5");
    end;
OnTalk1:
    npctalk "We have no choice. We have to fight against Amdarais!";
    end;
}

2@gl_k,158,252,3    script    Himelmez#ghinstance4    650,{
    cutin "gl_himel2",2;
    mes "[Himelmez]";
    mes "That is amazing ~ you made it all the way here. May I say thank you?";
    close2;
    cutin "gl_himel2",255;
    end;
OnInstanceInit:
OnDisable:
    hideonnpc instance_npcname("Himelmez#ghinstance4");
    end;
OnEnable:
    hideoffnpc instance_npcname("Himelmez#ghinstance4");
    end;
OnTalk1:
    npctalk "Amazing~ I thought that you were not even close to getting here...";
    end;
OnTalk2:
    npctalk "Hoo hoo, I already found a piece of Ymir's heart Heinrich.";
    end;
OnTalk3:
    npctalk "If he did not bother me, it would have been faster.";
    end;
OnTalk4:
    npctalk "Really? What makes you think so?";
    end;
OnTalk5:
    npctalk "Let him go? I think... No...";
    end;
OnTalk6:
    npctalk "Besides, this is your last surviving soldier Heinrich.";
    end;
OnTalk7:
    npctalk "He made life difficult for me.";
    end;
OnTalk8:
    npctalk "He is perfectly fit for my new creation Amdarais.";
    end;
OnTalk9:
    npctalk "Uh uh~ I'm so scared.";
    end;
OnTalk10:
    npctalk "Anyway, we will have a chance to see because we need to talk more.";
    end;
OnTalk11:
    npctalk "So long boys.";
    end;
}

2@gl_k,150,179,0    script    #controlGH6    111,2,2,{
    end;
OnTouch:
    mapannounce instance_mapname("2@gl_k"),"???: Do not come here! It's a trap... Kkkkah!!!",bc_map,"0xFF0000",FW_NORMAL,18;
    specialeffect EF_BASH;
    donpcevent instance_npcname("Himelmez#ghinstance3")+"::OnEnable";
    donpcevent instance_npcname("Heinrich#ghinstance6")+"::OnEnable";
    donpcevent instance_npcname("Varmundt#ghinstance5")+"::OnEnable";
    donpcevent instance_npcname("Gerhalt#ghinstance1")+"::OnEnable";
    donpcevent instance_npcname("#controlGH6")+"::OnDisable";
    end;
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname("#controlGH6");
    end;
OnEnable:
    enablenpc instance_npcname("#controlGH6");
    end;
}

2@gl_k,158,252,1    script    Himelmez#ghinstance3    650,7,7,{
    end;
OnTouch:
    specialeffect EF_BASH;
    donpcevent instance_npcname("#controlGH5")+"::OnEnable";
    donpcevent instance_npcname("Himelmez#ghinstance4")+"::OnEnable";
    donpcevent instance_npcname("Himelmez#ghinstance3")+"::OnDisable";
    end;
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname("Himelmez#ghinstance3");
    end;
OnEnable:
    enablenpc instance_npcname("Himelmez#ghinstance3");
    end;
}

2@gl_k,158,255,3    script    Gerhalt#ghinstance1    651,{
    mes "[Gerhalt]";
    mes "Uuuuu... Khhhah! Just run away with the commander.";
    close;
OnInstanceInit:
OnDisable:
    hideonnpc instance_npcname("Gerhalt#ghinstance1");
    end;
OnEnable:
    hideoffnpc instance_npcname("Gerhalt#ghinstance1");
    end;
OnTalk1:
    npctalk "Kkkkah! Run away! I can't endure anymore!";
    end;
OnTalk2:
    npctalk "Commandant... Come on, you need to run away from here... Ugh.";
    end;
OnTalk3:
    npctalk "You can make my body but you can't take my soul Himelmez!";
    end;
OnEffect1:
    specialeffect EF_BARRIER;
    end;
OnEffect2:
    specialeffect EF_CHAINCOMBO;
    end;
OnEffect3:
    specialeffect EF_MAPPILLAR2;
    end;
OnEffect4:
    specialeffect EF_MAPPILLAR;
    end;
OnEffect5:
    specialeffect EF_LORD;
    end;
}

2@gl_k,0,0,0    script    #controlGH5    -1,{
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname("#controlGH5");
    end;
OnEnable:
    enablenpc instance_npcname("#controlGH5");
    initnpctimer;
    end;
OnTimer3000:
    donpcevent instance_npcname("Himelmez#ghinstance4")+"::OnTalk1";
    end;
OnTimer6000:
    donpcevent instance_npcname("Gerhalt#ghinstance1")+"::OnTalk1";
    end;
OnTimer9000:
    donpcevent instance_npcname("Heinrich#ghinstance6")+"::OnTalk1";
    end;
OnTimer15000:
    donpcevent instance_npcname("Heinrich#ghinstance6")+"::OnTalk2";
    end;
OnTimer18000:
    donpcevent instance_npcname("Himelmez#ghinstance4")+"::OnTalk2";
    end;
OnTimer21000:
    donpcevent instance_npcname("Himelmez#ghinstance4")+"::OnTalk3";
    end;
OnTimer24000:
    donpcevent instance_npcname("Gerhalt#ghinstance1")+"::OnTalk2";
    end;
OnTimer27000:
    donpcevent instance_npcname("Himelmez#ghinstance4")+"::OnTalk4";
    end;
OnTimer30000:
    donpcevent instance_npcname("Heinrich#ghinstance6")+"::OnTalk3";
    end;
OnTimer33000:
    donpcevent instance_npcname("Heinrich#ghinstance6")+"::OnTalk4";
    end;
OnTimer36000:
    donpcevent instance_npcname("Himelmez#ghinstance4")+"::OnTalk5";
    end;
OnTimer39000:
    donpcevent instance_npcname("Himelmez#ghinstance4")+"::OnTalk6";
    end;
OnTimer42000:
    donpcevent instance_npcname("Himelmez#ghinstance4")+"::OnTalk7";
    end;
OnTimer45000:
    donpcevent instance_npcname("Himelmez#ghinstance4")+"::OnTalk8";
    end;
OnTimer48000:
    donpcevent instance_npcname("Heinrich#ghinstance6")+"::OnTalk5";
    end;
OnTimer51000:
    donpcevent instance_npcname("Himelmez#ghinstance4")+"::OnTalk9";
    end;
OnTimer54000:
    donpcevent instance_npcname("Himelmez#ghinstance4")+"::OnTalk10";
    end;
OnTimer57000:
    donpcevent instance_npcname("Himelmez#ghinstance4")+"::OnTalk11";
    end;
OnTimer60000:
    donpcevent instance_npcname("Gerhalt#ghinstance1")+"::OnEffect1";
    end;
OnTimer63000:
    donpcevent instance_npcname("Himelmez#ghinstance4")+"::OnDisable";
    end;
OnTimer65000:
    donpcevent instance_npcname("Gerhalt#ghinstance1")+"::OnEffect3";
    end;
OnTimer66000:
    donpcevent instance_npcname("Gerhalt#ghinstance1")+"::OnEffect2";
    end;
OnTimer67000:
    donpcevent instance_npcname("Heinrich#ghinstance6")+"::OnTalk6";
    donpcevent instance_npcname("Gerhalt#ghinstance1")+"::OnEffect4";
    end;
OnTimer70000:
    donpcevent instance_npcname("Gerhalt#ghinstance1")+"::OnEffect3";
    donpcevent instance_npcname("Gerhalt#ghinstance1")+"::OnEffect4";
    donpcevent instance_npcname("Heinrich#ghinstance6")+"::OnDisable";
    donpcevent instance_npcname("Varmundt#ghinstance5")+"::OnTalk1";
    donpcevent instance_npcname("Varmundt#ghinstance5")+"::OnDisable";
    end;
OnTimer73000:
    mapannounce instance_mapname("2@gl_k"),"Gerhalt's body changing.",bc_map,"0xFFFFFF";
    end;
OnTimer76000:
    donpcevent instance_npcname("Gerhalt#ghinstance1")+"::OnEffect5";
    end;
OnTimer80000:
    donpcevent instance_npcname("#ghmemorialmob10")+"::OnEnable";
    stopnpctimer;
    donpcevent instance_npcname("#controlGH5")+"::OnDisable";
    end;
}

2@gl_k,158,241,1    script    Hugin#ghinstance1    755,{
    if (checkquest(12319,HUNTING) == 2) {
        mes "[Hugin]";
        mes "Well, you are pretty ridiculous. Beginners shouldn't get the loot Amdarias drops.";
        erasequest 12319;
        setquest 12321;
        setquest 12322;
        erasequest 12321;
        if (gh_instance) {
            getitem 6607,1; //Temporal_Crystal
            getitem 6608,1; //Coagulated_Spell
        } else {
            getitem 6607,5; //Temporal_Crystal
            getitem 6608,5; //Coagulated_Spell
            gh_instance = 1;
        }
        next;
        mes "[Hugin]";
        mes "Varmunt, I have arbitrarily stopped time. And soon, the time gap will be gone.";
        specialeffect2 EF_BLIND;
        soundeffect "_blind.wav",0;
        next;
        mes "[Hugin]";
        mes "Poor time travelers.";
        mes "They will endlessly retry to prevent the tragedy that affected this city.";
        next;
        mes "[Hugin]";
        mes "But the beggining of these time travels won't redempt your actions.";
        mes "This will continue forever...";
        next;
        mes "[Hugin]";
        mes "Now, I may erase your memory again. Perhaps you will have a different fate next time.";
        specialeffect2 EF_FREEZE;
        close2;
        getmapxy(.@map$,.@x,.@y,UNITTYPE_PC);
        warp .@map$,.@x,.@y;
        end;
    } else {
        mes "[Hugin]";
        mes "The gap of time is almost distorted.";
        mes "Done. There you go. Come!";
        mes "I have to get out!";
        next;
        select("Bah... Soon after you...");
        mes "[Hugin]";
        mes "Soon after me? Anyways...";
        mes "Doesn't matter, soon the gap of time will be closed, I have to get out of here.";
        next;
        switch(select("Since I'm here, let's explore more.:Please, send me out.")) {
        case 1:
            mes "[Hugin]";
            mes "..................";
            close;
        case 2:
            close2;
            warp "glast_01",204,270;
            end;
        }
    }
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname("Hugin#ghinstance1");
    end;
OnEnable:
    enablenpc instance_npcname("Hugin#ghinstance1");
    end;
}

// Treasure Room
//============================================================
1@gl_k,269,267,0    script    Strange crack#entrace    111,{
    if (checkquest(12322) == -1) {
        mes "The crack looks suspicious, but nothing more to check.";
        close;
    }
    set .@map$,instance_mapname("1@gl_k");
    warp .@map$,149,198;
    end;
}

1@gl_k,129,136,0    script    Strange crack#1    111,{
    specialeffect EF_SPELLBREAKER;
    specialeffect EF_BASH;
    set .@random,rand(1,4);
    set .@random_,rand(1,4);
    for (set .@i,1; .@i<=.@random; set .@i,.@i+1)
        makeitem 727,1,"this",129,138;
    makeitem 6608,1,"this",129,138;
    if (.@random_ == 4)
        makeitem2 21007,1,"this",129,138,0,0,0,0,0,0,0;
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname("Strange crack#1");
    end;
OnEnable:
    enablenpc instance_npcname("Strange crack#1");
    end;
}

1@gl_k,135,136,0    script    Strange crack#2    111,{
    specialeffect EF_SPELLBREAKER;
    specialeffect EF_BASH;
    set .@random,rand(1,4);
    set .@random_,rand(1,4);
    for (set .@i,1; .@i<=.@random; set .@i,.@i+1)
        makeitem 726,1,"this",135,138;
    if (.@random_ == 4)
        makeitem2 2022,1,"this",135,138,0,0,0,0,0,0,0;
    makeitem 6608,1,"this",135,138;
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname("Strange crack#2");
    end;
OnEnable:
    enablenpc instance_npcname("Strange crack#2");
    end;
}

1@gl_k,141,136,0    script    Strange crack#3    111,{
    specialeffect EF_SPELLBREAKER;
    specialeffect EF_BASH;
    set .@random,rand(1,4);
    set .@random_,rand(1,4);
    for (set .@i,1; .@i<=.@random; set .@i,.@i+1)
        makeitem 725,1,"this",141,138;
    makeitem 6608,1,"this",141,138;
    makeitem 7228,1,"this",141,138;
    if (.@random_ == 4)
        makeitem2 13440,1,"this",141,138,0,0,0,0,0,0,0;
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname("Strange crack#3");
    end;
OnEnable:
    enablenpc instance_npcname("Strange crack#3");
    end;
}

1@gl_k,147,136,0    script    Strange crack#4    111,{
    specialeffect EF_SPELLBREAKER;
    specialeffect EF_BASH;
    set .@random,rand(1,4);
    set .@random_,rand(1,4);
    for (set .@i,1; .@i<=.@random; set .@i,.@i+1)
        makeitem 722,1,"this",147,138;
    if (.@random_ == 4)
        makeitem2 2949,1,"this",147,138,0,0,0,0,0,0,0;
    makeitem 6608,1,"this",147,138;
    makeitem 6612,1,"this",147,138;
    makeitem 6613,1,"this",147,138;
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname("Strange crack#4");
    end;
OnEnable:
    enablenpc instance_npcname("Strange crack#4");
    end;
}

1@gl_k,153,136,0    script    Strange crack#5    111,{
    specialeffect EF_SPELLBREAKER;
    specialeffect EF_BASH;
    set .@random,rand(1,4);
    set .@random_,rand(1,4);
    for (set .@i,1; .@i<=.@random; set .@i,.@i+1)
        makeitem 721,1,"this",153,138;
    makeitem 6608,1,"this",153,138;
    makeitem 7230,1,"this",153,138;
    if (.@random_ == 4)
        makeitem2 13086,1,"this",153,138,0,0,0,0,0,0,0;
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname("Strange crack#5");
    end;
OnEnable:
    enablenpc instance_npcname("Strange crack#5");
    end;
}

1@gl_k,159,136,0    script    Strange crack#6    111,{
    specialeffect EF_SPELLBREAKER;
    specialeffect EF_BASH;
    set .@random,rand(1,4);
    set .@random_,rand(1,4);
    for (set .@i,1; .@i<=.@random; set .@i,.@i+1)
        makeitem 720,1,"this",159,138;
    makeitem 6608,1,"this",159,138;
    makeitem 7229,1,"this",159,138;
    if (.@random_ == 4)
        makeitem2 15066,1,"this",159,138,0,0,0,0,0,0,0;
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname("Strange crack#6");
    end;
OnEnable:
    enablenpc instance_npcname("Strange crack#6");
    end;
}

1@gl_k,165,136,0    script    Strange crack#7    111,{
    specialeffect EF_SPELLBREAKER;
    specialeffect EF_BASH;
    set .@random,rand(1,4);
    for (set .@i,1; .@i<=.@random; set .@i,.@i+1)
        makeitem 719,1,"this",165,138;
    makeitem 6608,1,"this",165,138;
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname("Strange crack#7");
    end;
OnEnable:
    enablenpc instance_npcname("Strange crack#7");
    end;
}

1@gl_k,171,136,0    script    Strange crack#8    111,{
    specialeffect EF_SPELLBREAKER;
    specialeffect EF_BASH;
    set .@random,rand(1,4);
    for (set .@i,1; .@i<=.@random; set .@i,.@i+1)
        makeitem 718,1,"this",171,138;
    makeitem 6608,1,"this",171,138;
OnInstanceInit:
OnDisable:
    disablenpc instance_npcname("Strange crack#8");
    end;
OnEnable:
    enablenpc instance_npcname("Strange crack#8");
    end;
}

// Merchant
//============================================================
glast_01,210,273,5    script    Hugin's Buttler    69,{
    disable_items;
    if (MaxWeight - Weight < 1000) {
        mes "Your bag is too heavy. Reduce some weight and come back.";
        close;
    }
    mes "[Hugin's Buttler]";
    mes "Bring Temporal Crystal items for various Temporal boots items. Pick something you want.";
    next;
    switch (select("Cancel","Buy Temporal Boots (Need 1 Temporal Crystal)","Upgrade Temporal Boots (Need 5 Temporal Crystals)")) {
    case 1:
        mes "[Hugin's Buttler]";
        mes "Come back whenever you want.";
        close;
    case 2:
        if (countitem(6607) > 0) {
            mes "[Hugin's Buttler]";
            mes "Take these Temporal Boots. We can upgrade your Temporal Boots with 5 Temporal Crystals.";
            delitem 6607,1; //Temporal_Crystal
            getitem 2499,1; //Temporal_Boots
            close;
        }
        mes "[Hugin's Buttler]";
        mes "You need more Temporal Crystals. Come back when you get some more Temporal Crystals during your travel through Old Glast Heim.";
        close;
    case 3:
        set .@part,EQI_SHOES;
        if (!getequipisequiped(.@part)) {
            mes "[Hugin's Buttler]";
            mes "Only the item you are wearing can be upgraded.";
            mes "Wear the ^0000FFTemporal Boots^000000 you want to upgrade, and then talk to me once again.";
            close;
        }
        if (isequipped(2499)) {
            if (countitem(6607) > 4) {
                mes "[Hugin's Buttler]";
                mes "You can trade ^0000FF1 Temporal Boots and 5 Temporal Crystals^000000 for 1 of the following items. ^FF0000Previous refine rate will not be retained with these new ones^000000.";
                next;
                setarray .@type$[0],"Strength","Intelligence","Agility","Vitality","Dexterity","Lucky";
                setarray .@equip_type[0],22000,22001,22002,22003,22004,22005;
                set .@select,select("Cancel","Str Boots","Int Boots","Agi Boots","Vit Boots","Dex Boots","Luk Boots");
                switch (.@select) {
                case 1:
                    mes "[Hugin's Buttler]";
                    mes "Come back anytime you want.";
                    close;
                case 2:
                case 3:
                case 4:
                case 5:
                case 6:
                case 7:
                    mes "[Hugin's Buttler]";
                    mes "Are you sure about buying Temporal ^FF0000"+.@type$[.@select-2]+"^000000 Boots? There's no refunds.";
                    next;
                    if (select("Think again","Yes, I am sure.") == 2) {
                        mes "[Hugin's Buttler]";
                        mes "The boots have been upgraded as you want.";
                        delequip .@part;
                        delitem 6607,5; //Temporal_Crystal
                        getitem .@equip_type[.@select-2],1; //Temporal_STR_Boots,Temporal_INT_Boots,Temporal_AGI_Boots,Temporal_VIT_Boots,Temporal_DEX_Boots,Temporal_LUK_Boots
                        close;
                    }
                    mes "[Hugin's Buttler]";
                    mes "Ok, come back again when you are sure.";
                    close;
                }
            }
            mes "[Hugin's Buttler]";
            mes "Not enough Temporal Crystals. You need 5 Temporal Crystals to upgrade your item.";
            close;
        }
        mes "[Hugin's Buttler]";
        mes "You are not wearing the Temporal Boots. Talk to me once you're wearing them.";
        close;
    }
}

// Enchant and Socket NPC
//============================================================
glast_01,212,273,4    script    Hugin's Magic master    66,{
    disable_items;
    if (MaxWeight - Weight < 1000) {
        mes "Your bag is too heavy. Reduce some weight and come back.";
        close;
    }
    mes "[Hugin's Magic Master]";
    mes "So you came to enchant the Temporal Boots. Be aware that Boots with sockets cannot be enchanted, and this upgrade is only possible for the boots you are wearing.";
    next;
    if (select("How does the enchanting work?","Give effect to my Temporal Boots") == 1) {
        mes "[Hugin's Magic Master]";
        mes "You can keep obtain ^0000FFCoagulated Spell^000000 through your travel times.";
        next;
        mes "[Hugin's Magic Master]";
        mes "I can enchant your Temporal Boots items depands on the amount of that item. ^0000FFNot normal type boots^000000. Only possible for those 6 expanded version boots.";
        next;
        mes "[Hugin's Magic Master]";
        mes "But, once you put a socket into the item, you cannot enchant it. Make sure to remember that.";
        next;
        mes "[Hugin's Magic Master]";
        mes "I don't give out effect randomly. You can pick which effect you want for the item.";
        next;
        mes "[Hugin's Magic Master]";
        mes "Of course it is for 4th slot only. You can have small effect at the start, and then the effect gets stronger.";
        next;
        mes "[Hugin's Magic Master]";
        mes "To get to the final option upgrade, it will require way more Coagulated Spell items. Don't forget that.";
        next;
        mes "[Hugin's Magic Master]";
        mes "Once the 4th slot completes the best option, you get to have a random bonus effect to the 3rd slot. With.. certain payment~";
        next;
        mes "[Hugin's Magic Master]";
        mes "Also, you don't lose the item even if the enchant fails, we also guarantee keeping card and refine rate. But we can't initialize enchanting.";
        next;
        mes "[Hugin's Magic Master]";
        mes "Phew...";
        mes "Anyways, that's all for basic enchant information. Now you should see for yourself.";
        close;
    }
    set .@part,EQI_SHOES;
    if (!getequipisequiped(.@part)) {
        mes "[Hugin's Magic Master]";
        mes "Are you wearing the item?";
        close;
    }
    set .@equip_id,getequipid(.@part);
    set .@equip_name$,getequipname(.@part);
    set .@card3,getequipcardid(.@part,3);
    setarray .@enchant1st[0],4808,4832,4814,4741,4869,4752; //Fighting_Spirit4,Expert_Archer1,Spell2,Vitality2,DelayafterAttack1Lv,Luck3
    setarray .@enchant2nd[0],4820,4833,4813,4742,4872,4753; //Fighting_Spirit5,Expert_Archer2,Spell3,Vitality3,DelayafterAttack2Lv,Luck4
    setarray .@enchant3rd[0],4821,4834,4812,4861,4873,4754; //Fighting_Spirit6,Expert_Archer3,Spell4,MHP1,DelayafterAttack3Lv,Luck5
    setarray .@enchant4th[0],4822,4835,4826,4862,4881,4755; //Fighting_Spirit7,Expert_Archer4,Spell5,MHP2,DelayafterAttack4Lv,Luck6
    setarray .@enchant_cost[0],25,50,150,250,350;
    switch (.@equip_id) {
    case 22006: //Temporal_Str_Boots
    case 22009: //Temporal_Int_Boots
    case 22010: //Temporal_Agi_Boots
    case 22007: //Temporal_Vit_Boots
    case 22008: //Temporal_Dex_Boots
    case 22011: //Temporal_Luk_Boots
    case 22000: //Temporal_STR_Boots
    case 22001: //Temporal_INT_Boots
    case 22002: //Temporal_AGI_Boots
    case 22003: //Temporal_VIT_Boots
    case 22004: //Temporal_DEX_Boots
    case 22005: //Temporal_LUK_Boots
        if (!.@card3) { //4th slot 1st try enchanting
            set .@cost,.@enchant_cost[0];
            set .@number,1;
            mes "[Hugin's Magic Master]";
            mes "Want to enchant ^0000FF"+.@equip_name$+"^000000?";
            mes "For the "+.@number+"st enchanting, you need ^0000FF"+.@cost+"^000000 Coagulated Spell items.";
            next;
            set .@select,select("Quit","Fighting Spirit","Archery","Spell","Vitality","Attack Speed","Lucky");
            switch (.@select) {
            case 1:
                mes "[Hugin's Magic Master]";
                mes "Ok, come back when you are ready.";
                close;
            case 2:
                set .@enchant,.@enchant1st[.@select-2];
                break;
            case 3:
                set .@enchant,.@enchant1st[.@select-2];
                break;
            case 4:
                set .@enchant,.@enchant1st[.@select-2];
                break;
            case 5:
                set .@enchant,.@enchant1st[.@select-2];
                break;
            case 6:
                set .@enchant,.@enchant1st[.@select-2];
                break;
            case 7:
                set .@enchant,.@enchant1st[.@select-2];
                break;
            }
        } else {
            if (.@card3 == .@enchant1st[0] || .@card3 == .@enchant1st[1] || .@card3 == .@enchant1st[2] ||
                .@card3 == .@enchant1st[3] || .@card3 == .@enchant1st[4] || .@card3 == .@enchant1st[5]) {
                set .@cost,.@enchant_cost[1];
                set .@number,2;
            } else if (.@card3 == .@enchant2nd[0] || .@card3 == .@enchant2nd[1] || .@card3 == .@enchant2nd[2] ||
                .@card3 == .@enchant2nd[3] || .@card3 == .@enchant2nd[4] || .@card3 == .@enchant2nd[5]) {
                set .@cost,.@enchant_cost[2];
                set .@number,3;
            } else if (.@card3 == .@enchant3rd[0] || .@card3 == .@enchant3rd[1] || .@card3 == .@enchant3rd[2] ||
                .@card3 == .@enchant3rd[3] || .@card3 == .@enchant3rd[4] || .@card3 == .@enchant3rd[5]) {
                set .@cost,.@enchant_cost[3];
                set .@number,4;
            } else if (.@card3 == .@enchant4th[0] || .@card3 == .@enchant4th[1] || .@card3 == .@enchant4th[2] ||
                .@card3 == .@enchant4th[3] || .@card3 == .@enchant4th[4] || .@card3 == .@enchant4th[5]) {
                set .@card2,getequipcardid(.@part,2);
                set .@cost,.@enchant_cost[4];
                if (.@card2) {
                    mes "[Hugin's Magic Master]"; //Custom text
                    mes "Your shoes have reached the maximum option to enchant.";
                    mes "Please bring me a new one if you want me to enchant again.";
                    close;
                }
                //3rd slot random enchanting
                switch (.@card3) {
                    case 4822: //Fighting_Spirit7
                    case 4835: //Expert_Archer4
                    case 4826: //Spell5
                    case 4862: //MHP2
                    case 4881: //DelayafterAttack4Lv
                    case 4755: //Luck6
                        set .@enchant,callfunc("F_Rand",4875,4876,4877,4878,4879,4880); //Bear's_Power,Runaway_Magic,Speed_Of_Light,Muscle_Fool,Hawkeye,Lucky_Day
                        mes "[Hugin's Magic Master]"; //Custom text
                        mes "Seems you already completed the best upgrade option in your 4th slot.";
                        mes "For that I can give a random bonus effect to your 3rd slot. And of course, with certain payment...";
                        next;
                        mes "[Hugin's Magic Master]";
                        mes "Enchanting ^0000FF"+.@equip_name$+"^000000's 3rd slot for obtaining a random bonus effect. Requires ^0000FF"+.@cost+"^000000 Coagulated Spell items.";
                        next;
                        if (select("Quit","Effect Upgrade!") == 1) {
                            mes "[Hugin's Magic Master]";
                            mes "Ok, come back when you are ready.";
                            close;
                        }
                        if (countitem(6608) < .@cost) {
                            mes "[Hugin's Magic Master]";
                            mes "Hmm, you are missing "+(.@cost - countitem(6608))+" Coagulated Spell items. Go get more, and then we can talk about more enchants.";
                            close;
                        }
                        specialeffect2 EF_REPAIRWEAPON;
                        set .@equip_refine,getequiprefinerycnt(.@part);
                        delitem 6608,.@cost; //Coagulated_Spell
                        .@card = getequipcardid(.@part,0);
                        delequip .@part;
                        mes "[Hugin's Magic Master]";
                        mes "This is it! This special stone is now yours.";
                        mes "Hahaha... I am really the only master of these things.";
                        mes "Thank you for believing in me.";
                        getitem2 .@equip_id,1,1,.@equip_refine,0,.@card,0,.@enchant,.@card3;
                        close;
                }
            }
            //4th slot 2nd try enchanting
            if (.@card3 == .@enchant1st[0])
                set .@enchant,.@enchant2nd[0];
            else if (.@card3 == .@enchant1st[1])
                set .@enchant,.@enchant2nd[1];
            else if (.@card3 == .@enchant1st[2])
                set .@enchant,.@enchant2nd[2];
            else if (.@card3 == .@enchant1st[3])
                set .@enchant,.@enchant2nd[3];
            else if (.@card3 == .@enchant1st[4])
                set .@enchant,.@enchant2nd[4];
            else if (.@card3 == .@enchant1st[5])
                set .@enchant,.@enchant2nd[5];
            //4th slot 3rd try enchanting
            if (.@card3 == .@enchant2nd[0])
                set .@enchant,.@enchant3rd[0];
            else if (.@card3 == .@enchant2nd[1])
                set .@enchant,.@enchant3rd[1];
            else if (.@card3 == .@enchant2nd[2])
                set .@enchant,.@enchant3rd[2];
            else if (.@card3 == .@enchant2nd[3])
                set .@enchant,.@enchant3rd[3];
            else if (.@card3 == .@enchant2nd[4])
                set .@enchant,.@enchant3rd[4];
            else if (.@card3 == .@enchant2nd[5])
                set .@enchant,.@enchant3rd[5];
            //4th slot 4th try enchanting
            if (.@card3 == .@enchant3rd[0])
                set .@enchant,.@enchant4th[0];
            else if (.@card3 == .@enchant3rd[1])
                set .@enchant,.@enchant4th[1];
            else if (.@card3 == .@enchant3rd[2])
                set .@enchant,.@enchant4th[2];
            else if (.@card3 == .@enchant3rd[3])
                set .@enchant,.@enchant4th[3];
            else if (.@card3 == .@enchant3rd[4])
                set .@enchant,.@enchant4th[4];
            else if (.@card3 == .@enchant3rd[5])
                set .@enchant,.@enchant4th[5];
            mes "[Hugin's Magic Master]";
            mes "Enchanting ^0000FF"+.@equip_name$+"^000000's 4th slot as ^0000FF"+.@number+"^000000 level effect. Requires ^0000FF"+.@cost+"^000000 Coagulated Spell items.";
            next;
            if (select("Quit","Effect Upgrade!") == 1) {
                mes "[Hugin's Magic Master]";
                mes "Ok, come back when you are ready.";
                close;
            }
            if (countitem(6608) < .@cost) {
                mes "[Hugin's Magic Master]";
                mes "Hmm, you are missing "+(.@cost - countitem(6608))+" Coagulated Spell items. Go get more, and then we can talk about more enchants.";
                close;
            }
        }
        break;
    default:
        mes "[Hugin's Magic Master]";
        mes "This is not the right item for this enchant.";
        mes "Remember, only those 6 types of Temporal Boots are available for enchanting.";
        close;
    }
    specialeffect2 EF_REPAIRWEAPON;
    set .@equip_refine,getequiprefinerycnt(.@part);
    delitem 6608,.@cost; //Coagulated_Spell
    .@card = getequipcardid(.@part,0);
    delequip .@part;
    mes "[Hugin's Magic Master]";
    mes "Trying for enchant number ^630000"+.@number+"^000000.";
    getitem2 .@equip_id,1,1,.@equip_refine,0,.@card,0,0,.@enchant;
    close;
}

glast_01,210,270,8    script    Hugin's Craftsman    726,{
    disable_items;
    if (MaxWeight - Weight < 1000) {
        mes "Your bag is too heavy. Reduce some weight and come back.";
        close;
    }
    mes "[Hugin's Craftsman]";
    mes "That Magic Master always says that enchanting Temporal Boots is the best. But, I think quite different.";
    next;
    mes "[Hugin's Craftsman]";
    mes "I think putting a slot into the item would be the best. Even with some risk of failing.";
    next;
    mes "[Hugin's Craftsman]";
    mes "Bring me ^0000FF5 Temporal Crystals^000000, and I will try to put a slot into your advanced Temporal Boots. But, it's possible to ^FF0000fail and break the item^000000. Is that ok?";
    next;
    if (select("Cancel","Take the risk and try to add a slot") == 1) {
        mes "[Hugin's Craftsman]";
        mes "Ok, come back anytime you want.";
        close;
    }
    set .@part,EQI_SHOES;
    if (!getequipisequiped(.@part)) {
        mes "[Hugin's Craftsman]";
        mes "Are you sure you are wearing the item?";
        close;
    }
    set .@equip_id,getequipid(.@part);
    switch (.@equip_id) {
    case 22000: //Temporal_Str_Boots
    case 22001: //Temporal_Int_Boots
    case 22002: //Temporal_Agi_Boots
    case 22003: //Temporal_Vit_Boots
    case 22004: //Temporal_Dex_Boots
    case 22005: //Temporal_Luk_Boots
        mes "[Hugin's Craftsman]";
        mes "And ^FF0000all enchant or refine rates will be lost if you fail this.^000000";
        mes "Still want to risk it?";
        next;
        if (select("Cancel","I am ok with it!") == 1) {
            mes "[Hugin's Craftsman]";
            mes "Ok, come back anytime you want.";
            close;
        }
        mes "[Hugin's Craftsman]";
        mes "Once again, ^FF0000That Magic Master won't enchant any item with a slot.^000000";
        mes "Still want to proceed?";
        next;
        if (select("Cancel","I understand. Try to slot it.") == 1) {
            mes "[Hugin's Craftsman]";
            mes "Ok, come back anytime you want.";
            close;
        }
        if (countitem(6607) < 5) {
            mes "[Hugin's Craftsman]";
            mes "You must bring ^0000FF5 Temporal Crystal items^000000. Nothing is free you know...";
            close;
        }
        set .@random,rand(1,100);
        if (.@random <= 90) { //Custom rates
            mes "[Hugin's Craftsman]";
            mes "Arrggg, we failed. Better luck next time.";
            specialeffect2 EF_PHARMACY_FAIL;
            delitem 6607,5; //Temporal_Crystal
            delequip .@part;
            close;
        }
        mes "[Hugin's Craftsman]"; //Custom text
        mes "Yuhuu~ we succeed. Here you are...";
        mes "A slot has been added to your advanced Temporal Boots.";
        mes "Thank you for believing in me.";
        specialeffect2 EF_PHARMACY_OK;
        delitem 6607,5; //Temporal_Crystal
        delequip .@part;
        if (.@equip_id == 22000) {
            getitem 22006,1; //Temporal_Str_Boots_
        } else if (.@equip_id == 22001) {
            getitem 22009,1; //Temporal_Int_Boots_
        } else if (.@equip_id == 22002) {
            getitem 22010,1; //Temporal_Agi_Boots_
        } else if (.@equip_id == 22003) {
            getitem 22007,1; //Temporal_Vit_Boots_
        } else if (.@equip_id == 22004) {
            getitem 22008,1; //Temporal_Dex_Boots_
        } else if (.@equip_id == 22005) {
            getitem 22011,1; //Temporal_Luk_Boots_
        }
        close;
    default:
        mes "[Hugin's Craftsman]";
        mes "This is not it! We need ^0000FFAdvanced Temporal Boots^000000 items! The item ^0000FFwith a stat effect and without a slot^000000!";
        close;
    }
}

glast_01,210,270,8    script    Hugin's Craftsman    726,{
    disable_items;
    if (MaxWeight - Weight < 1000) {
        mes "Your bag is too heavy. Reduce some weight and come back.";
        close;
    }
    mes "[Hugin's Craftsman]";
    mes "That Magic Master always says that enchanting Temporal Boots is the best. But, I think quite different.";
    next;
    mes "[Hugin's Craftsman]";
    mes "I think putting a slot into the item would be the best. Even with some risk of failing.";
    next;
    mes "[Hugin's Craftsman]";
    mes "Bring me ^0000FF5 Temporal Crystals^000000, and I will try to put a slot into your advanced Temporal Boots. But, it's possible to ^FF0000fail and break the item^000000. Is that ok?";
    next;
    if (select("Cancel","Take the risk and try to add a slot") == 1) {
        mes "[Hugin's Craftsman]";
        mes "Ok, come back anytime you want.";
        close;
    }
    set .@part,EQI_SHOES;
    if (!getequipisequiped(.@part)) {
        mes "[Hugin's Craftsman]";
        mes "Are you sure you are wearing the item?";
        close;
    }
    set .@equip_id,getequipid(.@part);
    switch (.@equip_id) {
    case 22000: //Temporal_Str_Boots
    case 22001: //Temporal_Int_Boots
    case 22002: //Temporal_Agi_Boots
    case 22003: //Temporal_Vit_Boots
    case 22004: //Temporal_Dex_Boots
    case 22005: //Temporal_Luk_Boots
        mes "[Hugin's Craftsman]";
        mes "And ^FF0000all enchant or refine rates will be lost if you fail this.^000000";
        mes "Still want to risk it?";
        next;
        if (select("Cancel","I am ok with it!") == 1) {
            mes "[Hugin's Craftsman]";
            mes "Ok, come back anytime you want.";
            close;
        }
        mes "[Hugin's Craftsman]";
        mes "Once again, ^FF0000That Magic Master won't enchant any item with a slot.^000000";
        mes "Still want to proceed?";
        next;
        if (select("Cancel","I understand. Try to slot it.") == 1) {
            mes "[Hugin's Craftsman]";
            mes "Ok, come back anytime you want.";
            close;
        }
        if (countitem(6607) < 5) {
            mes "[Hugin's Craftsman]";
            mes "You must bring ^0000FF5 Temporal Crystal items^000000. Nothing is free you know...";
            close;
        }
        set .@random,rand(1,100);
        if (.@random <= 50) { //Custom rates
            mes "[Hugin's Craftsman]";
            mes "Arrggg, we failed. Better luck next time.";
            specialeffect2 EF_PHARMACY_FAIL;
            delitem 6607,5; //Temporal_Crystal
            delequip .@part;
            close;
        }
        mes "[Hugin's Craftsman]"; //Custom text
        mes "Yuhuu~ we succeed. Here you are...";
        mes "A slot has been added to your advanced Temporal Boots.";
        mes "Thank you for believing in me.";
        specialeffect2 EF_PHARMACY_OK;
        delitem 6607,5; //Temporal_Crystal
        delequip .@part;
        if (.@equip_id == 22000) {
            getitem 22006,1; //Temporal_Str_Boots_
        } else if (.@equip_id == 22001) {
            getitem 22009,1; //Temporal_Int_Boots_
        } else if (.@equip_id == 22002) {
            getitem 22010,1; //Temporal_Agi_Boots_
        } else if (.@equip_id == 22003) {
            getitem 22007,1; //Temporal_Vit_Boots_
        } else if (.@equip_id == 22004) {
            getitem 22008,1; //Temporal_Dex_Boots_
        } else if (.@equip_id == 22005) {
            getitem 22011,1; //Temporal_Luk_Boots_
        }
        close;
    default:
        mes "[Hugin's Craftsman]";
        mes "This is not it! We need ^0000FFAdvanced Temporal Boots^000000 items! The item ^0000FFwith a stat effect and without a slot^000000!";
        close;
    }
}

// Knight Cards
glast_01,192,271,4    script    Ramsus    657,{
    mes "[Ramsus]";
    mes "I am collecting coagulated spells to perform my spells with more power.";
    mes "I am also collecting Contaminated Magic to this cards choose what you want.";
    next;
    mes "[Ramsus]";
    mes "If you have one I can exchange them.";
    next;
    if(select("Get out!","Coagulated Spell") == 1)
        close;
    close2;
    callshop "cs-shop1",1;
    end;
}
-    itemshop    cs-shop1    134,6608:0,4608:3000,4609:6000

// Glast Heim Nightmare Mode :: nightmare_gh
//============================================================
glast_01,195,273,4    script    Hugin's Follower#n_gh    123,{
    mes "[Hugin's Follower]";
    mes "I can't move between time and dimension like a master Hugin but I can pretend to move.";
    next;
    mes "[Hugin's Follower]";
    mes "What about this Glast Heim is born with powerful dark force?";
    next;
    if (select("I don't care","That is interesting, please tell me more") == 1) {
        mes "[Hugin's Follower]";
        mes "Well~ If you are not interested in it, never mind.";
        close;
    }
    mes "[Hugin's Follower]";
    mes "As learning ability from Hugin, I just find out the path to Old Glast Heim of more powerful dark force.";
    next;
    mes "[Hugin's Follower]";
    mes "How is it? Do you want to explore there?";
    next;
    if (select("No, I want to stop it","I really want to do that!") == 1) {
        mes "[Hugin's Follower]";
        mes "Well~ If you are not interested in it, never mind.";
        close;
    }
    mes "[Hugin's Follower]";
    mes "Sure that is not free~ I have to get something little bit. Hoho...";
    next;
    mes "[Hugin's Follower]";
    mes "I can send you just two place. How is it? Do you want to try?";
    next;
    switch (select("Cancel","Monastery Cemetery (Lv100~130) - 5000z","Corridor of 2nd floor (Over Lv140) - 10000z")) {
    case 1:
        mes "[Hugin's Follower]";
        mes "Alright, please come back whenever you change mind. I think you will have lots of thing to talk with me...";
        close;
    case 2:
        if (Zeny < 5000) {
            mes "[Hugin's Follower]";
            mes "Please make sure you already have all of the money.";
            close;
        }
        set Zeny,Zeny-5000;
        warp "gl_chyard_",148,144;
        end;
    case 3:
        if (Zeny < 10000) {
            mes "[Hugin's Follower]";
            mes "Please make sure you already have all of the money.";
            close;
        }
        set Zeny,Zeny-10000;
        warp "gl_cas02_",104,31;
        end;
    }
}

gl_chyard_,148,149,4    script    Hugin's Follower#n_gh1    123,{
    mes "[Hugin's Follower]";
    mes "You want to break?";
    mes "Ok, let's get out of here.?";
    next;
    if (select("Ah, wrong click... I mean I was not talk to you","Please let me out from here") == 1) {
        mes "[Hugin's Follower]";
        mes "Alright just tell me whenever you want to leave.";
        close;
    }
    warp "glast_01",210,269;
    end;
}

gl_cas02_,104,36,4    script    Hugin's Follower#n_gh2    123,{
    mes "[Hugin's Follower]";
    mes "You want to break?";
    mes "Ok, let's get out of here.?";
    next;
    if (select("Ah, wrong click... I mean I was not talk to you","Please let me out from here") == 1) {
        mes "[Hugin's Follower]";
        mes "Alright just tell me whenever you want to leave.";
        close;
    }
    warp "glast_01",210,269;
    end;
}

glast_01,206,265,3    script    Resetter    123,{
    erasequest 12317;
    erasequest 12318;
    mes "Everything reset.";
    close;
}

 

Edited by sader1992
use code box not spoiler
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  9
  • Reputation:   2
  • Joined:  01/26/13
  • Last Seen:  

change udt_maxhp and udt_hp to UMOB_MAXHP and UMOB_HP
 
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...