summaryrefslogblamecommitdiff
path: root/npc/042-3/jail.txt
blob: 7e3a1f5b92f0c98ea90cbccdb189d0c37b7ba6e0 (plain) (tree)
1
2
3
4
5
6
7
8
9




               



                                                                          




                                                    
                                                      

                   

                                    
                     
                                                                                            
                                                        
                                         
            
     



                           












                                                                                     
                                 







                                             
                                                               
                                                              


                                                       
                                    

                                    
                                                                                            
                                                        
                                         

           

 
             
                                                       


                            
               
                



                       










                                                                             

 

 
// TMW 2 Script
// Author:
//  Jesusalva
//  Micksha
// Description:
//  Controls jails and lockpicks
// TODO: Spawn slime as players are warped, so they always have the chance
// TODO: Stationary guards outside the cells (can be spawn with player)
// We can set their speed to nil, after all. Make them all archers :3

042-3,0,0,0	script	#KSlimeSpawn	NPC_HIDDEN,{
    end;

OnKillSlime:
    .@label$=instance_npcname(.name$)+"::OnKillSlime";
    if (@lockpicks)
        end;
    if (rand2(10000) > 1000) {
        getmapxy(.@m$, .@x, .@y, 0);
        sleep2(1800);
        .@mob=monster(.@m$, .@x, .@y, strmobinfo(1, CopperSlime), CopperSlime, 1, .@label$);
        // This should wipe the monster experience value
        setunitdata(.@mob, UDT_LEVEL, 1);
        end;
    }
    @lockpicks=true;
    getitem Lockpicks, 1;
    getitem TreasureKey, 1;
    end;

}

// Lockpicks functions
function	script	KamelotLockpick	{
    // Args: x, y. Needs player attached
    .@x=getarg(0);
    .@y=getarg(1);
    mes l("A complex lock seems to be posing a threat to you.");
    next;
    mes l("But thanks to your %s skills, maybe you can pry this open.", thiefrank());
    next;

    .@s=LockPicking(5, 3, false);

    // You broke free!
    if (.@s) {
        dispbottom l("You're finally free!");
        slide .@x, .@y+1;
        @lockpicks=true;
        return;
    }
    mes l("What's this dark magic, the password has changed!");
    .@label$=instance_npcname("#KSlimeSpawn")+"::OnKillSlime";

    // Give player a easy way to get lockpicks for this
    // (Overrides original .@x/.@y variables)
    if (countitem(Lockpicks) <= 1) {
        @lockpicks=false;
        getmapxy(.@m$, .@x, .@y, 0);
        .@mob=monster(.@m$, .@x, .@y, strmobinfo(1, CopperSlime), CopperSlime, 1, .@label$);
        // This should wipe the monster experience value
        setunitdata(.@mob, UDT_LEVEL, 1);
    }
    return;
}

// Cell Doors
042-3,33,137,0	script	Cell Door#K01	NPC_NO_SPRITE,{
    KamelotLockpick(.x, .y);
    close;
OnInit:
OnInstanceInit:
    .distance=2;
    end;
}

// Duplication of doors
042-3,84,129,0	duplicate(Cell Door#K01)	Cell Door#K02	NPC_NO_SPRITE
042-3,41,121,0	duplicate(Cell Door#K01)	Cell Door#K03	NPC_NO_SPRITE
042-3,74,109,0	duplicate(Cell Door#K01)	Cell Door#K04	NPC_NO_SPRITE
042-3,36,98,0	duplicate(Cell Door#K01)	Cell Door#K05	NPC_NO_SPRITE
042-3,57,86,0	duplicate(Cell Door#K01)	Cell Door#K06	NPC_NO_SPRITE
042-3,79,65,0	duplicate(Cell Door#K01)	Cell Door#K07	NPC_NO_SPRITE
042-3,43,69,0	duplicate(Cell Door#K01)	Cell Door#K08	NPC_NO_SPRITE
042-3,24,69,0	duplicate(Cell Door#K01)	Cell Door#K09	NPC_NO_SPRITE
042-3,86,24,0	duplicate(Cell Door#K01)	Cell Door#K10	NPC_NO_SPRITE
042-3,59,51,0	duplicate(Cell Door#K01)	Cell Door#K11	NPC_NO_SPRITE
042-3,38,29,0	duplicate(Cell Door#K01)	Cell Door#K12	NPC_NO_SPRITE