Scenario Editor: Difference between revisions
No edit summary |
JYWLuca8269 (talk | contribs) No edit summary |
||
(18 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:<span style="position: absolute; clip: rect(1px 1px 1px 1px); clip: rect(1px, 1px, 1px, 1px);">{{FULLPAGENAME}}</span>}} | |||
== Scripting – Creating Scenarios = | {{HeaderTemplate | ||
|welcome=Scenario Editor | |||
}} | |||
{{SectionTemplate | |||
|h=h3 | |||
|title=Scripting – Creating Scenarios | |||
|content=}} | |||
[[Scripting|Scripting]] allows you a huge amount of control over what exactly happens on the map you are creating. You can restrict what buildings and [[Units|units]] the players can use, set up [[Triggers|Triggers]] to lock or unlock them, spawn units or buildings for the players or their enemies. You can send units to attack specific targets and send dialog popups to the player. Everything you need to make your own custom Scenarios. | [[Scripting|Scripting]] allows you a huge amount of control over what exactly happens on the map you are creating. You can restrict what buildings and [[Units|units]] the players can use, set up [[Triggers|Triggers]] to lock or unlock them, spawn units or buildings for the players or their enemies. You can send units to attack specific targets and send dialog popups to the player. Everything you need to make your own custom Scenarios. | ||
Line 10: | Line 15: | ||
Note that all triggers and arguments are case-sensitive. | Note that all triggers and arguments are case-sensitive. | ||
First, you set up all the menu-related items (what icons/art to use in the Campaign screen, etc) and global settings like enabling/disabling creeps and hiding terrain. | {{SectionTemplate | ||
|h=h4 | |||
|title=Mission Definition | |||
|content= | |||
}} | |||
First, you set up all the menu-related items (what icons/art to use in the Campaign screen, etc) and global settings like enabling/disabling creeps and hiding terrain. [[Missions (scripting)|Click here]] to see the full list of what can be configured in mission scripting. | |||
{{SectionTemplate | |||
|h=h4 | |||
|title=Player Definition | |||
|content= | |||
}} | |||
To do much of anything, you'll need to define [[Player_(scripting)|players]] next. This is done with individual <Player> tags that enable or disable their AI, sets faction, team, and color, etc. | To do much of anything, you'll need to define [[Player_(scripting)|players]] next. This is done with individual <Player> tags that enable or disable their AI, sets faction, team, and color, etc. | ||
You'll likely refer to these players later in the script by number, where 0 is the first player defined, 1 is the next, and so on. | You'll likely refer to these players later in the script by number, where 0 is the first player defined, 1 is the next, and so on. | ||
{{SectionTemplate | |||
|h=h4 | |||
|title=Triggers | |||
|content= | |||
}} | |||
[[Triggers|Triggers]] are what control anything you want to happen while the scenario is being played, from spawning starting base to calling waves of attacking enemies or giving players objectives. There are several types of triggers which activate off of different events. | [[Triggers|Triggers]] are what control anything you want to happen while the scenario is being played, from spawning starting base to calling waves of attacking enemies or giving players objectives. There are several types of triggers which activate off of different events. | ||
{{SectionTemplate | |||
|h=h5 | |||
|title=Trigger Types | |||
|content= | |||
}} | |||
These are the types of triggers you can use in a script, and any specific arguments they support. | These are the types of triggers you can use in a script, and any specific arguments they support. | ||
Line 46: | Line 67: | ||
*'''[[ZoneCapture_Trigger|ZoneCapture]]''' - Fires when a region is captured, is also used for destroying players since their nexus turns into a Turinium Generator. | *'''[[ZoneCapture_Trigger|ZoneCapture]]''' - Fires when a region is captured, is also used for destroying players since their nexus turns into a Turinium Generator. | ||
{{SectionTemplate | |||
|h=h4 | |||
|title=Commands | |||
|content= | |||
}} | |||
These are the [[Script_Commands|commands]] you can put within a trigger to create gameplay effects. | These are the [[Script_Commands|commands]] you can put within a trigger to create gameplay effects. | ||
Line 80: | Line 103: | ||
*'''[[Var_Command|Var]]''' - Set or modify a variable. Tip: Set any variable you want to use to 0 in the initial setup trigger to avoid unpredictable results. ''All values must be integers.'' | *'''[[Var_Command|Var]]''' - Set or modify a variable. Tip: Set any variable you want to use to 0 in the initial setup trigger to avoid unpredictable results. ''All values must be integers.'' | ||
{{SectionTemplate | |||
|h=h3 | |||
|title=Position Coordinates | |||
|content= | |||
}} | |||
To view map coordinates, ensure you have opted into to a modding build under steam betas which allows you to open the developer tools. Open up the the map in a skirmish and press the ` or HOME key, then select DebugPlayerPanel and Enable Show Mouse Position. | To view map coordinates, ensure you have opted into to a modding build under steam betas which allows you to open the developer tools. Open up the the map in a skirmish and press the ` or HOME key, then select DebugPlayerPanel and Enable Show Mouse Position. | ||
{{SectionTemplate | |||
|h=h3 | |||
|title=Trigger Examples | |||
|content= | |||
}} | |||
A single trigger can do any combination of the above options. It can popup some text, spawn some units, set an objective give the player some resources and unlock some new building options. It is up to you how you want to combine and use them. Let’s take a look at some examples. | A single trigger can do any combination of the above options. It can popup some text, spawn some units, set an objective give the player some resources and unlock some new building options. It is up to you how you want to combine and use them. Let’s take a look at some examples. | ||
{{SectionTemplate | |||
|h=h4 | |||
|title=Send an army to attack | |||
|content= | |||
}} | |||
[[File:ModGuide 29.png|frame|center|An attack trigger]]<br /> The above trigger is inactive, meaning it needs another trigger to call it before it will activate. Once it does it will spawn 16 units into an army and send them to attack the defined map position. This is a relatively simple trigger, but a common one. With this alone you can create scenarios that spawn waves to attack the player, grant reinforcements to the player or create surprise ambushes. | [[File:ModGuide 29.png|frame|center|An attack trigger]]<br /> The above trigger is inactive, meaning it needs another trigger to call it before it will activate. Once it does it will spawn 16 units into an army and send them to attack the defined map position. This is a relatively simple trigger, but a common one. With this alone you can create scenarios that spawn waves to attack the player, grant reinforcements to the player or create surprise ambushes. | ||
{{SectionTemplate | |||
|h=h4 | |||
|title=Reward the player for capturing an area | |||
|content= | |||
}} | |||
[[File:ModGuide 30.png|frame|center|A region capture trigger]]<br /> The above trigger occurs when the player captures the region at the specified position. Notice that the trigger starts inactive, so it would need to be enabled by an earlier trigger before it could occur. | [[File:ModGuide 30.png|frame|center|A region capture trigger]]<br /> The above trigger occurs when the player captures the region at the specified position. Notice that the trigger starts inactive, so it would need to be enabled by an earlier trigger before it could occur. | ||
Line 110: | Line 149: | ||
This is a great example of the kind of combinations that can be done with the trigger system. This is a reward to the player for capturing the region. But it could as easily have triggered an escalation for the enemy forces. | This is a great example of the kind of combinations that can be done with the trigger system. This is a reward to the player for capturing the region. But it could as easily have triggered an escalation for the enemy forces. | ||
== Commenting Out Code = | {{SectionTemplate | ||
|h=h3 | |||
|title=Commenting Out Code | |||
|content= | |||
}} | |||
Commenting out code is very useful to disable certain lines but without deleting them so you can easily place them back on. This is also useful for leaving notes so you remember what you are trying to do or just making it neater and easier to navigate. I need to use an image to show which characters are used to comment out. | |||
[[File:Capture.jpg|thumb|left]] | |||
{{SectionTemplate | |||
|h=h3 | |||
|title=Fixing Issues | |||
|content= | |||
}} | |||
Many things in the Scenario code can cause issues that result a crash or prevent it from working. Here's a list of some common issues that you may encounter and how to fix them. | Many things in the Scenario code can cause issues that result a crash or prevent it from working. Here's a list of some common issues that you may encounter and how to fix them. | ||
*'''Consistent Crash''' - Often happening at the start of a scenario, if you have a crash that happens every time it is likely the result of trying to spawn a unit or building with an incorrect name. For example, if the game is trying to spawn PHC_Smarty_System" it will find this building name doesn't exist and result in a crash, due to the internal reference name actually being PHC_Smarties. It's vital you get the correct internal reference names, and not all of them match their in-game display | *'''Consistent Crash''' - Often happening at the start of a scenario, if you have a crash that happens every time it is likely the result of trying to spawn a unit or building with an incorrect name. For example, if the game is trying to spawn PHC_Smarty_System" it will find this building name doesn't exist and result in a crash, due to the internal reference name actually being PHC_Smarties. It's vital you get the correct internal reference names, and not all of them match their in-game display | ||
*'''Empty Campaign Screen''' - If the campaign screen is empty with no campaigns or scenario missions listed, this means there is a grammar error in one of the scripts which has broken it and made it unable to be ran. You will have to identity the mistake and fix it. For example, having a Trigger without the > on the end or missing a quotation mark can cause this error. Identifying the issue can be time consuming, so it is recommended you make updates in small increments so you know where in the script the cause would be. One strategy to find these mistakes is to comment out entire sections of the script and see if the problem persists. If you have commented out a large portion of the script and then the missions are now showing up, you have narrowed down the cause and you can comment more and more specific sections to location the issue. | *'''Empty Campaign Screen''' - If the campaign screen is empty with no campaigns or scenario missions listed, this means there is a grammar error in one of the scripts which has broken it and made it unable to be ran. You will have to identity the mistake and fix it. For example, having a Trigger without the > on the end or missing a quotation mark can cause this error. Identifying the issue can be time consuming, so it is recommended you make updates in small increments so you know where in the script the cause would be. One strategy to find these mistakes is to comment out entire sections of the script and see if the problem persists. If you have commented out a large portion of the script and then the missions are now showing up, you have narrowed down the cause and you can comment more and more specific sections to location the issue. | ||
[[Category:Modding]] |
Latest revision as of 10:17, 5 October 2021
Scripting – Creating ScenariosScripting allows you a huge amount of control over what exactly happens on the map you are creating. You can restrict what buildings and units the players can use, set up Triggers to lock or unlock them, spawn units or buildings for the players or their enemies. You can send units to attack specific targets and send dialog popups to the player. Everything you need to make your own custom Scenarios. All of this is stored in XML, not code, so you don’t need any special programming tools or experience to use it. Though, it may be confusing at first and take a while to wrap your head around it. The best advice for seeing what is possible is to look through the \Assets\Campaign\ and \Scenario\ directories and seeing how the existing missions are made. Some examples are also included below. There are three main elements in Ashes scripting: missions, players and triggers. Missions are the definition or the scenario. Players defines the players that are going to be used in the scenario. Triggers are where all the magic happens. Triggers have a lot of elements and options. There's a lot of terminology to learn for scripting, and not all of them are listed on this page but links are provided throughout to give you the full set of required terms. Note that all triggers and arguments are case-sensitive.
Mission DefinitionFirst, you set up all the menu-related items (what icons/art to use in the Campaign screen, etc) and global settings like enabling/disabling creeps and hiding terrain. Click here to see the full list of what can be configured in mission scripting.
Player DefinitionTo do much of anything, you'll need to define players next. This is done with individual <Player> tags that enable or disable their AI, sets faction, team, and color, etc. You'll likely refer to these players later in the script by number, where 0 is the first player defined, 1 is the next, and so on.
TriggersTriggers are what control anything you want to happen while the scenario is being played, from spawning starting base to calling waves of attacking enemies or giving players objectives. There are several types of triggers which activate off of different events.
Trigger TypesThese are the types of triggers you can use in a script, and any specific arguments they support.
CommandsThese are the commands you can put within a trigger to create gameplay effects. For detailed information about how to use this, read the main Commands entry.
Position CoordinatesTo view map coordinates, ensure you have opted into to a modding build under steam betas which allows you to open the developer tools. Open up the the map in a skirmish and press the ` or HOME key, then select DebugPlayerPanel and Enable Show Mouse Position.
Trigger ExamplesA single trigger can do any combination of the above options. It can popup some text, spawn some units, set an objective give the player some resources and unlock some new building options. It is up to you how you want to combine and use them. Let’s take a look at some examples.
Send an army to attackThe above trigger is inactive, meaning it needs another trigger to call it before it will activate. Once it does it will spawn 16 units into an army and send them to attack the defined map position. This is a relatively simple trigger, but a common one. With this alone you can create scenarios that spawn waves to attack the player, grant reinforcements to the player or create surprise ambushes.
Reward the player for capturing an areaThe above trigger occurs when the player captures the region at the specified position. Notice that the trigger starts inactive, so it would need to be enabled by an earlier trigger before it could occur. This trigger does the following:
This is a great example of the kind of combinations that can be done with the trigger system. This is a reward to the player for capturing the region. But it could as easily have triggered an escalation for the enemy forces.
Commenting Out CodeCommenting out code is very useful to disable certain lines but without deleting them so you can easily place them back on. This is also useful for leaving notes so you remember what you are trying to do or just making it neater and easier to navigate. I need to use an image to show which characters are used to comment out.
Fixing IssuesMany things in the Scenario code can cause issues that result a crash or prevent it from working. Here's a list of some common issues that you may encounter and how to fix them.
|