#include <define.h>

//#define NAME                    SCRIPT_

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



procedure start;
#include <push.h>
procedure critter_p_proc;
procedure description_p_proc;
procedure destroy_p_proc;
procedure look_at_p_proc;
procedure map_enter_p_proc;
procedure pickup_p_proc;
procedure talk_p_proc;
procedure timed_event_p_proc;
procedure use_obj_on_p_proc;
procedure join_party;
procedure hire_Ian;
procedure Ian01;
procedure Ian02;
procedure Ian03;
procedure Ian04;
procedure Ian05;
procedure Ian06;
procedure Ian07;
procedure Ian08;
procedure Ian09;
procedure Ian10;
procedure Ian11;
procedure Ian12;
procedure Ian12a;
procedure Ian13;
procedure Ian14;
procedure Ian15;
procedure Ian16;
procedure Ian17;
procedure Ian17a;
procedure Ian18;
procedure Ian19;
procedure Ian20;
procedure Ian21;
procedure follow_player;
procedure map_commentary;
procedure IanEnd;
procedure IanCombat;
procedure IanTactics;
procedure IanClose;
procedure IanModerate;
procedure IanFar;
procedure IanChange;

variable hostile1;
variable item;
variable unwield_flag;
variable line151flag;
variable line152flag;
variable line153flag;
variable line154flag;
variable line155flag;
variable line162flag;
variable line163flag;
variable line164flag;
variable line165flag;
variable line166flag;
variable line167flag;
variable line170flag;
variable line172flag;
variable dest_tile1 := 7000;
variable prev_tile := 7000;

import variable Katja_ptr;

procedure Get_Reaction;
procedure React_To_Level;
procedure Level_To_React;
procedure Up_React;
procedure Down_React;
procedure Bottom_React;
procedure Top_React;
procedure Big_Up_React;
procedure Big_Down_React;
procedure Up_React_Level;
procedure Down_React_Level;
procedure Goodbyes;

variable exit_line;


procedure start
begin
	if (script_action == critter_proc) then begin
		call critter_p_proc;
	end
	else begin
		if (script_action == description_proc) then begin
			call description_p_proc;
		end
		else begin
			if (script_action == destroy_proc) then begin
				call destroy_p_proc;
			end
			else begin
				if (script_action == look_at_proc) then begin
					call look_at_p_proc;
				end
				else begin
					if (script_action == map_enter_proc) then begin
						call map_enter_p_proc;
					end
					else begin
						if (script_action == pickup_proc) then begin
							call pickup_p_proc;
						end
						else begin
							if (script_action == talk_proc) then begin
								call talk_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_obj_on_proc) then begin
										call use_obj_on_p_proc;
									end
								end
							end
						end
					end
				end
			end
		end
	end
end

procedure critter_p_proc
begin
	if (hostile1) then begin
		hostile1 := 0;
		attack_complex(dude_obj, 0, 1, 0, 0, 30000, 0, 0);
	end
	call map_commentary;
end

procedure description_p_proc
begin
	if (is_success(do_check(dude_obj, 1, has_trait(0, dude_obj, 0)))) then begin
		script_overrides;
		display_msg(message_str(SCRIPT_IAN, 130));
	end
end

