BGforgeNet/Fallout2_Unofficial_Patch

Killap's crowbar/trap code for locked doors isnt working properly

Question2 opened this issue · 8 comments

Using v18 RPU with sfall v4.2.8.

I noticed that Killap added code to many locked doors to allow you to force them open with a crowbar or trap them with dynamite/plastic explosive, however I also noticed that this doesnt appear to work properly.

For example, when trying to use a crowbar on the locked door in the klamath rat caves leading to the fuel cell regulator, you only get the message "this does nothing". The same happens if you attempt to use dynamite on it.

For reference, this is from KSCVDOOR.ssl :

procedure use_obj_on_p_proc begin
   variable Tool;

   Tool:=obj_pid(obj_being_used_with);


    if (LOCK_STATUS == STATE_STANDARD_LOCK) then begin
       if (Tool == PID_LOCKPICKS) then begin
           script_overrides; //added by killap
           if (local_var(LVAR_Locked) == STATE_ACTIVE) then begin
               call Lockpick_Lock;
           end
           else begin
               call Set_Lockpick_Lock;
           end
       end
       //added by killap
       else if (Tool == PID_EXP_LOCKPICK_SET) then begin
            script_overrides; //added by killap
            if (local_var(LVAR_Locked) == STATE_ACTIVE) then begin
               call Super_Lockpick_Lock;
            end
            else begin
               call Super_Set_Lockpick_Lock;
            end
       end
       //end added by killap
   end

   else if (LOCK_STATUS == STATE_ELECTRIC_LOCK) then begin
       if (Tool == PID_ELECTRONIC_LOCKPICKS) then begin
           script_overrides; //added by killap
           if (local_var(LVAR_Locked) == STATE_ACTIVE) then begin
               call Lockpick_Lock;
           end
           else begin
               call Set_Lockpick_Lock;
           end
       end
       //added by killap
       else if (Tool == PID_ELEC_LOCKPICK_MKII) then begin
           script_overrides; //added by killap
           if (local_var(LVAR_Locked) == STATE_ACTIVE) then begin
               call Super_Lockpick_Lock;
           end
           else begin
               call Super_Set_Lockpick_Lock;
           end
       end
       //end added by killap
   end

   else if (Tool == PID_CROWBAR) then begin
       script_overrides; //added by killap
       call Pry_Door;
   end

   else if ((Tool == PID_DYNAMITE) or (Tool == PID_PLASTIC_EXPLOSIVES)) then begin
       script_overrides; //added by killap
       call Set_Trap;
   end

end

The last two blocks with the crowbar and dynamite never get called at all. I tried moving those two to the top of the procedure and it did work though, i was able to use a crowbar to bust open the lock and i was able to attempt to trap the door with dynamite. For some reason, the dynamite simply dissapeared from my inventory when i failed to set the trap, im not sure if this is intended as it never dissapears when you arm it in your inventory, even if you have very low trap skill. The only way you can fail to arm dynamite is the risk of premature detonation.

So for example changing the procedure to this will allow the crowbar/dynamite code to work :

procedure use_obj_on_p_proc begin
   variable Tool;

   Tool:=obj_pid(obj_being_used_with);

   if (Tool == PID_CROWBAR) then begin
       script_overrides; //added by killap
       call Pry_Door;
   end

   else if ((Tool == PID_DYNAMITE) or (Tool == PID_PLASTIC_EXPLOSIVES)) then begin
       script_overrides; //added by killap
       call Set_Trap;
   end

   else if (LOCK_STATUS == STATE_STANDARD_LOCK) then begin
       if (Tool == PID_LOCKPICKS) then begin
           script_overrides; //added by killap
           if (local_var(LVAR_Locked) == STATE_ACTIVE) then begin
               call Lockpick_Lock;
           end
           else begin
               call Set_Lockpick_Lock;
           end
       end
       //added by killap
       else if (Tool == PID_EXP_LOCKPICK_SET) then begin
            script_overrides; //added by killap
            if (local_var(LVAR_Locked) == STATE_ACTIVE) then begin
               call Super_Lockpick_Lock;
            end
            else begin
               call Super_Set_Lockpick_Lock;
            end
       end
       //end added by killap
   end

   else if (LOCK_STATUS == STATE_ELECTRIC_LOCK) then begin
       if (Tool == PID_ELECTRONIC_LOCKPICKS) then begin
           script_overrides; //added by killap
           if (local_var(LVAR_Locked) == STATE_ACTIVE) then begin
               call Lockpick_Lock;
           end
           else begin
               call Set_Lockpick_Lock;
           end
       end
       //added by killap
       else if (Tool == PID_ELEC_LOCKPICK_MKII) then begin
           script_overrides; //added by killap
           if (local_var(LVAR_Locked) == STATE_ACTIVE) then begin
               call Super_Lockpick_Lock;
           end
           else begin
               call Super_Set_Lockpick_Lock;
           end
       end
       //end added by killap
   end

