Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: [EUD Editor2] Detecting build queue tutorial
[EUD Editor2] Detecting build queue tutorial
Jul 27 2020, 9:01 pm
By: SkywinDragoon  

Jul 27 2020, 9:01 pm SkywinDragoon Post #1



This is using EUD Editor 2. If you don't have access to it yet, you should download EUD Editor 2 and ready it for use.

I want to make Protoss Dragoon (because it is my favorite unit) to produce Marine, and hopefully the trigger detects it and convert it into skill.

First of all, you will go to Firegraft to set up buttons.



You can click on the button list and press Ctrl + C to copy the button. Note that you must click on the string inside the button list.



Then you paste it on the button set of Protoss Dragoon. I adjusted few elements so the button is positioned properly.



I also changed the string "Train Marine" so it will tell exactly what this button is going to do.

After you are done with the Dragoon's button set, you have to make those buttons actually push Marine into Dragoon's build queue.

Let's tinker with the requirements, and marine's data.



This will alter the Marine's requirements to produce. It was originally written as "Current unit is Terran Barracks..." and so.
I will just check "Always Allow" for sake of convenience.


This is DatEdit. In here, you can to adjust Marine's supply requirement. I made it to 0 so it won't require any supply.


Also don't forget to do this! We all know this, but we always forget. (This is SCMdraft2 by the way)

Okay, at this point, Dragoon will be able to push Marine into his queue, but won't be able to actually produce marines, because Dragoon isn't building or Reaver/Carrier that can produce units.
The marine will be stuck indefinitely. And if you press the button five times, the queue will be full, and you won't be able to press it anymore.

What we'll gonna do is make trigger know Marine is in the Dragoon's queue, and do something about it.


Go to the Trigger Editor. You will see "Classic View", but you may want to change it into "Advanced View".


Load Function to import built-in functions. There are bunch of code that are commonly used, so people made "Functions" to use it frequently across different maps. It is same as export/importing triggers, but it is for EUD.
We will import BuildCheck.tfn which detects the build queue, and BuildReset.tfn which resets the build queue.


Select those two functions and import.


You will see actually three functions are imported but actually need all those three because BuildReset.tfn won't run without BuildResetEPD.tfn.

Now make New Global Variable by clicking the button I indicated.
This "Variable" will track the index of the unit (out of 1700 units) the trigger will keep track on its build queue.

You will notice, not every single dragoon won't be using the skill we just made. The one dragoon whose index is stored will be the only dragoon who is able to use the skill.



I will name the Global Variable "Hero". From now on when the trigger says "Hero" it means the index of the Dragoon that has to do with build queue.


Now we will make "onPluginStart" section. The finished trigger will look like this in this section.
I am using this part just for the sake of the simplicity of this tutorial.
This "onPluginStart" will only happen once, at the beginning of the game.
What I want to do is make the "Hero" variable store the index of the Dragoon.


The first part of the action is called "SetNextUnitPtr"
The variable you set in this action will hold the very next unit created after this action.
So what we want to do is add "Create Unit" action to create Dragoon.
This dragoon will be our hero using "the Lamest Skill Ever [L]".

The next part is for "beforeTriggerExec" this part is executed every trigger cycle, before executing the triggers in SCM2.
You can do this in "afterTriggerExec" as well, the only difference is they will execute after the executing the triggers in SCM2.
So far we don't have any triggers in SCM2, so either way is fine.



This part is complicated, so be sure to concentrate!

The first thing I added is ACTION called "EUD Turbo". This is same as turbo trigger (that involves lots of Wait(0); you know)
but speed is doubled. It will run once every frame of the game, which is 24 times per second.
I just added this because otherwise it will respond slowly. (You could just add classic turbo trigger instead of this)

The second thing you will see is IF STATEMENT. You can add one by clicking IF button on the left. Each IF STATEMENT acts just like a normal trigger.
except they don't have "Player" section. So I will avoid using Current Player because it won't do anything at all.

