I want to spawn a wave when a unit passes through a few regions throughout the map. I put in debugs and the trigger is running but once it gets to the If statements it wont work. Why won't it spawn my units?
Here's what I have:
EventsUnit-AnyUnitEnters(Region(AnyRegion))LocalVariablesConditionsActionsTrigger-WaitforEasytoexecute,andWaituntilitcompletesDebug-Display"unit spawns trigger running "asdebugoutputusingType1,andDodisplayitinthegamewindowAI-StartthecampaignAIforallcomputerplayersAI-StartthecampaignAIforplayer15General-If(Conditions)thendo(Actions)elsedo(Actions)If((Triggeringunit)isinSpawnregion1)==TrueThenDebug-Display"spawn region 1 "asdebugoutputusingType1,andDodisplayitinthegamewindowTransmission-Sendtransmissionto(Allplayers)from(Odin[57.95,219.02]withFlash(DoNotoverrideportrait)playingTalk)playing(SoundlinkfromsoundIDTTychus01BriefingAdjutant00014atindexAnySoundIndex)withname"Warning"andmessage"Wave identified."using(CinematicportraitatCenterLeft)playingTalk(Add2.0seconds,Don'tWaituntilitfinishes)Region-Move(Triggeringregion)toPoint005General-Repeat(Actions)(3*(Numberofplayersin(ActivePlayers)))timesActionsUnit-Create1Marineforplayer15atSpawnpoint1facing270.0degrees(NoOptions)UnitGroup-Add(Lastcreatedunit)toSpawngroupUnit-OrderallunitsinSpawngroupto(AttacktargetingPoint004)(ReplaceExistingOrders)
I hope my memory is correct, because I'm not at home right now. Try to use a "Triggering Region = Spawn region1" Condition (Select your Event and look at the info at the bottom. If 'Triggering Region' is mentioned, then you can refer to this Region in your conditions). Use this instead of "Unit is in Region".
Maybe the Trigger doesn't like the fact that a unit ENTERS a region, but fires off before he is IN the region (sounds strange, but I had some problems with this kind of trigger, too. Try it out),
This event doesnt work.
Sadly there is no way of detecting if a unit enters any region at this time. (At least not that id know about)
You have to enter all possible regions manually, like
I dont know if thats a bug or intended by Blizzard, since (Region(Any Region)) compiles to "(null)" in Galaxy. This is interresting since stuff like "Any Unit" also compiles to null, so "null" seems to be an identifier for non-primitive data-types in Galaxy, meaning "Any" internally. Primitive data types, like ints, often use constants for "Any" (like "c_playerAny").
Use debug messages to find out where the trigger stops and continue working at that point.
As an example, its possible that
((Triggeringunit)isinSpawnregion1)==True
doesnt work right after entering the region, so you might replace that with "(Triggering Region) == Spawn region1".
However, this might not be the issue, im just guessing here. You know your own script the best.
You have a good point. However I tried both those things and it does the same thing. It seems it stops working at the if statement. Also, I made another trigger with the unit enters region and put trigger is on in the if statement. That seemed to make it work but it worked 8 times. I also really don't feel like trying to make like 20 triggers to make them all separate.
Well what I had to do is make 8 triggers, one for each region with the event unit enters region, and tell the main trigger to run if region 1 trigger is on. now the problem is that all of them are on for some reason so it spawns all the waves. I tried doing it when trigger is on = false but then none spawn.
Ok so now I separated all the spawns into 24 triggers :/ and now they spawn the way they should. however. now forsome reason it spawns one of my spawns when there are no units in my region so it shouldn't be spawning. it's only doing it with the one region.
Well, now it seems that's the only trigger working which is weird because no unit enters the region but when i enter another region it doesn't work.
Your problem is a little confusing, maybe you could post an updated version of the trigger you're working with. But, if when you say "the beginning" you mean at the start of your map, you should know that the Unit Enters Region triggers will fire for all units that are pre-placed on the map when the game starts. You can circumvent this by turning your trigger off, waiting like 1 second from map initialization, and then turning your trigger on.
Also, I never use "triggering unit is in region" to check which region is entered. Unfortunately the region code is just a little bit fallible, so you want to stick with functions and conditions that are very discrete and robust, so there is never room for error. Checking the triggering region is a better way to do this, as mentioned above.
EventsLocalVariablesConditions(Ownerof(Triggeringunit))!=(Player15from(Allplayers))ActionsTrigger-WaitforEasytoexecute,andWaituntilitcompletesAI-StartthecampaignAIforallcomputerplayersAI-StartthecampaignAIforplayer15General-If(Conditions)thendo(Actions)elsedo(Actions)If(spawnregion1ison)==TrueThenTransmission-Sendtransmissionto(Allplayers)from(Odin[57.95,219.02]withFlash(DoNotoverrideportrait)playingTalk)playing(SoundlinkfromsoundIDTTychus01BriefingAdjutant00014atindexAnySoundIndex)withname"Warning"andmessage"Wave identified."using(CinematicportraitatCenterLeft)playingTalk(Add2.0seconds,Don'tWaituntilitfinishes)Debug-Display"spawn region 1 "asdebugoutputusingType1,andDodisplayitinthegamewindowRegion-Move(Triggeringregion)toPoint005General-Repeat(Actions)(2*(Numberofplayersin(ActivePlayers)))timesActionsUnit-Create1Marineforplayer15atSpawnpoint1facing270.0degrees(NoOptions)UnitGroup-Add(Lastcreatedunit)toSpawngroupUnit-OrderallunitsinSpawngroupto(AttacktargetingPoint004)(ReplaceExistingOrders)General-Repeat(Actions)2timesActionsUnit-Create1Sentryforplayer15atSpawnpoint1facing270.0degrees(NoOptions)UnitGroup-Add(Lastcreatedunit)toSpawngroupGeneral-Repeat(Actions)(4*(Numberofplayersin(ActivePlayers)))timesActionsUnit-Create1Swarmlingforplayer15atSpawnpoint1facing270.0degrees(NoOptions)UnitGroup-Add(Lastcreatedunit)toSpawngroupUnit-OrderallunitsinSpawngroupto(AttacktargetingPoint004)(ReplaceExistingOrders)Else
Then I have a similar thing to the trigger above for all the regions. For some reason it is running them without a unit entering the region and i made sure no unit is in the regions.
Why do you turn off those triggers at map initialization? Just turn them off in the editor. Right-click the trigger and deselect "Initially On."
I'm a little confused by what you're doing with the code. I hope I won't just make things harder, but using Trigger Is On is not a good way to decide whether something is "unlocked." Use a global boolean variable. A trigger being on only means that it runs if its events are triggered; when off, a trigger can be run explicitly (using Run Trigger), but its events never trigger it. In my map Dark Deeds, I only ever use Trigger Is On to decide what state the game is in; for example, when my game ends and the credits are rolling, I turn off the Player Leaves trigger. In other triggers, I check for whether this trigger is off in order to enable special features - like the ability to declare war on all other players at once.
Lastly, keep in mind that a Unit Enters Region event triggers not only when a unit steps into a region, but also when it is created in that region. So if any units start in the region at the beginning of the game, they will trigger it.
I have made sure no units are in any of the regions even preplaced ones and i have a condition to make sure hostile units dont trigger it. I will try the variable though.
Oh. I think I may have figured it out. Should I Make a boolean for each region to = false. And then when they enter the region I set it to = true and then spawn the units when it = true.
I want to spawn a wave when a unit passes through a few regions throughout the map. I put in debugs and the trigger is running but once it gets to the If statements it wont work. Why won't it spawn my units?
Here's what I have:
New to the Editor? Need a tutorial? Click Here
Want data assets? Click Here
@fishy77: Go
I hope my memory is correct, because I'm not at home right now. Try to use a "Triggering Region = Spawn region1" Condition (Select your Event and look at the info at the bottom. If 'Triggering Region' is mentioned, then you can refer to this Region in your conditions). Use this instead of "Unit is in Region".
Maybe the Trigger doesn't like the fact that a unit ENTERS a region, but fires off before he is IN the region (sounds strange, but I had some problems with this kind of trigger, too. Try it out),
@Oatin: Go
I actually had that condition in before but it didn't work either.
New to the Editor? Need a tutorial? Click Here
Want data assets? Click Here
This event doesnt work. Sadly there is no way of detecting if a unit enters any region at this time. (At least not that id know about) You have to enter all possible regions manually, like
to make it work.
I dont know if thats a bug or intended by Blizzard, since (Region(Any Region)) compiles to "(null)" in Galaxy. This is interresting since stuff like "Any Unit" also compiles to null, so "null" seems to be an identifier for non-primitive data-types in Galaxy, meaning "Any" internally. Primitive data types, like ints, often use constants for "Any" (like "c_playerAny").
@Mille25: Go
Alright, I will try that. Maybe they will fix those things in arcade.
New to the Editor? Need a tutorial? Click Here
Want data assets? Click Here
@Mille25: Go
well, I tried this and it still wont create the units. yet the first debug still shows up like 8 times...
New to the Editor? Need a tutorial? Click Here
Want data assets? Click Here
Can anyone help me?
New to the Editor? Need a tutorial? Click Here
Want data assets? Click Here
I have no idea what to do for this to work.
New to the Editor? Need a tutorial? Click Here
Want data assets? Click Here
Use debug messages to find out where the trigger stops and continue working at that point.
As an example, its possible that
doesnt work right after entering the region, so you might replace that with "(Triggering Region) == Spawn region1". However, this might not be the issue, im just guessing here. You know your own script the best.
@Mille25: Go
You have a good point. However I tried both those things and it does the same thing. It seems it stops working at the if statement. Also, I made another trigger with the unit enters region and put trigger is on in the if statement. That seemed to make it work but it worked 8 times. I also really don't feel like trying to make like 20 triggers to make them all separate.
New to the Editor? Need a tutorial? Click Here
Want data assets? Click Here
@fishy77: Go
Well what I had to do is make 8 triggers, one for each region with the event unit enters region, and tell the main trigger to run if region 1 trigger is on. now the problem is that all of them are on for some reason so it spawns all the waves. I tried doing it when trigger is on = false but then none spawn.
New to the Editor? Need a tutorial? Click Here
Want data assets? Click Here
@fishy77: Go
Ok so now I separated all the spawns into 24 triggers :/ and now they spawn the way they should. however. now forsome reason it spawns one of my spawns when there are no units in my region so it shouldn't be spawning. it's only doing it with the one region.
Well, now it seems that's the only trigger working which is weird because no unit enters the region but when i enter another region it doesn't work.
New to the Editor? Need a tutorial? Click Here
Want data assets? Click Here
@fishy77: Go
Ok now I fixed the trigger wont run problem but now all the waves spawn at the beginning even though I have it at when unit enters region
New to the Editor? Need a tutorial? Click Here
Want data assets? Click Here
@fishy77: Go
Your problem is a little confusing, maybe you could post an updated version of the trigger you're working with. But, if when you say "the beginning" you mean at the start of your map, you should know that the Unit Enters Region triggers will fire for all units that are pre-placed on the map when the game starts. You can circumvent this by turning your trigger off, waiting like 1 second from map initialization, and then turning your trigger on.
Also, I never use "triggering unit is in region" to check which region is entered. Unfortunately the region code is just a little bit fallible, so you want to stick with functions and conditions that are very discrete and robust, so there is never room for error. Checking the triggering region is a better way to do this, as mentioned above.
@SkrowFunk: Go
Here's what I have currently. When the timer I have ends it turns the first spawn region on
Then i have this for each region:
Then finally it ends at this:
Then I have a similar thing to the trigger above for all the regions. For some reason it is running them without a unit entering the region and i made sure no unit is in the regions.
New to the Editor? Need a tutorial? Click Here
Want data assets? Click Here
@fishy77: Go
The current problem is with the triggers above all the waves spawn when the map starts without any unit entering a region.
New to the Editor? Need a tutorial? Click Here
Want data assets? Click Here
@fishy77: Go
Why do you turn off those triggers at map initialization? Just turn them off in the editor. Right-click the trigger and deselect "Initially On."
I'm a little confused by what you're doing with the code. I hope I won't just make things harder, but using Trigger Is On is not a good way to decide whether something is "unlocked." Use a global boolean variable. A trigger being on only means that it runs if its events are triggered; when off, a trigger can be run explicitly (using Run Trigger), but its events never trigger it. In my map Dark Deeds, I only ever use Trigger Is On to decide what state the game is in; for example, when my game ends and the credits are rolling, I turn off the Player Leaves trigger. In other triggers, I check for whether this trigger is off in order to enable special features - like the ability to declare war on all other players at once.
Lastly, keep in mind that a Unit Enters Region event triggers not only when a unit steps into a region, but also when it is created in that region. So if any units start in the region at the beginning of the game, they will trigger it.
@TrenchaunT: Go
I have made sure no units are in any of the regions even preplaced ones and i have a condition to make sure hostile units dont trigger it. I will try the variable though.
New to the Editor? Need a tutorial? Click Here
Want data assets? Click Here
@fishy77: Go
I made a boolean variable, but I have no idea what to do with it next :( i don't have much experience with these kinds of triggers.
New to the Editor? Need a tutorial? Click Here
Want data assets? Click Here
@fishy77: Go
Oh. I think I may have figured it out. Should I Make a boolean for each region to = false. And then when they enter the region I set it to = true and then spawn the units when it = true.
New to the Editor? Need a tutorial? Click Here
Want data assets? Click Here