end

I can still use lockpicks on the door as well.

Save in the rat caves if you want to test it :

SLOT03.zip

This likely calls for larger overhaul and code unification encompassing most/all doors.

Ugh, the doors are such an ugly pile of copy-paste... This is going to a huge undertaking.

phew, this is taxing

OK, this turned out to be quite harder than expected. I've shoved a shit ton (and that is a literal shit) of code. Due to copy paste abuse, the code variations are very similar, but different just enough to make mass replace impossible, and reusage hard. And the scope creeps all the time you work on it. I had to restart from scratch 2 times to keep it under control.

Multiple issues preventing from creating a "perfect" template from scratch, for reference and as a reminder to myself:

  1. Many scripts have customized procedures.
  2. Doors and containers share a lot of similar code. But they don't share the messages.
  3. On top of that, some doors and containers use non-standard message files.
  4. Most doors use LVAR_Locked to remember their locked state. For some reason, ziwoddor doesn't. It checks obj_locked directly. However, in my testing, object locked state doesn't survive map travel. ziwoddor is used as a template for multiple doors. This will need to be tested again and acted upon separately.
    Also, LVAR_Locked is the first LVAR, and removing it will mess up savegames. Not removing will not allow to unify the code.
  5. Re-ordering procedures breaks binary matching for the scripts, and makes it hard to review when there's a lot of changes, which why there's 2 headers: templated procedures go to bottom.

Anyway, here's the current situation:

  1. Doors have 2 headers: doors.h and doors2.h. First one contains pieces of code as defines should be included at the top, second one serves as a template with standard procedures and should be included at the bottom.
  2. Some code between doors and containers headers is the same.
  3. ziwoddor is basically unchanged, serving as a template for several other scripts.
  4. The code is split between doors.h, door2.h, containers.h, containers2.h, ziwoddor.ssl and custom procedures in scripts.

I only consolidated a few procedures for now. Others can be dealt with if and when situation requires. It's still ugly, but in fewer places. Not meant to be perfect, just something to start with.

There's been a lot of commits, so I ran some extra checks in the end. (I spefically avoided optimizing the code, just shuffled it, so that it'd be easier to check. Optimization can come later.)

