// SCENARIO SCRIPT

// This is the special script for your entire scenario. It contains
// special encounters and code accessable from anywhere in the scenario. it also
// contains the code that initializes important special things in the
// scenario (like shops and names and descriptions of special items).

// You can create your own states, but you should give all of them numbers greater than
// or equal to 10.

beginscenarioscript;

variables;
int choice;

body;

// This is the state that is called every time the scenario is loaded,
// even when a save file in the scenario is loaded. Some things that should go here:
//    Names and descriptions of special items.
//    Names and effects of custom special abilities.
beginstate LOAD_SCEN_STATE;

	// Special abilities
	init_special_abil(0,"End scenario",11);

	// Special items
	init_special_item(0,"Strange key","We found this strange, key-like object in a scroll on a shelve");

break;

// This is the state that is called only once at the very beginning of 
// the scenario. Some things that should go here:
//    The stuff in shops.
//    Creating horses and boats.
beginstate START_SCEN_STATE;
	// *** Custom abilities given***
	
	change_custom_abil_uses(0,0,1); // Give party immediately the info and settings custom ability
	change_custom_abil_uses(1,0,1);
	change_custom_abil_uses(2,0,1);
	change_custom_abil_uses(3,0,1);

	// *** Start scenario messages ***

	// Read readme file
	message_dialog("I urge you to read the Readme file if you haven't done so already. It contains important information on the use of special abilities, known bugs and some other important stuff.","");

	message_dialog("Dust and rubble everywhere. Darkness at first, now slowly the light comes back. Not the full strength we are used to, but it'll do. For now.","What is this place, anyway? Looking around, we see rubble, and dust... and more rubble and dust.");

	reset_dialog();
	add_dialog_str(0,"_Oh, I see you have woken up. You were lying there for a long time. It was a bit weird. I picked you up as you were coming down the shaft. When you hit the ground, I first thought you were dead, but apparently not._",0);
	add_dialog_str(1,"_You probably don't know where you are, do you. Welcome to Harsen Mining Corporation. The Harsen Mining Corporation is property of Oleg Solyis, who single-handedly made the Harsen Mining Corporation into a booming industry of hard-working, healthy men._",0);
	add_dialog_choice(0,"Bite it bite it!");
	choice = run_dialog(1);

	reset_dialog();
	add_dialog_str(0,"_You seem not to have fully recovered yet from your fall. You may keep lying there for now, but the Harsen Mining Corporation closes in eight hours, so be sure to leave before that time. Otherwise, you'll not come out until tomorrow._",0);
	add_dialog_str(1,"_In the mean time you may consider what you want to do. You may take a tour, led by me. Do you know who I am? I suppose not._",0);
	add_dialog_choice(0,"Talking voice... I hear you, are you in my head?");
	choice = run_dialog(1);

	reset_dialog();
	add_dialog_str(0,"The voice laughs at us, laughs at us! Laugh back! Haha, we laugh back at you, we will laugh back at you, we ARE laughing back at you. Wait. Where are we. We were here not before. Is this what they call the afterlife?",0);
	add_dialog_str(1,"_Your thoughts are most interesting to me. Please be calm while the welcoming committee descends to pick you up. They will be shortly there._",0);
	add_dialog_str(2,"_I, if you need me, am HIM. When you need me, call my name. I am HIM._",0);
	add_dialog_choice(0,"His Infernal Majesty?");
	choice = run_dialog(1);

	reset_dialog();
	add_dialog_str(0,"_No. Another HIM. The welcoming committee will soon be with you. Keep waiting. They will bring tea. Tea and biscuits. Keep waiting. Tea and biscuits._",0);
	add_dialog_choice(0,"We will wait.");
	choice = run_dialog(1);

break;

// This state is called every tick wherever the party is in the scenario.
// You can use the set_state
beginstate START_STATE;
break;

beginstate 10; // scroll at town 3
reset_dialog();
add_dialog_str(0,"Dear Stella,",20);
add_dialog_str(1,"I hope to get out of this place soon and see you again. I don't know exactly what Utility Development is up to (I heard there is some thing called HIM), but it can't be good. Ever since they started the project, bad things have been happening.",20);
add_dialog_str(2,"Sure, it was a blessing in the beginning. It sort of controlled the HMC: the doors and the lights and all that, everything. However, suddenly things started going awry. Of course they tell us nothing about it.",20);
add_dialog_str(3,"As it is now, everything goes badly. Miners get trapped, some even starved because they got trapped after their mine collapsed. The researchers tell us nothing, but we know it's HIM. HIM is looking at us. I know it. I just know it.",20);
add_dialog_str(4,"The letter is unsigned.",0);
choice = run_dialog(1);
break;

beginstate 11; //quitting the scenario halfway
change_custom_abil_uses(who_used_custom_abil(),0,1); // Give the one who used the ability this ability again immediately
reset_dialog();
add_dialog_str(0,"We can't take this anymore. HIM is driving us crazy. We must get out! get out! Stop the biting, the stomping! Get us out of here! Or... Maybe we should stay after all? Stay and bite m stomp m... Knives out or be fitter and happier.",0);
add_dialog_choice(0,"Stop it, quit the madness of this place.");
add_dialog_choice(1,"No, let us still continue!");
choice = run_dialog(1);

	if (choice == 1) {
			message_dialog("We fall to our knees, begging for mercy, but nothing happens. We roll over and lie down. Lay our head to rest. This is it. It has been enough. We shall rest. We shall go on. First it was light, then the darkness came. It never went away.","");
			end_scenario(0);
			}

	if (choice == 2) { // if player continues, give ability once again
			change_custom_abil_uses(0,0,1); // Give party immediately the info and settings custom ability
			change_custom_abil_uses(1,0,1);
			change_custom_abil_uses(2,0,1);
			change_custom_abil_uses(3,0,1);
			}
break;