#include <define.h>

//#define NAME                    SCRIPT_

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



procedure start;
#include <push.h>
procedure map_enter_p_proc;
procedure map_update_p_proc;

import variable field3a_Ptr;


procedure start
begin
	if (script_action == map_enter_proc) then begin
		call map_enter_p_proc;
	end
	else begin
		if (script_action == map_update_proc) then begin
			call map_update_p_proc;
		end
	end
end

procedure map_enter_p_proc
begin
	field3a_Ptr := self_obj;
	if (global_var(GVAR_VATS_ALERT) == 1) then begin
		set_obj_visibility(self_obj, 0);
		set_global_var(GVAR_WATER_CHIP_5, 1);
		set_map_var(18, 1);
	end
	if ((global_var(GVAR_WATER_CHIP_5) == 0) or (map_var(18) == 0)) then begin
		set_obj_visibility(self_obj, 1);
	end
end

procedure map_update_p_proc
begin
	field3a_Ptr := self_obj;
	if ((global_var(GVAR_WATER_CHIP_5) == 0) or (map_var(18) == 0)) then begin
		set_obj_visibility(self_obj, 1);
	end
	else begin
		if (global_var(GVAR_VATS_ALERT) == 1) then begin
			set_obj_visibility(self_obj, 0);
			set_global_var(GVAR_WATER_CHIP_5, 1);
			set_map_var(18, 1);
		end
	end
end