summaryrefslogblamecommitdiff
path: root/npc/003-0/mainquest.txt
blob: 1b1c79ed196d268bdae0e239f1f67811f261dde7 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12











                                                        

















                                                                   










                                              
                                                             



                                     
                                                                                             
                                        



                                                                     
                                                             


                                                                      





                                    
                                      
                                                             



                                                                      




                      

               







                                                    



                                                                               
                                                                      
                                                 



















                                                                           
        

 
// TMW2 scripts.
// Authors:
//    Jesusalva
// Description:
//    Main Quest

003-0,49,35,0	script	#MQ25Trigger	NPC_HIDDEN,3,0,{
    end;

OnTouch:
    .@m$=getmap();
    .@n$=instance_npcname(.name$);
    if (is_night())
        doevent instance_npcname(.name$)+"::OnBegin";
    else
        addtimer 1000, instance_npcname(.name$)+"::OnCheck";
    end;

// Checks if you are in designated ambush zone. If not, keep hidden
OnCheck:
    .@m$=getmap();
    .@n$=instance_npcname(.name$);
    if (!isin(.@m$, 44, 24, 54, 34))
        end;
    // goto OnBegin;

// Begin
OnBegin:
    .@m$=getmap();
    .@n$=instance_npcname(.name$);

    // Is assassin ambushing you or professor?
    if (is_night()) {
        .@x=any(46, 52);
        .@y=34;
    } else {
        getmapxy(.@m$, .@x, .@y, 0);
        .@y-=3;
        if (.@y < 34)
            .@y=34;
    }
    setcells .@m$, 47, 35, 51, 35, 3, "MQ2Wall"+getcharid(0);
    if (isin(.@m$, 44, 24, 54, 34)) {
        warp .@m$, 49, 33;
        atcommand("@refresh");
    }
    @ASSASSIN=monster(.@m$, .@x, .@y, l("Assassin"), Assassin, 1, .@n$+"::OnAssassinDefeat");
    unittalk(@ASSASSIN, l("Die now!!"));
    // TODO: unitwalk
    // TODO: Energy Balls. Should they spawn at (21,31) and (69,31)?
    // At this time they are utterly deadly. You could use a skill to
    // disable them... Perhaps... A grenade?
    dispbottom col(l("SCRIPT ERROR (%s/%s)", .@m$, .@n$), 1);
    dispbottom l("An error happened: unitwalk failed");
    dispbottom l("An error happened: Unable to initialize timer");
    dispbottom l("An error happened: Unable to spawn: 'Energy Ball'");
    end;

OnAssassinDefeat:
    .@m$=getmap();
    .@n$=instance_npcname(.name$);
    delcells "MQ2Wall"+getcharid(0);
    LUA_ASKED_TO_SAVE_PROFESSOR=false;
    dispbottom col(l("SCRIPT ERROR (%s/%s)", .@m$, .@n$), 1);
    if (is_night())
        dispbottom l("An error happened: professor_thankyou() error");
    else
        dispbottom l("An error happened: mission_well_done() error");
    end;

OnInit:
    disablenpc .name$;
    end;

OnInstanceInit:
    if (is_night()) {
        .@n$=instance_npcname("Professor#003-0");
        enablenpc .@n$;
    }
    end;
}

003-0,49,24,4	script	Professor#003-0	NPC_PLAYER,{
    npctalkonce l("I wonder if it'll take too long for the ship to arrive...");
    end;

OnTouchNPC:
    npctalk l("An error happened: professor_was_assasinated() error");
    npctalk ("SCRIPT ERROR (OnTouch Game Over)");
    end;

OnInit:
    .@ini=true;
OnInstanceInit:
    if (.@ini)
        .@npcId = getnpcid(.name$);
    else
        .@npcId = getnpcid(instance_npcname(.name$));

    setunitdata(.@npcId, UDT_HEADTOP, GraduationCap);
    setunitdata(.@npcId, UDT_HEADMIDDLE, GraduationRobe); // TODO: Bathrobe
    setunitdata(.@npcId, UDT_HEADBOTTOM, Slippers); // Hey hey!
    setunitdata(.@npcId, UDT_WEAPON, CottonGloves);
    setunitdata(.@npcId, UDT_HAIRSTYLE, 2);
    setunitdata(.@npcId, UDT_HAIRCOLOR, 4);

    .sex=G_MALE;
    .distance=5;
    disablenpc .name$;
    end;
}