In the condition of the IF STATEMENT, you will see FUNCTION called "BuildCheck". FUNCTIONS can be added by using "함수(F)" button on the left side.
This function accepts only one variable, which will be "Hero". This basically checks the build queue of the unit "Hero", which is the Dragoon we will create when the game starts.

The very first action of the IF STATEMENT is FUNCTION called "BuildReset" This will reset whatever the unit has in its build queue.
Note that this will empty the whole queue. If your trigger is slow, this might be an issue. The issue would be like :"I Pressed the button three times but only happens once! "
But for now, I use EUD turbo that probably shouldn't matter.

The rest of the trigger could be whatever you want to make happen next. It's up to you.
What I did here is :
1. Move a location to the P1 Dragoon
2. Create P1 Carrier
3. Kill P1 Carrier
4. Kill P2 Zerglings in the moved location (kill zerglings nearby the dragoon)




You are done with the trigger. now compile it using either of these buttons. Those will practically do the same.

Now let's see what I just made....



Well that was lame.

The lamest skill ever!

I will attach files used in this tutorial so you can look into this.

Attachments:
BuildQueue.zip
Hits: 1 Size: 210.53kb

Post has been edited 1 time(s), last time on Jul 27 2020, 9:13 pm by SkywinDragoon.



None.

Jul 27 2020, 10:32 pm Ultraviolet Post #2



Cool tutorial, thanks for posting! I can definitely see this information coming in handy at some point for my projects.




Jul 28 2020, 9:09 am Oh_Man Post #3

Find Me On Discord (Brood War UMS Community & Staredit Network)

Dude, amazing, this is exactly what I needed. And a great resource for everyone wanting to learn this game-changing EUD feature. With this shuttle menus, dropship menus, and unit producing buildings are redundant!

Mods, give him minerals!

Would you be able to do a tutorial on detecting the cursor and being able to trigger effects off of the cursor, such as casting spells or clicking on text menus? That's another big game changeover because without EUDs the only equivalent is Dark Swarm or Disruption Web.




Jul 28 2020, 2:11 pm Ultraviolet Post #4



Can you crosspost your tutorial here so this topic doesn't get lost over time? Nice to have everything consolidated in one thread.




Jul 28 2020, 5:06 pm MTiger156 Post #5

Veteran Mapper

Here's another suggestion that somewhat ties with the initial example:
Mid-game changing of a unit's buttons?
By this, I mean changing the button set entirely via triggers, nothing to do with how Build / Advanced Build sub-menus work.



"It takes far more than a simple ideology to map amazing things. Mapping requires a strong passion for SC as well as an even stronger devotion to your work. Avoid instant gratification. Set directions/goals for the map, and stick to them. Take pride in the work, be patient with it, and never settle for less."
-Tiger

Jul 29 2020, 8:54 am Sie_Sayoka Post #6



Quote from Oh_Man
Dude, amazing, this is exactly what I needed. And a great resource for everyone wanting to learn this game-changing EUD feature. With this shuttle menus, dropship menus, and unit producing buildings are redundant!

Mods, give him minerals!

Would you be able to do a tutorial on detecting the cursor and being able to trigger effects off of the cursor, such as casting spells or clicking on text menus? That's another big game changeover because without EUDs the only equivalent is Dark Swarm or Disruption Web.
MSQC or order coordinate detection can detect the location of the cursor or right click respectively. Both have been posted about in the documentation thread.



None.

Jul 29 2020, 11:02 am Oh_Man Post #7

Find Me On Discord (Brood War UMS Community & Staredit Network)

Oh nice dude. I think I've got enough new techniques to try out now. Time to commit to my next project. :D




Aug 1 2020, 3:34 am Oh_Man Post #8

Find Me On Discord (Brood War UMS Community & Staredit Network)

Another tutorial that would be cool is how you can detect and display the player's username.

And how to make in-game music that is unaffected by lag.




Sep 8 2020, 2:50 pm lifebot Post #9



Ty




Sep 9 2020, 10:25 am Oh_Man Post #10

Find Me On Discord (Brood War UMS Community & Staredit Network)