$ diff -u scripts.0 scripts.3
Binary files scripts.0/containr.int and scripts.3/containr.int differ
Binary files scripts.0/dichcdor.int and scripts.3/dichcdor.int differ
Binary files scripts.0/didoor.int and scripts.3/didoor.int differ
Binary files scripts.0/diflkbox.int and scripts.3/diflkbox.int differ
Binary files scripts.0/dipendor.int and scripts.3/dipendor.int differ
Binary files scripts.0/direbdor.int and scripts.3/direbdor.int differ
Binary files scripts.0/diromdor.int and scripts.3/diromdor.int differ
Binary files scripts.0/divicdor.int and scripts.3/divicdor.int differ
Binary files scripts.0/door.int and scripts.3/door.int differ
Binary files scripts.0/hscrldr.int and scripts.3/hscrldr.int differ
Binary files scripts.0/iilockdr.int and scripts.3/iilockdr.int differ
Binary files scripts.0/kibbox.int and scripts.3/kibbox.int differ
Binary files scripts.0/kidbox.int and scripts.3/kidbox.int differ
Binary files scripts.0/kisbox.int and scripts.3/kisbox.int differ
Binary files scripts.0/midoor.int and scripts.3/midoor.int differ
Binary files scripts.0/nibishdr.int and scripts.3/nibishdr.int differ
Binary files scripts.0/nidoor.int and scripts.3/nidoor.int differ
Binary files scripts.0/nielddor.int and scripts.3/nielddor.int differ
Binary files scripts.0/nimyrdor.int and scripts.3/nimyrdor.int differ
Binary files scripts.0/nisaldor.int and scripts.3/nisaldor.int differ
Binary files scripts.0/niwridor.int and scripts.3/niwridor.int differ
Binary files scripts.0/sidtbl.int and scripts.3/sidtbl.int differ
Binary files scripts.0/simbox.int and scripts.3/simbox.int differ
Binary files scripts.0/siptbox.int and scripts.3/siptbox.int differ
Binary files scripts.0/siptbox2.int and scripts.3/siptbox2.int differ
Binary files scripts.0/vivltdr2.int and scripts.3/vivltdr2.int differ
Binary files scripts.0/ziwoddor.int and scripts.3/ziwoddor.int differ

Decompiled diff indicates only some differences in script_overrides placement, some non-working script_overrides removed, and a silent bug fixed in one container.
Given how much was moved around, I think it's a great result.

@NovaRain, please feel free to review.

diff -u r0/containr.ssl r3/containr.ssl
--- r0/containr.ssl	2021-01-14 01:32:16.827135890 +0700
+++ r3/containr.ssl	2021-01-14 01:32:59.502718688 +0700
@@ -132,8 +132,8 @@
 begin
 	variable LVar0 := 0;
 	LVar0 := obj_pid(obj_being_used_with);
-	script_overrides;
 	if (LVar0 == 84) then begin
+		script_overrides;
 		if (local_var(0) == 0) then begin
 			call Lockpick_Lock();
 		end
diff -u r0/dichcdor.ssl r3/dichcdor.ssl
--- r0/dichcdor.ssl	2021-01-14 01:32:17.115133083 +0700
+++ r3/dichcdor.ssl	2021-01-14 01:32:59.786715903 +0700
@@ -986,15 +986,12 @@
 procedure Damage_Critter
 begin
 	variable LVar0 := 0;
-	script_overrides;
 	LVar0 := random(10, 20);
 	if (source_obj == dude_obj) then begin
-		script_overrides;
 		critter_dmg(dude_obj, LVar0, 262);
 		display_msg(message_str(13, 166) + LVar0 + message_str(13, 167));
 	end
 	else begin
-		script_overrides;
 		critter_dmg(source_obj, LVar0, 262);
 		display_msg(obj_name(source_obj) + message_str(13, 168) + LVar0 + message_str(13, 169));
 	end
diff -u r0/didoor.ssl r3/didoor.ssl
--- r0/didoor.ssl	2021-01-14 01:32:17.391130393 +0700
+++ r3/didoor.ssl	2021-01-14 01:33:00.058713236 +0700
@@ -963,15 +963,12 @@
 procedure Damage_Critter
 begin
 	variable LVar0 := 0;
-	script_overrides;
 	LVar0 := random(10, 20);
 	if (source_obj == dude_obj) then begin
-		script_overrides;
 		critter_dmg(dude_obj, LVar0, 262);
 		display_msg(message_str(13, 166) + LVar0 + message_str(13, 167));
 	end
 	else begin
-		script_overrides;
 		critter_dmg(source_obj, LVar0, 262);
 		display_msg(obj_name(source_obj) + message_str(13, 168) + LVar0 + message_str(13, 169));
 	end
diff -u r0/diflkbox.ssl r3/diflkbox.ssl
--- r0/diflkbox.ssl	2021-01-14 01:32:18.151122986 +0700
+++ r3/diflkbox.ssl	2021-01-14 01:33:00.814705822 +0700
@@ -138,6 +138,7 @@
 	variable LVar0 := 0;
 	LVar0 := obj_pid(obj_being_used_with);
 	if (LVar0 == 84) then begin
