====== Tutorial: Creating a Sample Encounter ====== [[modding:encounters|Encounters]] are similar to a D&D “random encounter” system. Encounters can be defined at the Module and Mission levels. Encounters at the mission level will override Encounters at the module level that have the exact same name. For more information about the different options when creating an encounter, read the [[modding:encounters|Encounter article]]. ===== 01: Tutorial Goal ===== Let's create an encounter that spawns one [[modding:add_object|object]] and triggers one [[modding:actions|action]]. Our goals are to: - Spawn (1) Cargo Train - Give the Cargo Train (10) Wasp Missiles - Have the Cargo Train send a message that reads, "Horizons, it looks like you could use these." - Make it so that this encounter can only happen once. - Make it so that this encounter has a 10% chance of triggering every time an Alliance Player enters a system. ===== 02: Adding an Encounter ===== Open the Module or Mission that you wish to add this encounter to. Click on the Encounters page for that Mission or Module. Select "Add An Encounter" {{ :modding:tutorials:add_an_encounter.png?nolink&400 |}} Set the Name to something unique. Set the Faction to Alliance, so that Alliance player ships can trigger this Encounter. (Goal #5) Leave the location field blank because we don't want to limit this to a Planet, System, or Tag. Set the chance to 0.1, which translates to 10%. (Goal #5) Uncheck the Repeating? box so that this Encounter only happens once. Check the box that makes this Encounter Active. (Goal $4) (If you wanted this to wait until a specific point in the mission to be a potential Encounter, leave it as inactive and activate it using an Event Action.) ===== 03: Add An Encounter Group ===== Press the green Add button. Give this Encounter Group an Index and a Name. ===== 04: Add an Object ===== Under Objects, select Add. (Goal #1) Set up the [[modding:add_object|object]]'s General information as you normally would, setting the Class to Cargo Train. In the Cargo menu, add 10 Wasp Missiles to the ship's inventory. Set other settings, as needed. Save the Object to close the Object editor. (Goal #2) ===== 05: Add an Action ===== {{:modding:tutorials:add_encounter_action.png?nolink&400 |}} Under [[modding:actions|Actions,]] select Add. Set the Action Type to "Send Message". (Goal #3) TO = Player. FROM = Cargo Train (or whatever you named it on a previous step). Text: "Horizons, it looks like you could use these." Save the action and the Encounter Group. ===== 06: Testing! ===== Run your mission or module and see if it works well! Remember, it may take a bit of trial and error before it is ready to go. ===== Questions? ===== Join our [[https://discord.gg/tM9NpqS|Discord Server]] so that we can help you!