procedure destroy_p_proc
begin
	set_global_var(GVAR_IAN_STATUS, 3);
	if (source_obj == dude_obj) then begin
		if (((global_var(GVAR_BAD_MONSTER) + global_var(GVAR_GOOD_MONSTER)) >= 25) and ((global_var(GVAR_GOOD_MONSTER) > (2 * global_var(GVAR_BAD_MONSTER))) or (global_var(GVAR_BERSERKER_REPUTATION) == 1))) then begin
			set_global_var(GVAR_BERSERKER_REPUTATION, 1);
			set_global_var(GVAR_CHAMPION_REPUTATION, 0);
		end
		if (((global_var(GVAR_BAD_MONSTER) + global_var(GVAR_GOOD_MONSTER)) >= 25) and ((global_var(GVAR_BAD_MONSTER) > (3 * global_var(GVAR_GOOD_MONSTER))) or (global_var(GVAR_CHAMPION_REPUTATION) == 1))) then begin
			set_global_var(GVAR_CHAMPION_REPUTATION, 1);
			set_global_var(GVAR_BERSERKER_REPUTATION, 0);
		end
		set_global_var(GVAR_GOOD_MONSTER, global_var(GVAR_GOOD_MONSTER) + 1);
		if ((global_var(GVAR_GOOD_MONSTER) % 2) == 0) then begin
			set_global_var(GVAR_PLAYER_REPUTATION, global_var(GVAR_PLAYER_REPUTATION) - 1);
		end
	end
end

procedure look_at_p_proc
begin
	script_overrides;
	if (global_var(GVAR_IAN_STATUS) == 0) then begin
		display_msg(message_str(SCRIPT_IAN, 100));
	end
	else begin
		display_msg(message_str(SCRIPT_IAN, 113));
	end
end

procedure map_enter_p_proc
begin
	if (global_var(GVAR_IAN_STATUS) == 2) then begin
		critter_add_trait(self_obj, TRAIT_OBJECT, OBJECT_TEAM_NUM, 0);
		add_timer_event(self_obj, game_ticks(1), 1);
	end
	else begin
		critter_add_trait(self_obj, TRAIT_OBJECT, OBJECT_TEAM_NUM, 2);
	end
	critter_add_trait(self_obj, TRAIT_OBJECT, OBJECT_AI_PACKET, AI_IAN);
end

procedure pickup_p_proc
begin
	if (global_var(GVAR_IAN_STATUS) < 2) then begin
		hostile1 := 1;
	end
	else begin
		script_overrides;
	end
end

procedure talk_p_proc
begin
	call Get_Reaction;
	start_gdialog(SCRIPT_IAN, self_obj, 4, -1, -1);
	gsay_start;
	if ((global_var(GVAR_ENEMY_SHADY_SANDS) == 1) and (global_var(GVAR_IAN_STATUS) != 2)) then begin
		call Ian14;
	end
	else begin
		if (global_var(GVAR_IAN_STATUS) == 0) then begin
			call Ian02;
		end
		else begin
			if (global_var(GVAR_IAN_STATUS) == 2) then begin
				call Ian15;
			end
			else begin
				if (global_var(GVAR_IAN_STATUS) == 3) then begin
					call Ian21;
				end
				else begin
					call Ian12;
				end
			end
		end
	end
	gsay_end;
	end_dialogue;
	if ((global_var(GVAR_IAN_STATUS) == 2) and (global_var(GVAR_DESTROY_MASTER_9) == 0)) then begin
		set_global_var(GVAR_DESTROY_MASTER_9, 1);
		display_msg(message_str(SCRIPT_IAN, 169));
		give_exp_points(100);
	end
	if (unwield_flag == 1) then begin
		unwield_flag := 0;
		inven_unwield;
	end
end

procedure timed_event_p_proc
begin
	call follow_player;
end

procedure use_obj_on_p_proc
begin
	if (global_var(GVAR_IAN_STATUS) == 2) then begin
		item := obj_pid(obj_being_used_with);
		if ((item != 40) and (item != 47) and (item != 91)) then begin
			script_overrides;
			if (obj_item_subtype(obj_being_used_with) != 3) then begin
				rm_obj_from_inven(dude_obj, obj_being_used_with);
				add_obj_to_inven(self_obj, obj_being_used_with);
			end
			else begin
				if ((item == 4) or (item == 8) or (item == 18) or (item == 120) or (item == 22) or (item == 9) or (item == 16) or (item == 24) or (item == 241) or (item == 116) or (item == 236) or (item == 234) or (item == 235) or (item == 21)) then begin
					rm_obj_from_inven(dude_obj, obj_being_used_with);
					add_obj_to_inven(self_obj, obj_being_used_with);
				end
				else begin
					float_msg(self_obj, message_str(SCRIPT_MODREACT, 109), FLOAT_MSG_GREEN);
				end
			end
		end
	end