+		script_overrides;
 		if (local_var(0) == 0) then begin
 			call Lockpick_Lock();
 		end
@@ -147,6 +148,7 @@
 	end
 	else begin
 		if (LVar0 == 410) then begin
+			script_overrides;
 			if (local_var(0) == 0) then begin
 				call Super_Lockpick_Lock();
 			end
diff -u r0/dipendor.ssl r3/dipendor.ssl
--- r0/dipendor.ssl	2021-01-14 01:32:20.763097521 +0700
+++ r3/dipendor.ssl	2021-01-14 01:33:03.278681651 +0700
@@ -1004,15 +1004,12 @@
 procedure Damage_Critter
 begin
 	variable LVar0 := 0;
-	script_overrides;
 	LVar0 := random(10, 20);
 	if (source_obj == dude_obj) then begin
-		script_overrides;
 		critter_dmg(dude_obj, LVar0, 262);
 		display_msg(message_str(13, 166) + LVar0 + message_str(13, 167));
 	end
 	else begin
-		script_overrides;
 		critter_dmg(source_obj, LVar0, 262);
 		display_msg(obj_name(source_obj) + message_str(13, 168) + LVar0 + message_str(13, 169));
 	end
diff -u r0/direbdor.ssl r3/direbdor.ssl
--- r0/direbdor.ssl	2021-01-14 01:32:21.055094674 +0700
+++ r3/direbdor.ssl	2021-01-14 01:33:03.562678865 +0700
@@ -1069,15 +1069,12 @@
 procedure Damage_Critter
 begin
 	variable LVar0 := 0;
-	script_overrides;
 	LVar0 := random(10, 20);
 	if (source_obj == dude_obj) then begin
-		script_overrides;
 		critter_dmg(dude_obj, LVar0, 262);
 		display_msg(message_str(13, 166) + LVar0 + message_str(13, 167));
 	end
 	else begin
-		script_overrides;
 		critter_dmg(source_obj, LVar0, 262);
 		display_msg(obj_name(source_obj) + message_str(13, 168) + LVar0 + message_str(13, 169));
 	end
diff -u r0/diromdor.ssl r3/diromdor.ssl
--- r0/diromdor.ssl	2021-01-14 01:32:21.343091865 +0700
+++ r3/diromdor.ssl	2021-01-14 01:33:03.838676157 +0700
@@ -1022,15 +1022,12 @@
 procedure Damage_Critter
 begin
 	variable LVar0 := 0;
-	script_overrides;
 	LVar0 := random(10, 20);
 	if (source_obj == dude_obj) then begin
-		script_overrides;
 		critter_dmg(dude_obj, LVar0, 262);
 		display_msg(message_str(13, 166) + LVar0 + message_str(13, 167));
 	end
 	else begin
-		script_overrides;
 		critter_dmg(source_obj, LVar0, 262);
 		display_msg(obj_name(source_obj) + message_str(13, 168) + LVar0 + message_str(13, 169));
 	end
diff -u r0/divicdor.ssl r3/divicdor.ssl
--- r0/divicdor.ssl	2021-01-14 01:32:21.619089173 +0700
+++ r3/divicdor.ssl	2021-01-14 01:33:04.122673370 +0700
@@ -938,15 +938,12 @@
 procedure Damage_Critter
 begin
 	variable LVar0 := 0;
-	script_overrides;
 	LVar0 := random(10, 20);
 	if (source_obj == dude_obj) then begin
-		script_overrides;
 		critter_dmg(dude_obj, LVar0, 262);
 		display_msg(message_str(13, 166) + LVar0 + message_str(13, 167));
 	end
 	else begin
-		script_overrides;
 		critter_dmg(source_obj, LVar0, 262);
 		display_msg(obj_name(source_obj) + message_str(13, 168) + LVar0 + message_str(13, 169));
 	end
diff -u r0/door.ssl r3/door.ssl
--- r0/door.ssl	2021-01-14 01:32:21.895086482 +0700
+++ r3/door.ssl	2021-01-14 01:33:04.398670662 +0700
@@ -971,15 +971,12 @@
 procedure Damage_Critter
 begin
 	variable LVar0 := 0;
