summaryrefslogtreecommitdiff
path: root/npc/021-1/logic.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/021-1/logic.txt')
-rw-r--r--npc/021-1/logic.txt70
1 files changed, 67 insertions, 3 deletions
diff --git a/npc/021-1/logic.txt b/npc/021-1/logic.txt
index fe2567bd6..7908ad31f 100644
--- a/npc/021-1/logic.txt
+++ b/npc/021-1/logic.txt
@@ -5,15 +5,32 @@
// 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 < 4) end;
+ if (.@q < 3) end;
if ($@CINDY_STATE > gettimetick(2) || $@CINDY_STATE == 0) goto L_Safe;
if ($@CINDY_STATE % 2 == 0) goto L_Blocked;
- warp "021-2", 80, 102;
+ if (CindySwitch_Check_211() == 5)
+ warp "021-2", 80, 102;
end;
L_Blocked:
@@ -33,5 +50,52 @@ OnTouch:
}
-// Other
+// 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