end

procedure join_party
begin
	set_global_var(GVAR_IAN_STATUS, 2);
	party_add(self_obj);
	add_timer_event(self_obj, game_ticks(1), 1);
	critter_add_trait(self_obj, TRAIT_OBJECT, OBJECT_TEAM_NUM, 0);
	gsay_message(SCRIPT_IAN, 150, NEUTRAL_REACTION);
end

procedure hire_Ian
begin
	item_caps_adjust(dude_obj, -100);
	item_caps_adjust(self_obj, 100);
	call join_party;
end

procedure Ian01
begin
	gsay_message(SCRIPT_IAN, 101, BAD_REACTION);
end

procedure Ian02
begin
	gsay_reply(SCRIPT_IAN, 102);
	giq_option(4, SCRIPT_IAN, 103, Ian03, BAD_REACTION);
	giq_option(4, SCRIPT_IAN, message_str(SCRIPT_IAN, 104) + proto_data(obj_pid(dude_obj), 1) + message_str(SCRIPT_IAN, 105), Ian04, NEUTRAL_REACTION);
	giq_option(-3, SCRIPT_IAN, 106, Ian05, NEUTRAL_REACTION);
end

procedure Ian03
begin
	gsay_message(SCRIPT_IAN, 107, BAD_REACTION);
end

procedure Ian04
begin
	gsay_reply(SCRIPT_IAN, 108);
	set_global_var(GVAR_IAN_STATUS, 1);
	giq_option(4, SCRIPT_IAN, 109, Ian06, NEUTRAL_REACTION);
	giq_option(5, SCRIPT_IAN, 110, Ian07, NEUTRAL_REACTION);
end

procedure Ian05
begin
	gsay_message(SCRIPT_IAN, 111, NEUTRAL_REACTION);
end

procedure Ian06
begin
	gsay_reply(SCRIPT_IAN, 112);
	giq_option(4, SCRIPT_IAN, 114, Ian18, NEUTRAL_REACTION);
	giq_option(4, SCRIPT_IAN, 115, Ian13, NEUTRAL_REACTION);
	giq_option(4, SCRIPT_IAN, 149, Ian17, NEUTRAL_REACTION);
	giq_option(5, SCRIPT_IAN, 116, Ian08, NEUTRAL_REACTION);
end

procedure Ian07
begin
	gsay_reply(SCRIPT_IAN, 117);
	giq_option(4, SCRIPT_IAN, 118, Ian09, NEUTRAL_REACTION);
	giq_option(4, SCRIPT_IAN, 119, Ian08, NEUTRAL_REACTION);
end

procedure Ian08
begin
	gsay_reply(SCRIPT_IAN, 120);
	giq_option(4, SCRIPT_IAN, 121, Ian10, NEUTRAL_REACTION);
	giq_option(5, SCRIPT_IAN, 122, Ian11, NEUTRAL_REACTION);
end

procedure Ian09
begin
	gsay_reply(SCRIPT_IAN, 123);
	giq_option(4, SCRIPT_MODREACT, 104, IanEnd, NEUTRAL_REACTION);
end

procedure Ian10
begin
	gsay_reply(SCRIPT_IAN, 125);
	giq_option(4, SCRIPT_IAN, 126, Ian09, NEUTRAL_REACTION);
	giq_option(4, SCRIPT_MODREACT, 101, IanEnd, NEUTRAL_REACTION);
end

procedure Ian11
begin
	gsay_reply(SCRIPT_IAN, 128);
	giq_option(4, SCRIPT_IAN, 129, Ian07, NEUTRAL_REACTION);
	giq_option(4, SCRIPT_MODREACT, 101, IanEnd, NEUTRAL_REACTION);