-	script_overrides;
 	LVar0 := random(10, 20);
 	if (source_obj == dude_obj) then begin
-		script_overrides;
 		critter_dmg(dude_obj, LVar0, 262);
 		display_msg(message_str(13, 166) + LVar0 + message_str(13, 167));
 	end
 	else begin
-		script_overrides;
 		critter_dmg(source_obj, LVar0, 262);
 		display_msg(obj_name(source_obj) + message_str(13, 168) + LVar0 + message_str(13, 169));
 	end
diff -u r0/hscrldr.ssl r3/hscrldr.ssl
--- r0/hscrldr.ssl	2021-01-14 01:32:24.495061120 +0700
+++ r3/hscrldr.ssl	2021-01-14 01:33:07.158643574 +0700
@@ -178,12 +178,11 @@
 		end
 		else begin
 			if (LVar0 == 84) then begin
+				script_overrides;
 				if (local_var(0) == 0) then begin
-					script_overrides;
 					call Lockpick_Lock();
 				end
 				else begin
-					script_overrides;
 					call Set_Lockpick_Lock();
 				end
 			end
diff -u r0/iilockdr.ssl r3/iilockdr.ssl
--- r0/iilockdr.ssl	2021-01-14 01:32:24.755058583 +0700
+++ r3/iilockdr.ssl	2021-01-14 01:33:07.418641021 +0700
@@ -238,23 +238,21 @@
 	variable LVar0 := 0;
 	LVar0 := obj_pid(obj_being_used_with);
 	if (LVar0 == 84) then begin
+		script_overrides;
 		if (local_var(0) == 0) then begin
-			script_overrides;
 			call Lockpick_Lock();
 		end
 		else begin
-			script_overrides;
 			call Set_Lockpick_Lock();
 		end
 	end
 	else begin
 		if (LVar0 == 410) then begin
+			script_overrides;
 			if (local_var(0) == 0) then begin
-				script_overrides;
 				call Super_Lockpick_Lock();
 			end
 			else begin
-				script_overrides;
 				call Super_Set_Lockpick_Lock();
 			end
 		end
diff -u r0/kibbox.ssl r3/kibbox.ssl
--- r0/kibbox.ssl	2021-01-14 01:32:26.163044844 +0700
+++ r3/kibbox.ssl	2021-01-14 01:33:08.838627080 +0700
@@ -138,6 +138,7 @@
 	variable LVar0 := 0;
 	LVar0 := obj_pid(obj_being_used_with);
 	if (LVar0 == 84) then begin
+		script_overrides;
 		if (local_var(0) == 0) then begin
 			call Lockpick_Lock();
 		end
@@ -147,6 +148,7 @@
 	end
 	else begin
 		if (LVar0 == 410) then begin
+			script_overrides;
 			if (local_var(0) == 0) then begin
 				call Super_Lockpick_Lock();
 			end
diff -u r0/kidbox.ssl r3/kidbox.ssl
--- r0/kidbox.ssl	2021-01-14 01:32:28.763019466 +0700
+++ r3/kidbox.ssl	2021-01-14 01:33:11.922596793 +0700
@@ -138,6 +138,7 @@
 	variable LVar0 := 0;
 	LVar0 := obj_pid(obj_being_used_with);
 	if (LVar0 == 84) then begin
+		script_overrides;
 		if (local_var(0) == 0) then begin
 			call Lockpick_Lock();
 		end
@@ -147,6 +148,7 @@
 	end
 	else begin
 		if (LVar0 == 410) then begin
+			script_overrides;
 			if (local_var(0) == 0) then begin
 				call Super_Lockpick_Lock();
 			end
diff -u r0/kisbox.ssl r3/kisbox.ssl
--- r0/kisbox.ssl	2021-01-14 01:32:29.811009234 +0700
+++ r3/kisbox.ssl	2021-01-14 01:33:13.022585988 +0700
@@ -138,6 +138,7 @@
 	variable LVar0 := 0;
 	LVar0 := obj_pid(obj_being_used_with);
 	if (LVar0 == 84) then begin
