#include <define.h>

//#define NAME                    SCRIPT_

#include <command.h>
//#include <ModReact.h>



procedure start;
#include <push.h>
procedure damage_p_proc;
procedure timed_event_p_proc;
procedure use_p_proc;

variable timer_set;


procedure start
begin
	if (script_action == damage_proc) then begin
		call damage_p_proc;
	end
	else begin
		if (script_action == timed_event_proc) then begin
			call timed_event_p_proc;
		end
		else begin
			if (script_action == use_proc) then begin
				call use_p_proc;
			end
		end
	end
end

procedure damage_p_proc
begin
	if ((cur_map_index == MAP_BROHD12) or (cur_map_index == MAP_BROHD34)) then begin
		set_global_var(GVAR_ENEMY_BROTHERHOOD, 1);
	end
	set_local_var(0, local_var(0) + 1);
	if (local_var(0) == 3) then begin
		destroy_object(self_obj);
	end
end

procedure timed_event_p_proc
begin
	if (fixed_param == 1) then begin
		if (obj_is_open(self_obj)) then begin
			use_obj(self_obj);
		end
	end
end

procedure use_p_proc
begin
	if ((cur_map_index == MAP_VAULT13) or (cur_map_index == MAP_BROHD12) or (cur_map_index == MAP_BROHD34)) then begin
		rm_timer_event(self_obj);
		add_timer_event(self_obj, game_ticks(3), 1);
	end
end