summaryrefslogblamecommitdiff
path: root/npc/021-1/logic.txt
blob: 7908ad31f97e53e3a9b6cf954dc2ab2b6396413b (plain) (tree)
1
2
3
4
5
6
7




                         
                                                                                      
 















                                                                        
           


                                                           
                                 
                     

                                                                          

                                     




                                                                             



                                                                
 







                                                                                                                 
 















































                                                                                         
 
// TMW2 scripts.
// Authors:
//    The Mana World Team
//    Jesusalva
// Description:
//    Cave logic. Controls also switchs and false warps. See soren/main for more info.

// Logic
function	script	CindySwitch_Check_211	{
    .@st1=getvariableofnpc(.lifetime, "#CindySwitch_01")-gettimetick(2);
    .@st2=getvariableofnpc(.lifetime, "#CindySwitch_02")-gettimetick(2);
    .@st3=getvariableofnpc(.lifetime, "#CindySwitch_03")-gettimetick(2);
    .@st4=getvariableofnpc(.lifetime, "#CindySwitch_04")-gettimetick(2);
    .@st5=getvariableofnpc(.lifetime, "#CindySwitch_05")-gettimetick(2);
    .@i=0;
    if (.@st1 > 0) .@i++;
    if (.@st2 > 0) .@i++;
    if (.@st3 > 0) .@i++;
    if (.@st4 > 0) .@i++;
    if (.@st5 > 0) .@i++;
    return .@i;
}

// Passages
021-1,155,196,0	script	#MainCindyLogic	NPC_NO_SPRITE,0,0,{
    end;
OnTouch:
    .@q=getq(NivalisQuest_Cindy);
    if (.@q < 3) end;
    if ($@CINDY_STATE > gettimetick(2) || $@CINDY_STATE == 0) goto L_Safe;
    if ($@CINDY_STATE % 2 == 0) goto L_Blocked;
    if (CindySwitch_Check_211() == 5)
        warp "021-2", 80, 102;
    end;

L_Blocked:
    dispbottom l("This place is reeking blood. We better come again later.");
    end;

L_Safe:
    dispbottom l("There's no reason to enter these caves now.");
    end;
}

021-1,136,29,0	script	#FrostiaGateway	NPC_NO_SPRITE,0,0,{
    end;
OnTouch:
    npctalkonce l("You need to be using a @@ because extremely cold temperatures.", getitemlink(RedknightArmor));
    end;

}

// Switches
021-1,282,34,0	script	#CindySwitch_01	NPC_SWITCH_OFFLINE,{
    .@q=getq(NivalisQuest_Cindy);
    if (.@q < 3) {
        mesn strcharinfo(0);
        mesq l("This is a strange switch...");
        close;
    }
    if (.lifetime-gettimetick(2) <= 0) {
        mesc l("Insert a key and pull the switch?");
        select
            rif(countitem(TreasureKey), l("Pull it")),
            l("Leave it");
        if (@menu == 1) {
            delitem TreasureKey, 1;
            getexp rand(55, 110), rand(5, 11);
            .lifetime=gettimetick(2)+rand(110, 150); // Something between 1m50s and 2m30s
            specialeffect(27);
            setnpcdisplay .name$, NPC_SWITCH_ONLINE;
            initnpctimer;
            closedialog;
        }
        close;
    }
    npctalk l("Automatic disarm in: @@", FuzzyTime(.lifetime));
    end;

OnTimer1000:
    if (.lifetime-gettimetick(2) <= 0) {
        setnpcdisplay .name$, NPC_SWITCH_OFFLINE;
        stopnpctimer;
    } else {
        initnpctimer;
    }
    end;

OnInit:
    .sex = G_OTHER;
    .distance = 3;
    .lifetime=0;  // When will this switch turn off automatically
    end;

}

021-1,231,36,0	duplicate(#CindySwitch_01)	#CindySwitch_02	NPC_SWITCH_OFFLINE
021-1,34,29,0	duplicate(#CindySwitch_01)	#CindySwitch_03	NPC_SWITCH_OFFLINE
021-1,25,297,0	duplicate(#CindySwitch_01)	#CindySwitch_04	NPC_SWITCH_OFFLINE
021-1,30,168,0	duplicate(#CindySwitch_01)	#CindySwitch_05	NPC_SWITCH_OFFLINE