Quote from MTiger156
Here's another suggestion that somewhat ties with the initial example:
Mid-game changing of a unit's buttons?
By this, I mean changing the button set entirely via triggers, nothing to do with how Build / Advanced Build sub-menus work.
I wanna know this too! Though I'd also just settle for knowing how to change the button text in-game with triggers.




Sep 9 2020, 3:26 pm lifebot Post #11



Quote from Oh_Man
Quote from MTiger156
Here's another suggestion that somewhat ties with the initial example:
Mid-game changing of a unit's buttons?
By this, I mean changing the button set entirely via triggers, nothing to do with how Build / Advanced Build sub-menus work.
I wanna know this too! Though I'd also just settle for knowing how to change the button text in-game with triggers.

iDoodler knows this. It's basically a EUD Trigger that sets the button sets




Sep 11 2020, 11:58 am Oh_Man Post #12

Find Me On Discord (Brood War UMS Community & Staredit Network)

Everything worked for me except now I can't figure out how to make a second unit have buttons. I have it rigged up to display text message "test" when you press a button.

On my first hero it works.

On my second hero, it's not working, the word "test" is appearing on map start, but then doesn't work after. Here is what my triggers look like. I am guessing I'm doing something wrong in the "onPluginStart" section.



Ok I have realised I don't need to create a Protoss Zealot and Terran Marine on game start now because I've done that in SCMDRAFT. But what I'm not understanding is how I get it to recognise that Hero_2 is a Corsair and Hero_1 is a Defiler. Where exactly do I set up that connection?

NVM: Figured it out.

Another thing that would be good to know is how to in-game change the icons to be greyed out or not. So changing the "requirements" tab section from "always" to "disabled" but doing so with triggers, not Firegraft. That way you can make it more clear to the player that spell/abilities are on cooldown.

Post has been edited 3 time(s), last time on Sep 11 2020, 1:06 pm by Oh_Man.




Sep 11 2020, 8:45 pm Oh_Man Post #13

Find Me On Discord (Brood War UMS Community & Staredit Network)

TUTORIAL TIME
CHANGING COMMAND CARD BUTTONS
Continuing from the information you learned from the custom command cards button tutorial, this tutorial will show you how to modify command card buttons in-game via triggers.

Here is my custom button in Firegraft.



First I copy the button data number (third red circle) and paste it for later in a notepad file.

