#include <define.h>

//#define NAME                    SCRIPT_

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



procedure start;
#include <push.h>
procedure description_p_proc;
procedure spatial_p_proc;
procedure use_skill_on_p_proc;

variable initialized1;

import variable removal_ptr;


procedure start
begin
	if (not(initialized1)) then begin
		initialized1 := 1;
	end
	else begin
		if (script_action == description_proc) then begin
			call description_p_proc;
		end
		else begin
			if (script_action == spatial_proc) then begin
				call spatial_p_proc;
			end
			else begin
				if (script_action == use_skill_on_proc) then begin
					call use_skill_on_p_proc;
				end
			end
		end
	end
end

procedure description_p_proc
begin
	variable LVar0 := 0;
	LVar0 := message_str(SCRIPT_VATALERT, 100);
	if (not(local_var(0))) then begin
		if (not(is_success(do_check(dude_obj, 1, has_trait(0, dude_obj, 0))))) then begin
			LVar0 := message_str(SCRIPT_VATALERT, 101);
		end
		else begin
			set_local_var(0, 1);
		end
	end
	display_msg(LVar0);
end

procedure spatial_p_proc
begin
	if (map_var(7) == 0) then begin
		if (not(is_success(do_check(dude_obj, 6, 0)))) then begin
			set_global_var(GVAR_VATS_ALERT, 1);
			set_map_var(7, 1);
			display_msg(message_str(SCRIPT_VATALERT, 102));
			move_to(self_obj, 7000, 0);
			removal_ptr := self_obj;
		end
	end
	else begin
		display_msg(message_str(SCRIPT_VATALERT, 103));
	end
end

procedure use_skill_on_p_proc
begin
	if (action_being_used == 11) then begin
		if (local_var(0)) then begin
			script_overrides;
			if (is_success(roll_vs_skill(dude_obj, 11, 0))) then begin
				display_msg(message_str(SCRIPT_VATALERT, 104));
				move_to(self_obj, 7000, 0);
				removal_ptr := self_obj;
				set_map_var(12, 1);
			end
			else begin
				display_msg(message_str(SCRIPT_VATALERT, 105));
			end
		end
	end
end