end

procedure Ian12
begin
	gsay_reply(SCRIPT_IAN, message_str(SCRIPT_IAN, 131) + proto_data(obj_pid(dude_obj), 1) + message_str(SCRIPT_IAN, 132));
	call Ian12a;
end

procedure Ian12a
begin
	giq_option(4, SCRIPT_IAN, 133, Ian11, NEUTRAL_REACTION);
	giq_option(4, SCRIPT_IAN, 134, Ian09, NEUTRAL_REACTION);
	giq_option(4, SCRIPT_IAN, 135, Ian07, NEUTRAL_REACTION);
	giq_option(4, SCRIPT_IAN, 136, Ian10, NEUTRAL_REACTION);
	giq_option(4, SCRIPT_IAN, 137, Ian13, NEUTRAL_REACTION);
	giq_option(4, SCRIPT_IAN, 149, Ian17, NEUTRAL_REACTION);
	giq_option(4, SCRIPT_IAN, 138, IanEnd, NEUTRAL_REACTION);
end

procedure Ian13
begin
	if (not(global_var(GVAR_THE_HUB))) then begin
		set_global_var(GVAR_THE_HUB, 1);
	end
	if (not(global_var(GVAR_JUNKTOWN))) then begin
		set_global_var(GVAR_JUNKTOWN, 1);
	end
	gsay_reply(SCRIPT_IAN, 139);
	if (global_var(GVAR_IAN_STATUS) == 2) then begin
		giq_option(4, SCRIPT_IAN, 140, Ian15, NEUTRAL_REACTION);
	end
	else begin
		giq_option(4, SCRIPT_IAN, 140, Ian12, NEUTRAL_REACTION);
	end
end

procedure Ian14
begin
	hostile1 := 1;
	gsay_message(SCRIPT_IAN, 141, BAD_REACTION);
end

procedure Ian15
begin
	gsay_reply(SCRIPT_IAN, message_str(SCRIPT_IAN, 142) + proto_data(obj_pid(dude_obj), 1) + message_str(SCRIPT_IAN, 143));
	giq_option(4, SCRIPT_IAN, 145, Ian16, NEUTRAL_REACTION);
	giq_option(4, SCRIPT_IAN, 146, Ian13, NEUTRAL_REACTION);
	giq_option(4, SCRIPT_IAN, 200, IanChange, NEUTRAL_REACTION);
	giq_option(4, SCRIPT_TYCHO, 159, IanTactics, NEUTRAL_REACTION);
	giq_option(4, SCRIPT_IAN, 173, Ian20, NEUTRAL_REACTION);
	giq_option(4, SCRIPT_IAN, 144, IanEnd, NEUTRAL_REACTION);
end

procedure Ian16
begin
	set_global_var(GVAR_IAN_STATUS, 3);
	party_remove(self_obj);
	gsay_message(SCRIPT_IAN, 147, NEUTRAL_REACTION);
	rm_timer_event(self_obj);
end

procedure Ian17
begin
	if (local_var(1) == 1) then begin
		gsay_message(SCRIPT_IAN, 148, BAD_REACTION);
	end
	else begin
		if (local_var(1) == 2) then begin
			gsay_reply(SCRIPT_IAN, 156);
			if (item_caps_total(dude_obj) >= 100) then begin
				giq_option(4, SCRIPT_IAN, 157, hire_Ian, GOOD_REACTION);
			end
			giq_option(6, SCRIPT_IAN, 159, Ian17a, NEUTRAL_REACTION);
			giq_option(4, SCRIPT_IAN, 158, IanEnd, NEUTRAL_REACTION);
		end
		else begin
			call join_party;
		end
	end
end