+		script_overrides;
 		if (local_var(0) == 0) then begin
 			call Lockpick_Lock();
 		end
@@ -147,6 +148,7 @@
 	end
 	else begin
 		if (LVar0 == 410) then begin
+			script_overrides;
 			if (local_var(0) == 0) then begin
 				call Super_Lockpick_Lock();
 			end
diff -u r0/midoor.ssl r3/midoor.ssl
--- r0/midoor.ssl	2021-01-14 01:32:32.402983920 +0700
+++ r3/midoor.ssl	2021-01-14 01:33:15.878557924 +0700
@@ -332,6 +332,7 @@
 	if (LVar0 != -1) then begin
 		LVar0 := obj_pid(obj_being_used_with);
 		if (LVar0 == 84) then begin
+			script_overrides;
 			if (local_var(0) == 0) then begin
 				call Lockpick_Lock();
 			end
@@ -341,6 +342,7 @@
 		end
 		else begin
 			if (LVar0 == 410) then begin
+				script_overrides;
 				if (local_var(0) == 0) then begin
 					call Super_Lockpick_Lock();
 				end
diff -u r0/nibishdr.ssl r3/nibishdr.ssl
--- r0/nibishdr.ssl	2021-01-14 01:32:32.678981224 +0700
+++ r3/nibishdr.ssl	2021-01-14 01:33:16.166555094 +0700
@@ -1015,15 +1015,12 @@
 procedure Damage_Critter
 begin
 	variable LVar0 := 0;
-	script_overrides;
 	LVar0 := random(10, 20);
 	if (source_obj == dude_obj) then begin
-		script_overrides;
 		critter_dmg(dude_obj, LVar0, 262);
 		display_msg(message_str(13, 166) + LVar0 + message_str(13, 167));
 	end
 	else begin
-		script_overrides;
 		critter_dmg(source_obj, LVar0, 262);
 		display_msg(obj_name(source_obj) + message_str(13, 168) + LVar0 + message_str(13, 169));
 	end
diff -u r0/nidoor.ssl r3/nidoor.ssl
--- r0/nidoor.ssl	2021-01-14 01:32:32.946978606 +0700
+++ r3/nidoor.ssl	2021-01-14 01:33:16.466552145 +0700
@@ -963,15 +963,12 @@
 procedure Damage_Critter
 begin
 	variable LVar0 := 0;
-	script_overrides;
 	LVar0 := random(10, 20);
 	if (source_obj == dude_obj) then begin
-		script_overrides;
 		critter_dmg(dude_obj, LVar0, 262);
 		display_msg(message_str(13, 166) + LVar0 + message_str(13, 167));
 	end
 	else begin
-		script_overrides;
 		critter_dmg(source_obj, LVar0, 262);
 		display_msg(obj_name(source_obj) + message_str(13, 168) + LVar0 + message_str(13, 169));
 	end
diff -u r0/nielddor.ssl r3/nielddor.ssl
--- r0/nielddor.ssl	2021-01-14 01:32:33.166976457 +0700
+++ r3/nielddor.ssl	2021-01-14 01:33:16.750549354 +0700
@@ -393,15 +393,12 @@
 procedure Damage_Critter
 begin
 	variable LVar0 := 0;
-	script_overrides;
 	LVar0 := random(10, 20);
 	if (source_obj == dude_obj) then begin
-		script_overrides;
 		critter_dmg(dude_obj, LVar0, 262);
 		display_msg(message_str(13, 166) + LVar0 + message_str(13, 167));
 	end
 	else begin
-		script_overrides;
 		critter_dmg(source_obj, LVar0, 262);
 		display_msg(obj_name(source_obj) + message_str(13, 168) + LVar0 + message_str(13, 169));
 	end
diff -u r0/nimyrdor.ssl r3/nimyrdor.ssl
--- r0/nimyrdor.ssl	2021-01-14 01:32:33.378974386 +0700
+++ r3/nimyrdor.ssl	2021-01-14 01:33:17.030546602 +0700
@@ -480,15 +480,12 @@
 procedure Damage_Critter
 begin
 	variable LVar0 := 0;
