Create your first Emergency

This is a small tutorial on how to create a Emergency

create a `<filename>.fsx` file named after your emergencies

```
#load "EmergencyShared.fsx"
open EMT.Modding
open EmergencyShared

//Level 1 - first day

Def.Emergency.Add {
    ID = "ImASuperHero"
    Type = Type.Police
    Difficulty = "Hard"
    Level = 1
    Weighting = {
        Day = 1.0
        Night = 1.0
    }
    Tags = {
        Visible = ["Urban"]
        Hidden = ["Police"; "Tier1";"USA";"OnLand";]
    }
    TitleKey = "Im_A_Superhero"
    InitialDescriptionKeys = ["Im_A_Superhero_Desc01"]
    AssetRequirements = [
        "Police", 1, 100

    ]
    PreparationTime = Gt.hours 0.1
    ResolutionTime = Gt.hours 100.00
    MoneyGainOnSuccess = 0
    ReputationGainOnDispatch = 0, 100
    ReputationCostToTerminate = Some (1, 1)
    Events = [
        When.Emergency.Success [
            AddXp 1000.0
            AddExhaustion 0.1
            AddInjury 0.0 0.05 ["Light"]
            SetMood 1.0
            ForEach.Emergency.Vehicle [Vehicle.Damage 0.0]
        ]
        When.Emergency.Failure [
            AddExhaustion 10.0
            AddInjury 1.0 1.0 ["Hard"]
            SetMood -10.0
            ForEach.Emergency.Vehicle [Vehicle.Damage 100.0]
        ]
    ]
}

```

Let me now explain you the what the lines actually mean

```
#load "EmergencyShared.fsx"
open EMT.Modding
open EmergencyShared

//Comment for your self.

```

This is the headder that is needed to create a emergency

```
Def.Emergency.Add {
    ID = "CatStuckInTreeHigh"   ///This is a id that you use to refere to your emergency in other files
    Type = Type.FireDept       ///This type tag is used to declare your emergency on a type, for example we selecte a single department Firedepartment emergency here, for example you can also use Type.AllThree
    Difficulty = "Easy"       ///We offer a visible difficulty indicator on the sidebar (1-3 star rating), you can select between Easy, Medium and Hard
    Level = 1                ///The Level is more or less the same a the Difficutly indicator just used internal for spawning your emergencies in the right wave
    Weighting = {
        Day = 1.0           ///idicator how often your emergency spawn at day compare to other emergencies
        Night = 0.0        ///idicator how often your emergency spawn at night emergencies
    }

```

This was the basic setup now lets add some more information to our emergency

```
Tags = {
        Visible = ["Urban"]          ///This is used as a vibsile tag, these tags can be used on your people too and used to give your +% in success rate from these
        Hidden = ["FireDept"; "Tier1";"USA";"OnLand";"Berlin"]  ///Used to spawn your emergency on the right place and where they should be used, this emergency is spawned on the map Berlin on land for example

```

Now lets add some information to spawn our emergency on the map and give it a view more icons

```
TitleKey = "CatStuck_Title"                           ///This is the title refered at the loca kit
    InitialDescriptionKeys = ["CatStuck_Desc02"]     ///This is the description refered at the loca kit
    AssetRequirements = [                           ///List the tools, people ....etc you actually need for this emergency
        "FireFighter", 2, 48 //96                  ///We use 2 firefighter in this emergency each of them add 48% success rate
        "Ladder", 1, 4 //4                        ///Lets add a ladder to get the cat from the tree, ... 48 + 48 = 96, so the ladder will add 4% to have the 100% fullfilled
    ]

```

So a emergency would not be fun without some items to use and people that actually handle it right? Here we add them

```
PreparationTime = Gt.hours 2.0                      ///This much ingame time is needed untill the emergency runs out
    ResolutionTime = Gt.hours 0.75                 ///This ingame time is taken to solve the emergency by your crew
    MoneyGainOnSuccess = 500                      ///The money gain after a successfull emergency
    ReputationGainOnDispatch = 0, 20             ///The gain reputation if you dispatch your crew
    ReputationCostToTerminate = Some (10, 10)   ///The call for help button can get more expensive by time if you like

```

Preparation is everything so are these timers for your emergency

```
 Events = [                                                         ///In events we can handle what actually happen in a emergency, can your people get hurt? Damn you might bring back a new item or prisoner
        When.Emergency.Success [                                   ///If a emergency success we can handle it here
            AddXp 7.0                                             ///Add Xp to your crew members
            AddExhaustion 1.0                                    ///The level of exhausting your people get from that emergency
            AddInjury 0.0 0.05 ["Light"]                        ///Add a chance that they can get Injured
            SetMood 1.0                                        ///People should feel happy if they successfull finish a emergency, dont they?
            ForEach.Emergency.Vehicle [Vehicle.Damage 10.0]   ///As you use your vehicle add some damage to them
        ]
        When.Emergency.Failure [                            ///Set  stats as on failed emergencys
            AddExhaustion 1.5
            AddInjury 0.1 0.2 ["Light"]
            SetMood -2.0
            ForEach.Emergency.Vehicle [Vehicle.Damage 10.0]
        ]
    ]
}

```

Let's wrap it up with some stats and xp for your people and vehicles