procedure Ian17a
begin
	if (is_success(roll_vs_skill(dude_obj, 14, 20))) then begin
		gsay_reply(SCRIPT_IAN, 160);
		giq_option(4, SCRIPT_MODREACT, 106, join_party, GOOD_REACTION);
	end
	else begin
		call Down_React;
		gsay_message(SCRIPT_IAN, 161, BAD_REACTION);
	end
end

procedure Ian18
begin
	gsay_reply(SCRIPT_IAN, 124);
	call Up_React;
	giq_option(4, SCRIPT_MODREACT, 106, Ian19, NEUTRAL_REACTION);
end

procedure Ian19
begin
	gsay_reply(SCRIPT_IAN, 127);
	call Ian12a;
end

procedure Ian20
begin
	gsay_message(SCRIPT_IAN, 174, NEUTRAL_REACTION);
	call Ian15;
end

procedure Ian21
begin
	gsay_reply(SCRIPT_IAN, 202);
	giq_option(4, SCRIPT_IAN, 203, join_party, NEUTRAL_REACTION);
	giq_option(4, SCRIPT_IAN, 204, IanEnd, NEUTRAL_REACTION);
end

procedure follow_player
begin
	variable LVar0 := 0;
	prev_tile := dest_tile1;
	LVar0 := (has_trait(1, dude_obj, 10) + random(2, 4)) % 6;
	dest_tile1 := tile_num_in_direction(tile_num(dude_obj), LVar0, (global_var(GVAR_DESTROY_VATS_5) * 2) + random(1, 2));
	if ((tile_distance_objs(self_obj, dude_obj) > ((global_var(GVAR_DESTROY_VATS_5) + 1) * 2)) or (random(0, 3) == 3)) then begin
		if (tile_distance(prev_tile, tile_num(dude_obj)) > tile_distance(dest_tile1, tile_num(dude_obj))) then begin
			if (tile_distance_objs(self_obj, dude_obj) > 8) then begin
				animate_move_obj_to_tile(self_obj, dest_tile1, ANIMATE_RUN bwor 16);
			end
			else begin
				animate_move_obj_to_tile(self_obj, dest_tile1, ANIMATE_WALK bwor 16);
			end
		end
		else begin
			if (tile_distance_objs(self_obj, dude_obj) > 8) then begin
				animate_move_obj_to_tile(self_obj, dest_tile1, ANIMATE_RUN);
			end
			else begin
				animate_move_obj_to_tile(self_obj, dest_tile1, ANIMATE_WALK);
			end
		end
	end
	add_timer_event(self_obj, game_ticks(1), 1);
end