-	script_overrides;
 	LVar0 := random(10, 20);
 	if (source_obj == dude_obj) then begin
-		script_overrides;
 		critter_dmg(dude_obj, LVar0, 262);
 		display_msg(message_str(13, 166) + LVar0 + message_str(13, 167));
 	end
 	else begin
-		script_overrides;
 		critter_dmg(source_obj, LVar0, 262);
 		display_msg(obj_name(source_obj) + message_str(13, 168) + LVar0 + message_str(13, 169));
 	end
diff -u r0/nisaldor.ssl r3/nisaldor.ssl
--- r0/nisaldor.ssl	2021-01-14 01:32:35.982948942 +0700
+++ r3/nisaldor.ssl	2021-01-14 01:33:22.298494801 +0700
@@ -1015,15 +1015,12 @@
 procedure Damage_Critter
 begin
 	variable LVar0 := 0;
-	script_overrides;
 	LVar0 := random(10, 20);
 	if (source_obj == dude_obj) then begin
-		script_overrides;
 		critter_dmg(dude_obj, LVar0, 262);
 		display_msg(message_str(13, 166) + LVar0 + message_str(13, 167));
 	end
 	else begin
-		script_overrides;
 		critter_dmg(source_obj, LVar0, 262);
 		display_msg(obj_name(source_obj) + message_str(13, 168) + LVar0 + message_str(13, 169));
 	end
diff -u r0/niwridor.ssl r3/niwridor.ssl
--- r0/niwridor.ssl	2021-01-14 01:32:36.274946088 +0700
+++ r3/niwridor.ssl	2021-01-14 01:33:22.594491890 +0700
@@ -1028,15 +1028,12 @@
 procedure Damage_Critter
 begin
 	variable LVar0 := 0;
-	script_overrides;
 	LVar0 := random(10, 20);
 	if (source_obj == dude_obj) then begin
-		script_overrides;
 		critter_dmg(dude_obj, LVar0, 262);
 		display_msg(message_str(13, 166) + LVar0 + message_str(13, 167));
 	end
 	else begin
-		script_overrides;
 		critter_dmg(source_obj, LVar0, 262);
 		display_msg(obj_name(source_obj) + message_str(13, 168) + LVar0 + message_str(13, 169));
 	end
diff -u r0/sidtbl.ssl r3/sidtbl.ssl
--- r0/sidtbl.ssl	2021-01-14 01:32:41.694893094 +0700
+++ r3/sidtbl.ssl	2021-01-14 01:33:28.262436114 +0700
@@ -128,8 +128,8 @@
 begin
 	variable LVar0 := 0;
 	LVar0 := obj_pid(obj_being_used_with);
-	script_overrides;
 	if (LVar0 == 84) then begin
+		script_overrides;
 		if (local_var(0) == 0) then begin
 			call Lockpick_Lock();
 		end
diff -u r0/simbox.ssl r3/simbox.ssl
--- r0/simbox.ssl	2021-01-14 01:32:44.214868441 +0700
+++ r3/simbox.ssl	2021-01-14 01:33:31.074408427 +0700
@@ -138,6 +138,7 @@
 	variable LVar0 := 0;
 	LVar0 := obj_pid(obj_being_used_with);
 	if (LVar0 == 84) then begin
+		script_overrides;
 		if (local_var(0) == 0) then begin
 			call Lockpick_Lock();
 		end
@@ -147,6 +148,7 @@
 	end
 	else begin
 		if (LVar0 == 410) then begin
+			script_overrides;
 			if (local_var(0) == 0) then begin
 				call Super_Lockpick_Lock();
 			end
diff -u r0/siptbox2.ssl r3/siptbox2.ssl
--- r0/siptbox2.ssl	2021-01-14 01:32:44.474865897 +0700
+++ r3/siptbox2.ssl	2021-01-14 01:33:31.334405866 +0700
@@ -26,6 +26,9 @@
 variable Locks_Roll;
 variable Traps_Roll;
 
+procedure Super_Lockpick_Lock;
+procedure Super_Set_Lockpick_Lock;
+
 
 procedure start
 begin
