#include <define.h>

//#define NAME                    SCRIPT_

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



procedure start;
#include <push.h>
procedure critter_p_proc;

variable Hostile;
variable Only_Once := 1;


procedure start
begin
	if (Only_Once == 1) then begin
		critter_add_trait(self_obj, TRAIT_OBJECT, OBJECT_TEAM_NUM, 44);
		critter_add_trait(self_obj, TRAIT_OBJECT, OBJECT_AI_PACKET, AI_BROTHERHOOD_PALADIN);
		Only_Once := 0;
	end
	if (script_action == critter_proc) then begin
		call critter_p_proc;
	end
end

procedure critter_p_proc
begin
	if (map_var(18) != 0) then begin
		if (map_var(18) > 2) then begin
			Hostile := 1;
		end
	end
	if (obj_can_see_obj(self_obj, dude_obj)) then begin
		Hostile := 1;
	end
	if (global_var(GVAR_ENEMY_BROTHERHOOD)) then begin
		Hostile := 1;
	end
	if (tile_distance_objs(self_obj, dude_obj) > 12) then begin
		Hostile := 0;
	end
	if (Hostile) then begin
		set_global_var(GVAR_ENEMY_BROTHERHOOD, 1);
		Hostile := 0;
		attack_complex(dude_obj, 0, 1, 0, 0, 30000, 0, 0);
	end
end