When you change the button icon (first red circle), the button data code (third circle) changes. Same when you change the Character field (second red circle). The character field is the text your button shows, and the drop down menu shows all the button texts in the game. Simply modify one of those button texts (of a button you're never going to use) to the button you want your new button text to be. Now after changing the button image and button text, here is what my FireGraft looks like:



Note how the Button data numbers are now different? You want to copy that number and paste it for later. Get the other number (the one you want the button to be on game start) and paste it to reset the icon and text to the way you had it originally.

Now you close Firegraft and open the Trigger Editor. Here are my triggers.


For the purposes of this tutorial ignore everything except the bottom two triggers, and remembering what you learnt from the first tutorial.

What I have done here is set it up so that when I press the button, it changes from Gun Gauntlet to Flamethrower. When you press the button again, it changes back from Flamethrower to Gun Gauntlet. The action you need to do this is called SetButton.



SetButton is found in the EUD tab, it is an action. It has two parts "UnitBtn and BtnData". UnitBtn is which unit you are changing the buttons of. For me it is the Zerg Defiler, which is default selected. So what I have to do is click the drop-down arrow next to Zerg Defiler, and reselect Zerg Defiler. Then you see the list of buttons (Move, Twin Autocannons, Stop, etc.) for some reason my custom buttons are identified here only by their images (Twin Autocannons, Charon Boosters, and Burst Lasers) so remember that when trying to find your own custom buttons. So remember, for UnitBtn you have to select the unit AND the button you're changing.

BtnData is that big number you copied before. What you are pasting here is what you want the button to change INTO. So after selecting both of those, it now looks like this:



Now, in-game, you see I start with Gun Gauntlets.



I press Q, and it changes to Flamethrower!



So that's how you change buttons! With this information, you can create entire sub-menus by changing every single button on the command card, and making one of the buttons a cancel or back button. This is exactly what happens when you press "build" with an SCV, Drone, or Probe in the vanilla game!

GREYING OUT BUTTONS
This tutorial will teach you an easy way to grey out buttons. Greying out buttons has many uses. For instance, if your button is a spell, greying it out can easily show to the player that it's on cooldown, you're out of mana, etc. If the button is for a crafting system, it can be greyed out to show that you're missing a crafting ingredient, and so on.

I must stress this is only one way you can make buttons greyed out. There are other ways but I'm told this one is one of the most convenient.

First, open FireGraft and go to your custom button you want to grey out.

The red circle shows the Unavailable text. This is the text that appears when the player mouses over a button that is greyed out.

I have set up this tutorial to be that the button is greyed out when the map starts. The player has to stand on the beacon to make the button clickable. Hence why the unavailable text will say "Stand on the Beacon!"

Once you have done this, you will see three tabs. Unit information, button set, and requirements. Press requirements.


There are a bunch of tabs, but since my button is based off the Build Terran Marine button (see first tutorial) I have to select the Terran Marine. Change the requirements by clicking the "custom" option, bottom right of this window. Then, delete the requirements that are already there. In this example, I am making the requirement "Is researched... Irradiate." What this means is the button is greyed out until Irradiate has been researched by the player.

Now close FireGraft and open TriggerEditor. Here are my triggers:



For this we are focusing on the highlighted if-then trigger. How it works is if we bring a unit to the beacon, then we can press the button because Irradiate has been researched. We can modify researches, on and off, using the SetTech EUD action:



The SetTech EUD action has five variables. PlayerX, Techdata, UTType, Count, Modifier. PlayerX = which player you are giving or taking research. Techdata = which research is it (in this case, Irradiate). Uttype: Choose between Researched (button pressable) or Available/Empty (button greyed out (I think)). Count: not quite sure here, it could be for weapon upgrades, or maybe it's a binary 0=off, 1=on, but I set it to 1 and it works. Modifier = Set To, Add, Subtract. Now this is what mine looked like after:



Now, in-game, before I stand on the beacon, it looks like this:



And after:



So, in summary, you can toggle research on and off to turn buttons on and off. But I have one more important point:

BUTTONREFRESH
There is a EUD action called ButtonRefresh. If you don't use it in the above tutorials, you may notice the button does not change until you select a different unit then reselect the unit with the changed button. If you use the ButtonRefresh action after each time you modify a button (whether to change its image/text or grey or ungrey it out) it will refresh the graphic of the button instantly without having to unselect and reselect the unit. So it's an important action to remember!

Good luck mappers!

Post has been edited 1 time(s), last time on Sep 11 2020, 10:15 pm by Oh_Man.




Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[11:50 pm]
O)FaRTy1billion[MM] -- nice, now i have more than enough
[11:49 pm]
O)FaRTy1billion[MM] -- if i don't gamble them away first
[11:49 pm]
O)FaRTy1billion[MM] -- o, due to a donation i now have enough minerals to send you minerals
[2024-4-17. : 3:26 am]
O)FaRTy1billion[MM] -- i have to ask for minerals first tho cuz i don't have enough to send
[2024-4-17. : 1:53 am]
Vrael -- bet u'll ask for my minerals first and then just send me some lousy vespene gas instead
[2024-4-17. : 1:52 am]
Vrael -- hah do you think I was born yesterday?
[2024-4-17. : 1:08 am]
O)FaRTy1billion[MM] -- i'll trade you mineral counts
[2024-4-16. : 5:05 pm]
Vrael -- Its simple, just send all minerals to Vrael until you have 0 minerals then your account is gone
[2024-4-16. : 4:31 pm]
Zoan -- where's the option to delete my account
[2024-4-16. : 4:30 pm]
Zoan -- goodbye forever
Please log in to shout.


Members Online: lizethetyler