@@ -131,6 +134,7 @@
 	variable LVar0 := 0;
 	LVar0 := obj_pid(obj_being_used_with);
 	if (LVar0 == 84) then begin
+		script_overrides;
 		if (local_var(0) == 0) then begin
 			call Lockpick_Lock();
 		end
@@ -138,6 +142,17 @@
 			call Set_Lockpick_Lock();
 		end
 	end
+	else begin
+		if (LVar0 == 410) then begin
+			script_overrides;
+			if (local_var(0) == 0) then begin
+				call Super_Lockpick_Lock();
+			end
+			else begin
+				call Super_Set_Lockpick_Lock();
+			end
+		end
+	end
 end
 
 procedure damage_p_proc
@@ -838,3 +853,15 @@
 	set_local_var(1, 1);
 end
 
+procedure Super_Lockpick_Lock
+begin
+	Locks_Roll := roll_vs_skill(source_obj, 9, 20);
+	call Lockpick_Door();
+end
+
+procedure Super_Set_Lockpick_Lock
+begin
+	Locks_Roll := roll_vs_skill(source_obj, 9, 20);
+	call Lock_Door();
+end
+
diff -u r0/siptbox.ssl r3/siptbox.ssl
--- r0/siptbox.ssl	2021-01-14 01:32:44.738863313 +0700
+++ r3/siptbox.ssl	2021-01-14 01:33:31.606403188 +0700
@@ -133,6 +133,7 @@
 	variable LVar0 := 0;
 	LVar0 := obj_pid(obj_being_used_with);
 	if (LVar0 == 84) then begin
+		script_overrides;
 		if (local_var(0) == 0) then begin
 			call Lockpick_Lock();
 		end
@@ -142,6 +143,7 @@
 	end
 	else begin
 		if (LVar0 == 410) then begin
+			script_overrides;
 			if (local_var(0) == 0) then begin
 				call Super_Lockpick_Lock();
 			end
diff -u r0/vivltdr2.ssl r3/vivltdr2.ssl
--- r0/vivltdr2.ssl	2021-01-14 01:32:45.014860613 +0700
+++ r3/vivltdr2.ssl	2021-01-14 01:33:31.922400076 +0700
@@ -239,23 +239,21 @@
 	variable LVar0 := 0;
 	LVar0 := obj_pid(obj_being_used_with);
 	if (LVar0 == 77) then begin
+		script_overrides;
 		if (local_var(0) == 0) then begin
-			script_overrides;
 			call Lockpick_Lock();
 		end
 		else begin
-			script_overrides;
 			call Set_Lockpick_Lock();
 		end
 	end
 	else begin
 		if (LVar0 == 411) then begin
+			script_overrides;
 			if (local_var(0) == 0) then begin
-				script_overrides;
 				call Super_Lockpick_Lock();
 			end
 			else begin
-				script_overrides;
 				call Super_Set_Lockpick_Lock();
 			end
 		end
diff -u r0/ziwoddor.ssl r3/ziwoddor.ssl
--- r0/ziwoddor.ssl	2021-01-14 01:32:45.286857951 +0700
+++ r3/ziwoddor.ssl	2021-01-14 01:33:32.198397357 +0700
@@ -963,15 +963,12 @@
 procedure Damage_Critter
 begin
 	variable LVar0 := 0;
-	script_overrides;
 	LVar0 := random(10, 20);
 	if (source_obj == dude_obj) then begin
-		script_overrides;
 		critter_dmg(dude_obj, LVar0, 262);
 		display_msg(message_str(13, 166) + LVar0 + message_str(13, 167));
 	end
 	else begin
-		script_overrides;
 		critter_dmg(source_obj, LVar0, 262);
 		display_msg(obj_name(source_obj) + message_str(13, 168) + LVar0 + message_str(13, 169));
 	end

With this, we're down from 51 to 18 invocations of Pry_Door, which can probably be reduced further while working on the actual reported bug.

almost there... last things I want to add is actual explosion graphics on setting of a trap and maybe let prying to set them off as well.

wanted to add magic hands animations on trapping the door, but it doesn't work great ref rotators/Fo1in2#70