So, I'm pretty sure the Smitty problems comes from the first part of his timed event procedure.
What is that assembly stuff doing there?
Anyway, I cleaned up the script so I could compile it (removed op_ and stuff), and replaced the timed events procedure with the following code from the RP:
I have a save that always crashed, but stopped doing that with my altered script. It could be something else that fixed it by accident when changed the op_code stuff, but it seems more likely it's the timed events procedure causing the trouble.
Code:
procedure timed_event_p_proc
begin
variable LVar1 := 8694;
asm_expr(op_fixed_param() == 0);
asm(0x802f);
asm_push_value(0);
asm_expr(op_combat_is_initialized() == 0);
asm(0x802f);
asm_push_value(8926);
asm(0x8004);
if (op_fixed_param() == 1) then
begin
if (op_combat_is_initialized() == 0) then
begin
asm_push_value(0);
asm_expr(((op_local_var(4) bwand 2048) != 0) == 0);
asm(0x802f);
end
op_metarule3(100, op_self_obj(), 1, 0);
op_add_timer_event(op_self_obj(), op_game_ticks(op_random(15, 90)), 1);
end
else if (op_fixed_param() == 11) then
begin
if ((op_local_var(4) bwand 1024) != 0) then
op_set_local_var(4, op_local_var(4) bwor 2);
op_set_local_var(4, op_local_var(4) bwor 2048);
end
end
What is that assembly stuff doing there?
Anyway, I cleaned up the script so I could compile it (removed op_ and stuff), and replaced the timed events procedure with the following code from the RP:
Code:
procedure timed_event_p_proc
begin
if (fixed_param == 0) then begin
if (combat_is_initialized == 0) then begin
end
end
else begin
if (fixed_param == 1) then begin
if (combat_is_initialized == 0) then begin
if (((local_var(4) bwand 2048) != 0) == 0) then begin
end
end
metarule3(100, self_obj, 1, 0);
add_timer_event(self_obj, game_ticks(random(15, 90)), 1);
end
else begin
if (fixed_param == 11) then begin
if ((local_var(4) bwand 1024) != 0) then begin
set_local_var(4, local_var(4) bwor 2);
end
set_local_var(4, local_var(4) bwor 2048);
end
end
end
end