Overall useful though your dogmatic inclination towards while loops and condemnation of for loops is bothersome and has no legitimate grounds. Hence the name though, I guess...
Thank you for all the advice. Since every team had an AI, I ended up checking to see the number of allies the AI had every 5 seconds. If the number of allies was 0, the game would end.
Definitely works fine in this case.
In general it would be better style to check the condition only when a player leaves, so that you aren't running excessive periodic events (ofc in this case it doesn't matter like I said, but if you run into more complicated cases with large looping triggers running periodically ever .1 seconds you may notice some lagg issues, in which case you want to think about giving triggers events that only fire when they absolutely need to).
In addition you would a "cleaner feel" running the check on player leave because then it would happen instantly every game, whereas in this case it takes an apparently random amount of time between 0 and 5 seconds for victory to occur.
Yeah the limit is 50. Shapes 51 and onwards are not detectable with triggers. Like you I figured that out the hard way, haha. I should probably submit a bug report.
On that note, if you only use positive shapes in a region, the random point in region function never fails, even with 50 shapes. (At least, I've never seen it fail). Negative shapes, however, are the bane of that function.
Thanks Delta!
If you happen to check this again, or anyone else knows... Is there a maximum total number of regions in a map before trigger events stop firing? My map is getting a ton of regions and I'm getting worried now, heh.
I thought this is exactly what I did, I will make a very simple test of concept map tonight and make sure though.
Edit: Bloody hell, I made a super simple map with only this functionality and it worked... I must have gotten lost in the complexities of everything... Will try to see where I slipped up.
Edit 2: Found the difference!
When using a pass by reference parameter, the editor uses the function UnitRefFromVariable(string) as I stated in my OP, however Mille, you used the function UnitRefFromUnit. Could have just told me that haha...
Anyway, looks like this issue is solved! To any one else who wants to do "Variable unit enters variable region" triggers, it can certainly be accomplished, just make sure to use UnitRefFromUnit for the unit parameter to TriggerAddEventRegion.
You could set the custom value of the unit to something, say 72, whenever you kill it with a trigger.
Then, in your conditions for the Unit Dies trigger, make the first condition be Custom Value of Triggering Unit != 72. Then any units you kill with triggers will short circuit out of your Unit Dies trigger immediately and you won't get the errors.
I hate error messages like that though, many such error messages that I know don't matter have caused me to make changes in my maps to fix the error message in a way that ends up causing some obscure annoying actual problems down the road...
Then whenever a player leaves, remove them from the TeamXPlayers group. Finally, at the end of the player leaves trigger, call a CheckVictory action, which would do the following
It's been a while since I touched the original Dota, but in Dota 2 that's not how towers work. Towers will never switch targets until either the current target dies or goes out of range (exception: target reset trick). Towers prioritize heroes only if the hero is attacking the tower or allied units, otherwise they prioritize the closest unit.
Just a heads up in case you are trying to imitate dota-style towers accurately.
As to your question, I don't know much about battle mechanics in the editor, but I feel like there should be a combat priority field for each unit. If that doesn't allow you to get what you want done, then you could run some triggers to manually set the targets... Create a region, pick each tower in the game, center the region on the tower. Then loop through each unit in that region and perform logical checks to see which one should be the target, then order the tower to attack that unit.
I'm using the sound effect "RejuvinateEnergySound" in my map, when I previewed it in the editor it sounded cool, but in-game it sounds totally different - it's shorter and just lame. What have I done wrong? >_>
Thanks for the reply man.. kind of sad about that.
I guess it's ok for now, since the trigger condition check is super fast (1 <= triggering player <= 10), it just seems like really sloppy style and I can't understand why the editor wouldn't have a way to do this.
It seems the problem is in the function UnitRefFromVariable that the compiler automatically sticks in there, which ends up just being a null reference. Maybe there's some way to dynamically get an actual reference to the unit, and then it should work...
Edit: Solved, use TriggerAddEventUnitRegion(t, UnitRefFromUnit(u), r, flag) to accomplish this functionality. See attached map for a demo.
Hey, so I would like to create a trigger that functions essentially as follows:
Events: gv_unitvar enters gv_regionvar
Conditions: ...
Actions: ...
My current approach was to create a custom action definition called TriggerAddEventUnitRegion using the parameters from the native function in the archive, checking the native option, and then making the unit parameter passed by reference. Next, I created my function with the actions that I want to happen when the trigger fires. And finally, I created the trigger and called my action TriggerAddEventUnitRegion passing as a parameter my unit var and region var. However, the unit variable seems to be broken, it is being treated as null it seems (trigger is firing whenever Any Unit enters the region). I looked at the sciprt, the code that's being generated for the unit parameter is UnitRefFromVariable("gv_unitvar") - at first I was like "Oh that's a sweet function," but at the same time it's not working for me :/
I can't be the only one who has tried to do this, anyone got this working?
(Current shitty workaround: check condition after the trigger fires, but then I get a trigger firing possibly dozens of times a second when I really only want it to fire a few times per minute.)
Merging too many regions should be avoided because the resulting shapes will get more and more complex.
As an example, the random point in region function has a certain chance to fail and return 0,0 if the region shape is too complex. I dont have any experience with the unit enters region event and region merging, but I didnt notice any issues with it myself yet. That said, I cant remember combining 50 regions into one, ever.
If you can clearly reproduce the issue and prove that its related only to the amount of regions merged (or the complexity of the resulting shape) then I would suggest writing a detailed bug report for Blizzard.
It's very clearly directly a cause of the number of shapes... it's right around 50. Split up my regions into two regions (which was a pain in the ass) and it worked perfectly, literally changed nothing else.
I have this bug in my map where the trigger event "Unit Enters Region" just doesn't fire for the most recent shapes I added to a region. I spent hours trying to figure out what the hell is going on, finally I tried just taking those shapes out of the giant region of 50+ merged shapes, and viola, it works...???
Got no error message or anything when building the regions, it just stopped working? Is something else going on here or is this really how the editor works, and if so, wtf!?
I also tried to call it using a code directly rather than through the gui and it just gives a compiler error, haha. So weird, doesn't seem very useful.
Hey, I'm a relative novice in the data editor, so maybe this won't be helpful, but have you made sure are you sending a ModelSwap actor message to your unit somewhere?
0
Overall useful though your dogmatic inclination towards while loops and condemnation of for loops is bothersome and has no legitimate grounds. Hence the name though, I guess...
0
Definitely works fine in this case.
In general it would be better style to check the condition only when a player leaves, so that you aren't running excessive periodic events (ofc in this case it doesn't matter like I said, but if you run into more complicated cases with large looping triggers running periodically ever .1 seconds you may notice some lagg issues, in which case you want to think about giving triggers events that only fire when they absolutely need to).
In addition you would a "cleaner feel" running the check on player leave because then it would happen instantly every game, whereas in this case it takes an apparently random amount of time between 0 and 5 seconds for victory to occur.
0
@Diego6D: Go
Tomorrow I will try to whip up a quick example of what I'm talking about
0
Thanks Delta!
If you happen to check this again, or anyone else knows... Is there a maximum total number of regions in a map before trigger events stop firing? My map is getting a ton of regions and I'm getting worried now, heh.
0
@Mille25: Go
I thought this is exactly what I did, I will make a very simple test of concept map tonight and make sure though.
Edit: Bloody hell, I made a super simple map with only this functionality and it worked... I must have gotten lost in the complexities of everything... Will try to see where I slipped up.
Edit 2: Found the difference!
When using a pass by reference parameter, the editor uses the function UnitRefFromVariable(string) as I stated in my OP, however Mille, you used the function UnitRefFromUnit. Could have just told me that haha...
Anyway, looks like this issue is solved! To any one else who wants to do "Variable unit enters variable region" triggers, it can certainly be accomplished, just make sure to use UnitRefFromUnit for the unit parameter to TriggerAddEventRegion.
0
@Scythe1250: Go
You could set the custom value of the unit to something, say 72, whenever you kill it with a trigger.
Then, in your conditions for the Unit Dies trigger, make the first condition be Custom Value of Triggering Unit != 72. Then any units you kill with triggers will short circuit out of your Unit Dies trigger immediately and you won't get the errors.
I hate error messages like that though, many such error messages that I know don't matter have caused me to make changes in my maps to fix the error message in a way that ends up causing some obscure annoying actual problems down the road...
(I lol'd at Feederboard)
0
You could create player groups at initialization: Team1Players, and Team2Players with
Ditto for Team 2
Then whenever a player leaves, remove them from the TeamXPlayers group. Finally, at the end of the player leaves trigger, call a CheckVictory action, which would do the following
if Team1Players is empty ==> Team 2 Victory
if Team2Players is empty ==> Team1 Victory
0
It's been a while since I touched the original Dota, but in Dota 2 that's not how towers work. Towers will never switch targets until either the current target dies or goes out of range (exception: target reset trick). Towers prioritize heroes only if the hero is attacking the tower or allied units, otherwise they prioritize the closest unit.
Just a heads up in case you are trying to imitate dota-style towers accurately.
As to your question, I don't know much about battle mechanics in the editor, but I feel like there should be a combat priority field for each unit. If that doesn't allow you to get what you want done, then you could run some triggers to manually set the targets... Create a region, pick each tower in the game, center the region on the tower. Then loop through each unit in that region and perform logical checks to see which one should be the target, then order the tower to attack that unit.
0
I'm using the sound effect "RejuvinateEnergySound" in my map, when I previewed it in the editor it sounded cool, but in-game it sounds totally different - it's shorter and just lame. What have I done wrong? >_>
0
@SoulTaker916: Go
Thanks for the reply man.. kind of sad about that.
I guess it's ok for now, since the trigger condition check is super fast (1 <= triggering player <= 10), it just seems like really sloppy style and I can't understand why the editor wouldn't have a way to do this.
It seems the problem is in the function UnitRefFromVariable that the compiler automatically sticks in there, which ends up just being a null reference. Maybe there's some way to dynamically get an actual reference to the unit, and then it should work...
0
Edit: Solved, use TriggerAddEventUnitRegion(t, UnitRefFromUnit(u), r, flag) to accomplish this functionality. See attached map for a demo.
Hey, so I would like to create a trigger that functions essentially as follows:
Events: gv_unitvar enters gv_regionvar
Conditions: ...
Actions: ...
My current approach was to create a custom action definition called TriggerAddEventUnitRegion using the parameters from the native function in the archive, checking the native option, and then making the unit parameter passed by reference. Next, I created my function with the actions that I want to happen when the trigger fires. And finally, I created the trigger and called my action TriggerAddEventUnitRegion passing as a parameter my unit var and region var. However, the unit variable seems to be broken, it is being treated as null it seems (trigger is firing whenever Any Unit enters the region). I looked at the sciprt, the code that's being generated for the unit parameter is UnitRefFromVariable("gv_unitvar") - at first I was like "Oh that's a sweet function," but at the same time it's not working for me :/
I can't be the only one who has tried to do this, anyone got this working?
(Current shitty workaround: check condition after the trigger fires, but then I get a trigger firing possibly dozens of times a second when I really only want it to fire a few times per minute.)
0
It's very clearly directly a cause of the number of shapes... it's right around 50. Split up my regions into two regions (which was a pain in the ass) and it worked perfectly, literally changed nothing else.
0
I have this bug in my map where the trigger event "Unit Enters Region" just doesn't fire for the most recent shapes I added to a region. I spent hours trying to figure out what the hell is going on, finally I tried just taking those shapes out of the giant region of 50+ merged shapes, and viola, it works...???
Got no error message or anything when building the regions, it just stopped working? Is something else going on here or is this really how the editor works, and if so, wtf!?
0
I also tried to call it using a code directly rather than through the gui and it just gives a compiler error, haha. So weird, doesn't seem very useful.
0
Hey, I'm a relative novice in the data editor, so maybe this won't be helpful, but have you made sure are you sending a ModelSwap actor message to your unit somewhere?