not real familiar with custom scripting yet, but I'm looking to create/move unit X at say coordinates (A,B). Once that unit is created, i want to create/move unit Y to (A+4, B).
GlobalVariables:// create outside of trigger (no local variables)distance_X=0// integer variabledistance_Y=0// integer variableActions:General-Repeat(10)times// or use another loop actionUnit-CreateUnitofType(X)atpoint(A+distance_X,B+distance_Y)Variable-distance_X+4Variable-distance_Y+4
so if i start creating triggers, units, etc via script editor, do they show up in the gui?
Where do i define this? I can't really follow the logical flow by looking at the actual script editor. I would "expect" to see all variables defined, then functions, then other declarations, then the code body.
What you say makes easy sense, i just don't understand the "where" of defining this.
This will create units in range of X 100 and Y 100 offset by 4.
Those units won't show in Editor obviously as map script runs at runtime.
Create Unit = Spawn unit. You create new unit kinds in Data editor if that's what you mean
What's the difference between GUI script and galaxy script?
GUI , as name says (Graphic user interface), allows to "write" code via interface without really typing anything (more like clicking around). It's safer and more readable for beginners.
Galaxy script is code behind GUI. It can be viewed by clicking (in triggers editor) Data -> View script. You can also write code directly in Galaxy script in C-like syntax. For this refer to Galaxy tutorials
can you drect me to a tutorial that talks through loops? I"m having a difficult time translating my programming knowledge to the SC2 editor and galaxy script.
Generally GUI is refereed to as 'Triggers" and code as "Galaxy"
About the loops. Entire Galaxy as i mentioned is very C-like but with very limited functionality so loops are 'while'. There's no 'for' i believe. GUI says 'for' but in code behind it's actually while loop
something like
you can
point p = location of unit
real x = x of point p
real y = y of point p
real is GUI name for galaxy fixed
there's a lot of stuff like that. That's why you should use GUI - to learn API as it's quite user friendly. If you create for example variable of type <real> and try to assign something to it, in 'functions' section you have all functions with return type <real> categorized and mostly described
not real familiar with custom scripting yet, but I'm looking to create/move unit X at say coordinates (A,B). Once that unit is created, i want to create/move unit Y to (A+4, B).
How do i do this?
This should work - if not just tell me :P
so if i start creating triggers, units, etc via script editor, do they show up in the gui?
Where do i define this? I can't really follow the logical flow by looking at the actual script editor. I would "expect" to see all variables defined, then functions, then other declarations, then the code body.
What you say makes easy sense, i just don't understand the "where" of defining this.
Do you mean script in text form with "script editor" or the trigger GUI of the editor?
script in text.....really all i'm trying to do for now is (in somewhat psuedocode):
function create() {
put unit at x,y
put unit2 at x+4,y
put unit3 at x+8,y
}
Then a trigger that will call this function over and over when certain conditions happen. Basically i'm creating a room and moving it.
Well I never used galaxy script, so I guess I can't help you with that :(
The code I posted was GUI script.
maybe try it here
What's the difference between GUI script and galaxy script?
This - (random pic)
and
that - (random pic) :)
(Graphical User Interface (GUI)-Scripting and pure Text-Scripting)
Something like
This will create units in range of X 100 and Y 100 offset by 4.
Those units won't show in Editor obviously as map script runs at runtime.
Create Unit = Spawn unit. You create new unit kinds in Data editor if that's what you mean
can you drect me to a tutorial that talks through loops? I"m having a difficult time translating my programming knowledge to the SC2 editor and galaxy script.
Generally GUI is refereed to as 'Triggers" and code as "Galaxy"
About the loops. Entire Galaxy as i mentioned is very C-like but with very limited functionality so loops are 'while'. There's no 'for' i believe. GUI says 'for' but in code behind it's actually while loop
something like
slowly figuring this out. Can I also (for any point/unit) get the coordinates and assign the X and Y to separate variables?
you can
point p = location of unit
real x = x of point p
real y = y of point p
real is GUI name for galaxy fixed
there's a lot of stuff like that. That's why you should use GUI - to learn API as it's quite user friendly. If you create for example variable of type <real> and try to assign something to it, in 'functions' section you have all functions with return type <real> categorized and mostly described
@Nerfpl
// Variable Declarations
point lv_p;
fixed lv_d_x;
fixed lv_d_y;
// Variable Initialization
lv_p = PointFromId(25);
lv_d_x = x of p;
lv_d_y = y of p;
this errors out....maybe i'm taking what you say too literal
I"m ok with using the GUI until i get the hang of it...
edit: I defined these variables via the GUI and got the syntax error on the d_x and d_y initializations.
that's how it looks in galaxy
but you may skip lv_ part if you write in code. Is just for trigger editor to prevent global/local name collision (i guess that's the reason)
Thanks for all the help.
I am now able to generate units and continuously (and randomly) spawn them at multiple locations. Appreciate all the help