What exactly is the difference between removing items and using the fog of war performance wise? Objects that are not visible on the screen are not rendered by your graphics card at all and the fog of war can remove all non-terrain objects from the screen, thus prevent them from being rendered. You can set structures to not display within the fog of war and I assume the same could be done to doodad objects.
I'm just trying to clarify exactly what it is you're trying to do that requires extra work.
@Nevir24:
I tried using a const int inside of my a record variable and errors popped up. -.-' The error was something like "The variable is not a record type". I swear, there are so many bugs with records. It works fine when const isn't checked, you just have to remember to never change the value anywhere.
@Mille25:
Yeah, it's possible inside of galaxy script. I'm considering doing it this way so that if someone changes the value of MAX_PLAYERS, the array size is automatically updated and you don't have to change both the array size and the constant value. I assume that it's not allowed in the GUI because the declarations of variables, triggers, and actions are non-linear. Adding this feature would add some form on linearity to it (you must set the constant before you set the array size). There's no way for the compiler to know at what point the constant is declared (at initialization or within a trigger or wherever). I agree though, it'd be nice to allow array sizes to be declared with a variable.
The "allow multiple" behavior has been acting wonky for me. Even with only one parameter and having "allow multiple" enabled on it, I'll receive compiler errors if there are more than 1 parameters calling the action definition. But yes, even if I can get rid of this compiler error ("Script failed to compile: Wrong number of parameters"), it's not intuitive at all how to access the various parameters.
I attempted to use the advice in that thread and make a custom function such that:
voidgf_addPoints(pointlp_points,...)//and similar calls like this
I believe the ", ..." is how it's done in C, but it didn't work here with a compiler error on that line. :( I wish I could look at the "combine multiple text" galaxy code for myself to see how it's done.
I was figuring I'd need to resort to what you've said, but I figure if it were possible to do a [].size() or similar, it wouldn't hurt. The magic numbers that I'd get rid of are in for loops, ex:
for (i=0; i+=1; i<12). The magic number, obviously, being 12 that could be replaced with MAX_PLAYERS.
Is there any way to find the size of an array through a trigger? I tried making a custom script of:
gv_array.size()
but it didn't work. :( I'm basically trying to do this for future debugging concerns with "catching" exception and also to get remove some of magic numbers, so I'd prefer not making a variable if I can get away with it, otherwise, magic numbers and strange looking default error messages it is.
Use an Issue Order command and select the opening parenthesis for the "Select Ability" field and change it to "Use ability at point". The unit training abilities should be somewhere in there.
I'm not looking at the editor atm, so the names may be slightly off.
I wanted to point out that you're not using the And condition correctly in the Train Marine trigger of this tutorial. The way you have it set up in the video:
if ((UnitGetOwner(EventUnitProgressUnit()) == 1) && ((UnitGetType(EventUnitProgressUnit()) == "Barracks") &&))
Notice the '&&' at the very end. This is the 'And' that is in your trigger and it is automatically removed from the script. When there are multiple statements in a condition clause, such as in your trigger, the script automatically puts an '&&' between them, thus the first '&&' in the Galaxy statement above. Because of this, you end up getting your desired effect from the trigger, even though it's implemented incorrectly. It's a good thing you weren't wanting to use an Or statement, otherwise it wouldn't have worked out for you. :) If you want to use the 'And' statement correctly, here's how it should look:
You may decide to use the above for readability purposes, but since you know that '&&' is added automatically between conditions, you also have the option to simplify the condition to:
In case what s3rius said didn't clear it up, I'll anaylze his custom script of "lv_ability_command[lv_tempInteger]" that you would place in the Select Ability Command portion of the action.
"lv_": "lv_" (either one of them) can either be "lv_" (local variable), "gv_" (global variable), or "lp_" (local parameter), which designates where the variable is located.
"ability_command": To find the value that belongs here, select your array variable and look for "Script Identifier:" The value listed here should replace "ability_command".
"tempInteger": This is the integer variable that refers to the index of your array. Find the name you need for the custom script in the same way as "ability_command". You can replace "lv_tempInteger" with an integer value, such as "0", if desired.
Here's 2 scenarios, one where you can only use a point and one where you can only use a region:
1) region: Find the number of units within a region. It's impossible to find the number of units in a point since there is a cap of 1 unit per point allowed.
2) point: Tell the AI to cast an ability at a specific location. If you try to Issue an order targeting a region, that's a lot of room for error.
Sure, there are a lot of things can be done with either a point or a region, such as "create a unit at location", but there are also a lot of things that make them distinct.
It sounds like an error in one of your effects. Look for a "Target - Impact Location +" is set to either "Source Unit", "Source Point", or "Source Unit/Point". You want to change the field value to "Target Point". Looking at the actual Raven ability:
1) Launch Missile effect is set to Target Unit
2) Create Unit effect is set to Target Point
Someone told me the map I am making is a DotA-ripoff, but I had never played DotA before.... I ended up playing a game of it just to see and he was right (to my dismay). 3 paths leading to the enemy base, waves of mobs fighting each other. Oh well.
I hope your map and my Cerebrates map don't step on each others toes when July 27th hits!
If I understand your trigger correctly, I'm not exactly sure why you need a trigger to needlessly proc every second. Though maybe there's more to it that I don't know about. I *think* if a unit dies within a region, a "unit leaves region" event is procced, but I could be mistaken, so I'd test it before taking my word on it. The following 2 global variables and 2 triggers should switch the ownership of a region when one player has more units than the current owner of the region without proccing the trigger once every 1.0 seconds.
GlobalVariables:NumOfUnitsInRegion[X]={0,0...}// Adjust 'X' to the number of playersCurrentRegionOwner=0// '0' denotes player 1
EventsUnit-AnyUnitEnters<Region>LocalVariablesConditionsActionsSetNumOfUnitsInRegion[((Triggeringplayer)-1)] = (NumOfUnitsInRegion[((Triggeringplayer)-1)] + 1)
General - If (Conditions) then do (Actions) else do (Actions)
If
And
((Triggering player) - 1) != CurrentRegionOwner
NumOfUnitsInRegion[CurrentRegionOwner]< NumOfUnitsInRegion[((Triggeringplayer)-1)]ThenCurrentRegionOwner =((Triggeringplayer)-1)Else
EventsUnit-AnyUnitLeaves<Region>LocalVariablesPlayerNum=0ConditionsActionsSetNumOfUnitsInRegion[((Triggeringplayer)-1)] = (NumOfUnitsInRegion[((Triggeringplayer)-1)] - 1)
General - If (Conditions) then do (Actions) else do (Actions)
If
((Triggering player) - 1) == CurrentRegionOwner
Then
//Adjust "X" to the number of players in your map below
For each integer PlayerNum from 0 to X with increment 1, do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
NumOfUnitsInRegion[CurrentRegionOwner]< NumOfUnitsInRegion[PlayerNum]ThenCurrentRegionOwner =PlayerNumElseElse
Thanks for creating this thread, Zero. I'm able to remove a bug from my map that I was planning on looking into later, but now I have an answer right here instead. (In about 10% of my maps, one of the two bases would spontaneously stop building, pretty major bug that doesn't happen consistently.) This thread made me realize that I wasn't removing the Drone from the worker group, which I assume selecting a Drone that is already building a structure caused the bug.
God I feel stupid for bringing up this thread now. Apparently a Nydus Network is a requirement for the Summon Nydus Worm ability. Alls I have to do is remove the requirement from the ability. -.-' Marines don't have a Barracks requirement in the Train Marine ability, why does the Summon Nydus Worm have a Nydus Network requirement? :-/ I swear I was trying to figure it out for over an hour and the solution is ultra easy.
0
What exactly is the difference between removing items and using the fog of war performance wise? Objects that are not visible on the screen are not rendered by your graphics card at all and the fog of war can remove all non-terrain objects from the screen, thus prevent them from being rendered. You can set structures to not display within the fog of war and I assume the same could be done to doodad objects.
I'm just trying to clarify exactly what it is you're trying to do that requires extra work.
0
@Nevir24: I tried using a const int inside of my a record variable and errors popped up. -.-' The error was something like "The variable is not a record type". I swear, there are so many bugs with records. It works fine when const isn't checked, you just have to remember to never change the value anywhere.
@Mille25: Yeah, it's possible inside of galaxy script. I'm considering doing it this way so that if someone changes the value of MAX_PLAYERS, the array size is automatically updated and you don't have to change both the array size and the constant value. I assume that it's not allowed in the GUI because the declarations of variables, triggers, and actions are non-linear. Adding this feature would add some form on linearity to it (you must set the constant before you set the array size). There's no way for the compiler to know at what point the constant is declared (at initialization or within a trigger or wherever). I agree though, it'd be nice to allow array sizes to be declared with a variable.
0
@SiNiquity: Go
The "allow multiple" behavior has been acting wonky for me. Even with only one parameter and having "allow multiple" enabled on it, I'll receive compiler errors if there are more than 1 parameters calling the action definition. But yes, even if I can get rid of this compiler error ("Script failed to compile: Wrong number of parameters"), it's not intuitive at all how to access the various parameters.
I found s3rius reply on custom triggers in this thread: http://forums.sc2mapster.com/development/map-development/3788-where-to-write-scripts-when-using-editor/
I attempted to use the advice in that thread and make a custom function such that:
I believe the ", ..." is how it's done in C, but it didn't work here with a compiler error on that line. :( I wish I could look at the "combine multiple text" galaxy code for myself to see how it's done.
0
I was figuring I'd need to resort to what you've said, but I figure if it were possible to do a [].size() or similar, it wouldn't hurt. The magic numbers that I'd get rid of are in for loops, ex:
for (i=0; i+=1; i<12). The magic number, obviously, being 12 that could be replaced with MAX_PLAYERS.
edit: The "+ +" (no space) markup is annoying.
0
Is there any way to find the size of an array through a trigger? I tried making a custom script of:
gv_array.size()
but it didn't work. :( I'm basically trying to do this for future debugging concerns with "catching" exception and also to get remove some of magic numbers, so I'd prefer not making a variable if I can get away with it, otherwise, magic numbers and strange looking default error messages it is.
0
Use an Issue Order command and select the opening parenthesis for the "Select Ability" field and change it to "Use ability at point". The unit training abilities should be somewhere in there.
I'm not looking at the editor atm, so the names may be slightly off.
0
I wanted to point out that you're not using the And condition correctly in the Train Marine trigger of this tutorial. The way you have it set up in the video:
What this is saying in Galaxy is:
if ((UnitGetOwner(EventUnitProgressUnit()) == 1) && ((UnitGetType(EventUnitProgressUnit()) == "Barracks") &&))
Notice the '&&' at the very end. This is the 'And' that is in your trigger and it is automatically removed from the script. When there are multiple statements in a condition clause, such as in your trigger, the script automatically puts an '&&' between them, thus the first '&&' in the Galaxy statement above. Because of this, you end up getting your desired effect from the trigger, even though it's implemented incorrectly. It's a good thing you weren't wanting to use an Or statement, otherwise it wouldn't have worked out for you. :) If you want to use the 'And' statement correctly, here's how it should look:
You may decide to use the above for readability purposes, but since you know that '&&' is added automatically between conditions, you also have the option to simplify the condition to:
0
@PepperLoaT: Go
In case what s3rius said didn't clear it up, I'll anaylze his custom script of "lv_ability_command[lv_tempInteger]" that you would place in the Select Ability Command portion of the action.
"lv_": "lv_" (either one of them) can either be "lv_" (local variable), "gv_" (global variable), or "lp_" (local parameter), which designates where the variable is located.
"ability_command": To find the value that belongs here, select your array variable and look for "Script Identifier:" The value listed here should replace "ability_command".
"tempInteger": This is the integer variable that refers to the index of your array. Find the name you need for the custom script in the same way as "ability_command". You can replace "lv_tempInteger" with an integer value, such as "0", if desired.
0
You'll need to turn the Stimpack ability from type "Effect - Instant" to "Effect - Target" in order to get your medic to cast Stimpack on others.
0
Here's 2 scenarios, one where you can only use a point and one where you can only use a region:
1) region: Find the number of units within a region. It's impossible to find the number of units in a point since there is a cap of 1 unit per point allowed.
2) point: Tell the AI to cast an ability at a specific location. If you try to Issue an order targeting a region, that's a lot of room for error.
Sure, there are a lot of things can be done with either a point or a region, such as "create a unit at location", but there are also a lot of things that make them distinct.
0
It sounds like an error in one of your effects. Look for a "Target - Impact Location +" is set to either "Source Unit", "Source Point", or "Source Unit/Point". You want to change the field value to "Target Point". Looking at the actual Raven ability:
1) Launch Missile effect is set to Target Unit 2) Create Unit effect is set to Target Point
0
Someone told me the map I am making is a DotA-ripoff, but I had never played DotA before.... I ended up playing a game of it just to see and he was right (to my dismay). 3 paths leading to the enemy base, waves of mobs fighting each other. Oh well.
I hope your map and my Cerebrates map don't step on each others toes when July 27th hits!
0
If I understand your trigger correctly, I'm not exactly sure why you need a trigger to needlessly proc every second. Though maybe there's more to it that I don't know about. I *think* if a unit dies within a region, a "unit leaves region" event is procced, but I could be mistaken, so I'd test it before taking my word on it. The following 2 global variables and 2 triggers should switch the ownership of a region when one player has more units than the current owner of the region without proccing the trigger once every 1.0 seconds.
0
@Zero0018: Go
Thanks for creating this thread, Zero. I'm able to remove a bug from my map that I was planning on looking into later, but now I have an answer right here instead. (In about 10% of my maps, one of the two bases would spontaneously stop building, pretty major bug that doesn't happen consistently.) This thread made me realize that I wasn't removing the Drone from the worker group, which I assume selecting a Drone that is already building a structure caused the bug.
0
God I feel stupid for bringing up this thread now. Apparently a Nydus Network is a requirement for the Summon Nydus Worm ability. Alls I have to do is remove the requirement from the ability. -.-' Marines don't have a Barracks requirement in the Train Marine ability, why does the Summon Nydus Worm have a Nydus Network requirement? :-/ I swear I was trying to figure it out for over an hour and the solution is ultra easy.