Closed YakaryBovine closed 2 years ago
Hi, I have a question regarding this.
I couldn't find the c# equivalent of RescueNeutralUnitsInRect()
that is used in the vJASSversion.
Could you point me in the right direction on what to use here?
Yep. I haven't made a helper method for that one because it's a lot easier to do in C#. So I've been doing something like:
var unitsInRect = new GroupWrapper().EnumUnitsInRect(RECT).EmptyToList();
foreach (var unit in unitsInRect)
{
unit.Rescue(PLAYER);
}
That said, we should move away from this pattern. There's a problem with it; what happens if we happen to move another neutral unit into that area over the course of the game? We'll rescue it when we didn't intend to.
Check out the pattern here: https://github.com/AzerothWarsLR/WarcraftLegacies/blob/main/src/WarcraftLegacies.Source/Quests/Ironforge/QuestDarkIron.cs It puts all the units into a group when the Quest is made, then Rescues only the units in that group when the Quest is completed or failed. It also hides the non-building units to save users some CPU cycles.
Thanks I now implemented it this way. I am not sure on how to test that part of the quest though because there are no units in that area and I don't know how to place any for testing purposes.
There aren't? That's odd, there should be a bunch of archers... I'll check it out. Your changes look correct though so feel free to make the PR.
Recreate the following vJASS quest in C#. Note that this is actually 2 quests in one file. For the C# version we probably want 2 files. https://github.com/AzerothWarsLR/AzerothWarsLR/blob/master/jass/Quests/QuestScepterOfTheQueen.j