procedure map_commentary
begin
	if (cur_map_index == MAP_JUNKKILL) then begin
		if (tile_distance(tile_num(self_obj), 27883) < 4) then begin
			if (not(line151flag)) then begin
				float_msg(self_obj, message_str(SCRIPT_IAN, 151), FLOAT_MSG_NORMAL);
				line151flag := 1;
			end
		end
	end
	else begin
		if (cur_map_index == MAP_JUNKCSNO) then begin
			if (tile_distance(tile_num(self_obj), 27919) < 4) then begin
				if (not(line152flag)) then begin
					float_msg(self_obj, message_str(SCRIPT_IAN, 152), FLOAT_MSG_NORMAL);
					line152flag := 1;
				end
			end
		end
		else begin
			if (cur_map_index == MAP_HALLDED) then begin
				if (not(line153flag)) then begin
					float_msg(self_obj, message_str(SCRIPT_IAN, 153), FLOAT_MSG_NORMAL);
					line153flag := 1;
				end
			end
			else begin
				if (cur_map_index == MAP_GLOWENT) then begin
					if (not(line154flag)) then begin
						float_msg(self_obj, message_str(SCRIPT_IAN, 154), FLOAT_MSG_NORMAL);
						if (global_var(GVAR_KATJA_STATUS) == 2) then begin
							float_msg(Katja_ptr, message_str(SCRIPT_KATJA, 185), FLOAT_MSG_PURPLE);
						end
						line154flag := 1;
					end
				end
				else begin
					if (cur_map_index == MAP_MBENT) then begin
						if (not(line155flag)) then begin
							float_msg(self_obj, message_str(SCRIPT_IAN, 155), FLOAT_MSG_NORMAL);
							line155flag := 1;
						end
					end
					else begin
						if (cur_map_index == MAP_HUBDWNTN) then begin
							if (tile_distance(tile_num(self_obj), 24890) < 4) then begin
								if (not(line162flag)) then begin
									float_msg(self_obj, message_str(SCRIPT_IAN, 162), FLOAT_MSG_NORMAL);
									line162flag := 1;
								end
							end
							else begin
								if (tile_distance(tile_num(self_obj), 14116) < 4) then begin
									if (not(line165flag)) then begin
										float_msg(self_obj, message_str(SCRIPT_IAN, 165), FLOAT_MSG_NORMAL);
										line165flag := 1;
									end
								end
								else begin
									if (tile_distance(tile_num(self_obj), 18464) < 4) then begin
										if (not(line166flag)) then begin
											float_msg(self_obj, message_str(SCRIPT_IAN, 166), FLOAT_MSG_NORMAL);
											line166flag := 1;
										end
									end
									else begin
										if (tile_distance(tile_num(self_obj), 21730) < 4) then begin
											if (not(line167flag)) then begin
												float_msg(self_obj, message_str(SCRIPT_IAN, 167), FLOAT_MSG_NORMAL);
												line167flag := 1;
											end
										end
									end
								end
							end
						end
						else begin
							if (cur_map_index == MAP_HUBOLDTN) then begin
								if (tile_distance(tile_num(self_obj), 16082) < 4) then begin
									if (line163flag == 0) then begin
										float_msg(self_obj, message_str(SCRIPT_IAN, 163), FLOAT_MSG_NORMAL);
										line163flag := 1;
									end
								end
							end
							else begin
								if (cur_map_index == MAP_HUBWATER) then begin
									if (tile_distance(tile_num(self_obj), 22497) < 4) then begin
										if (line164flag == 0) then begin
											float_msg(self_obj, message_str(SCRIPT_IAN, 164), FLOAT_MSG_NORMAL);
											line164flag := 1;
										end
									end
								end
								else begin
									if (cur_map_index == MAP_VAULT13) then begin
										if (line170flag == 0) then begin
											float_msg(self_obj, message_str(SCRIPT_IAN, 170), FLOAT_MSG_NORMAL);
											line170flag := 1;
										end
									end
								end
							end
						end
					end
				end
			end
		end
	end
end

procedure IanEnd
begin
end

procedure IanCombat
begin
	hostile1 := 1;
end

procedure IanTactics
begin
	gsay_reply(SCRIPT_TYCHO, 160);
	giq_option(4, SCRIPT_TYCHO, 161, IanClose, NEUTRAL_REACTION);
	giq_option(4, SCRIPT_TYCHO, 162, IanModerate, NEUTRAL_REACTION);
	giq_option(4, SCRIPT_TYCHO, 163, IanFar, NEUTRAL_REACTION);
end

procedure IanClose
begin
	set_global_var(GVAR_DESTROY_VATS_5, 0);
	gsay_message(SCRIPT_IAN, 201, NEUTRAL_REACTION);
	call Ian15;
end

procedure IanModerate
begin
	set_global_var(GVAR_DESTROY_VATS_5, 1);
	gsay_message(SCRIPT_IAN, 201, NEUTRAL_REACTION);
	call Ian15;
end

procedure IanFar
begin
	set_global_var(GVAR_DESTROY_VATS_5, 2);
	gsay_message(SCRIPT_IAN, 201, NEUTRAL_REACTION);
	call Ian15;
end

