-
-
Notifications
You must be signed in to change notification settings - Fork 42
Add map reveal trigger script in c# #230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Rampastring
merged 5 commits into
CnCNet:master
from
JoyfulShush:add-map-reveal-trigger-cs
Jul 17, 2025
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
479b09c
Add map reveal trigger script in c#
JoyfulShush 1c2cb10
Add trigger change event and refactor trigger management
JoyfulShush a1e26fd
Merge remote-tracking branch 'upstream/master' into add-map-reveal-tr…
JoyfulShush 5a79442
Post-merge fixes, slight text adjustment
JoyfulShush 5a51671
Add space between functions
JoyfulShush File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| // Script for adding a map reveal trigger | ||
|
|
||
| // Using clauses. | ||
| // Unless you know what's in the WAE code-base, you want to always include | ||
| // these "standard usings". | ||
| using System; | ||
| using TSMapEditor; | ||
| using TSMapEditor.Models; | ||
| using TSMapEditor.CCEngine; | ||
| using TSMapEditor.Rendering; | ||
| using TSMapEditor.GameMath; | ||
| using TSMapEditor.UI.Windows; | ||
|
|
||
| namespace WAEScript | ||
| { | ||
| public class AddMapRevealTrigger | ||
| { | ||
| /// <summary> | ||
| /// Returns the description of this script. | ||
| /// All scripts must contain this function. | ||
| /// </summary> | ||
| public string GetDescription() => "This script will create a new map reveal trigger. Continue?"; | ||
|
|
||
| /// <summary> | ||
| /// Returns the message that is presented to the user if running this script succeeded. | ||
| /// All scripts must contain this function. | ||
| /// </summary> | ||
| public string GetSuccessMessage() | ||
| { | ||
| if (error == null) | ||
| return $"Successfully created a map reveal trigger with name \"{mapRevealTriggerName}\". You can locate it in the Triggers window."; | ||
|
|
||
| return error; | ||
| } | ||
|
|
||
| private string error; | ||
|
|
||
| private const string mapRevealTriggerName = "Map Reveal Trigger"; | ||
|
|
||
| /// <summary> | ||
| /// The function that actually does the magic. | ||
| /// </summary> | ||
| /// <param name="map">Map argument that allows us to access map data.</param> | ||
| public void Perform(Map map) | ||
| { | ||
| var trigger = new Trigger(map.GetNewUniqueInternalId()); | ||
| trigger.Name = mapRevealTriggerName; | ||
| trigger.HouseType = "Neutral"; | ||
|
|
||
| var timeElapsedCondition = new TriggerCondition(); | ||
| timeElapsedCondition.ConditionIndex = 13; | ||
| timeElapsedCondition.Parameters[0] = "0"; | ||
| trigger.Conditions.Add(timeElapsedCondition); | ||
|
|
||
| var mapRevealAction = new TriggerAction(); | ||
| mapRevealAction.ActionIndex = 16; | ||
| mapRevealAction.Parameters[0] = "0"; | ||
| trigger.Actions.Add(mapRevealAction); | ||
|
|
||
| map.AddTrigger(trigger); | ||
|
|
||
| map.AddTag(new Tag() | ||
| { | ||
| ID = map.GetNewUniqueInternalId(), | ||
| Name = trigger.Name + " (tag)", | ||
| Trigger = trigger, | ||
| Repeating = 0 | ||
| }); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.