procedure IanChange
begin
	gsay_message(SCRIPT_IAN, 201, NEUTRAL_REACTION);
	unwield_flag := 1;
	call Ian15;
end

procedure Get_Reaction
begin
	if (local_var(2) == 0) then begin
		set_local_var(0, 50);
		set_local_var(1, 2);
		set_local_var(2, 1);
		set_local_var(0, local_var(0) + (5 * get_critter_stat(dude_obj, 3)) - 25);
		set_local_var(0, local_var(0) + (10 * has_trait(0, dude_obj, 10)));
		if (has_trait(0, dude_obj, 39)) then begin
			if (global_var(GVAR_PLAYER_REPUTATION) > 0) then begin
				set_local_var(0, local_var(0) + global_var(GVAR_PLAYER_REPUTATION));
			end
			else begin
				set_local_var(0, local_var(0) - global_var(GVAR_PLAYER_REPUTATION));
			end
		end
		else begin
			if (local_var(3) == 1) then begin
				set_local_var(0, local_var(0) - global_var(GVAR_PLAYER_REPUTATION));
			end
			else begin
				set_local_var(0, local_var(0) + global_var(GVAR_PLAYER_REPUTATION));
			end
		end
		if (global_var(GVAR_CHILDKILLER_REPUTATION) > 2) then begin
			set_local_var(0, local_var(0) - 30);
		end
		if (((global_var(GVAR_BAD_MONSTER) + global_var(GVAR_GOOD_MONSTER)) >= 25) and ((global_var(GVAR_BAD_MONSTER) > (3 * global_var(GVAR_GOOD_MONSTER))) or (global_var(GVAR_CHAMPION_REPUTATION) == 1))) then begin
			set_local_var(0, local_var(0) + 20);
		end
		if (((global_var(GVAR_BAD_MONSTER) + global_var(GVAR_GOOD_MONSTER)) >= 25) and ((global_var(GVAR_GOOD_MONSTER) > (2 * global_var(GVAR_BAD_MONSTER))) or (global_var(GVAR_BERSERKER_REPUTATION) == 1))) then begin
			set_local_var(0, local_var(0) - 20);
		end
		call React_To_Level;
	end
end

procedure React_To_Level
begin
	if (local_var(0) <= 25) then begin
		set_local_var(1, 1);
	end
	else begin
		if (local_var(0) <= 75) then begin
			set_local_var(1, 2);
		end
		else begin
			set_local_var(1, 3);
		end
	end
end

procedure Level_To_React
begin
	if (local_var(1) == 1) then begin
		set_local_var(0, random(1, 25));
	end
	else begin
		if (local_var(1) == 2) then begin
			set_local_var(0, random(26, 75));
		end
		else begin
			set_local_var(0, random(76, 100));
		end
	end
end

procedure Up_React
begin
	set_local_var(0, local_var(0) + 10);
	call React_To_Level;
end

procedure Down_React
begin
	set_local_var(0, local_var(0) - 10);
	call React_To_Level;
end

procedure Bottom_React
begin
	set_local_var(1, 1);
	set_local_var(0, 1);
end

procedure Top_React
begin
	set_local_var(0, 100);
	set_local_var(1, 3);
end

procedure Big_Up_React
begin
	set_local_var(0, local_var(0) + 25);
	call React_To_Level;
end

procedure Big_Down_React
begin
	set_local_var(0, local_var(0) - 25);
	call React_To_Level;
end

procedure Up_React_Level
begin
	set_local_var(1, local_var(1) + 1);
	if (local_var(1) > 3) then begin
		set_local_var(1, 3);
	end
	call Level_To_React;
end

procedure Down_React_Level
begin
	set_local_var(1, local_var(1) - 1);
	if (local_var(1) < 1) then begin
		set_local_var(1, 1);
	end
	call Level_To_React;
end

procedure Goodbyes
begin
	exit_line := message_str(SCRIPT_MODREACT, random(100, 105));
end