Hi, got a little problem that I could use some help with.
What I am trying to do is to is to detect when a (any unit) enters within a small area of a drop pod I create in another trigger. And I am using the event Unit - "Any Unit enters within 1.0 of Unit(/point)", but when I want to choose a unit variable I am unable to do just that. I am able to pick a unit already existing on the map, but that doesn't help me at all.
If anyone has an idea why I can't choose a unit from my unit variable in this trigger and could help me with my problem it would be greatly appreciated.
(P.S. my brain is barely functioning at the moment, I'm sure I have missed something obvious)
When you create the unit with the drop pod, you then have a line that looks like "Set variable [variable name] = (last created unit)", right? Well, is that variable defined locally, or globally?
What I mean is, if you created that variable at the beginning of the trigger that creates the drop-pod, then it's only available in that trigger, and disappears as soon as the trigger finishes. What you need to do is click over in the column on the left, the list of all your triggers, and create a variable over there. This is a global variable that's available for all triggers to use.
I also tried creating another map and pick a variable with that event, but it didn't work. It's also only that event that doesn't allow me to pick a unit variable, if I pick "unit dies" for example, I can pick a variable in the event.
When you choose the "Any Unit Enters a distance" event, in the text below, must be an explanation of what kind of variables you need to call to know what unit is each. Try to read it or post here what it says, I don't have the editor here.
For example: Triggering Unit (the unit that comes near), Target Unit (the static unit). Must be something like this...
Events are initialized at the start of the game.
This means that any variables used in an event are the values at the start. so if you would say: "Unit - Any Unit Enters a distance of 1.0 from MyUnitVariable" and the starting value of MyUnitVariable is a certain zealot on your map. When the variable changes its value the event will still trigger on that certain zealot and not the new value.
What you want to use is either an existing unit, conditions, or custom code to create the event on runtime.
I'm not sure I get what you mean. Maybe I haven't made myself clear enough. If I take the event Unit - Unit dies for example, I can set the unit to Droppod[1] (my variable) just fine. But when I use the event Unit - Any Unit a distance of 1.0 from Unit I want to set that unit to my Droppod[x], but I can't pick a unit variable in that certain event. Why is it different from the unit dies event?
I guess I could just do a work around with already having the pods in the game, but I'd rather not do that if I can avoid it.
The explanation says that I should use triggering player the get the unit that gets near, triggering player to get that owner of the unit, but my problem is in the event, not the trigger itself.
You could make a small circular region, and have the trigger that spawns the drop pod also attach the region to the unit. Then the event for your second trigger would be "unit enters region". It would only work for one drop pod at a time, though.
ok I'll try again: Let's assume that you can set a unit variable (which apparently you can't?)
You would get the following event: Unit - Any Unit enters within 1.0 distance of Droppod[1]
The default value of Droppod[1] is No Unit at the start of the game (I assume this). So basically what your event says at this moment is: Unit - Any Unit enters within 1.0 distance of No Unit
Now the sc2 engine will not look at the variable anymore since the event has been created during the map initialization. (this does not mean that the trigger has been run)
so when you change your Droppod[1] to Last Created Unit (Let's name the created unit: TerranDroppod), the game will NOT use the following event information: Unit - Any Unit enters within 1.0 distance of TerranDroppod
but instead it will use: Unit - Any Unit enters within 1.0 distance of No Unit
I hope that this will be a better explanation of what I posted earlier.
Ah yes, thanks for clarifying but then how does the Unit - Unit dies work then?
If I change the event to Unit - Droppod[1] dies wouldn't we have the same problem then? It would be Unit - No unit dies. And then it wouldn't change, and we would have the same problem? Then how come I can pick a variable for that event then?
And I assume there is no way to "update" the event?
Not sure what everyone's getting at... but your problem is probably of data types...
Unit - Any unit enters within X of (point) takes a point, so you cannot use a "unit". What you need to do is get the "point" or position of the unit. So instead of trying to put in your unit variable, use the function "get position of unit" (I think that's what it's called) and THEN, when it asks for the unit, you can put in your unit variable.
Unit - Any Unit Enters a distance of 1.0 from Unit
and
Unit - Any Unit Enters within 1.0 of Point
The first event takes a unit, not a point. I tried your way however, and even though I can get a variable in the way you said, I cannot get it to work. Great.
So I got lost in all the bizzare explanations what you were trying to do...
You want to be able to do "actions" when a unit enters within a certain range of a drop pod???
Is this drop pod a unit or a doddad?
Is there the possibility of being more than 1 drop pod
Assuming the pod is a unit and there will only be one you need this...
Event: Unit is created
Conditions: Unit type == Drop Pod
Actions: variable: MyDropPodHolderVariable == triggering unit
THEN, in your other trigger you need
Event: Unit Enters/Leaves Range Of Unit
Unit: Any Unit
State: Enters
Range: SomeRangeVariable
From Unit: MyDropPodHolderVariable (If this isn't a choice, check your variable type)
Conditions: !Make sure the unit is a valid unit cause this is going to fire every time ANY unit gets close to this drop pod
Actions: !Do Some Stuff
The first time you make this (or any trigger) put an action "Debug Msg" and have it output "Running Trigger (name of trigger) so that way you know the trigger is at least executing. Its a REALLY good practice, and anyone making maps should always do it.
Yes, it is a unit, yes there will be more then one doodad. I can get it work all the way except for one part:
•Event: Unit Enters/Leaves Range Of Unit - Check
•Unit: Any Unit - Check
•State: Enters - Check
•Range: SomeRangeVariable - Check
•From Unit: MyDropPodHolderVariable (If this isn't a choice, check your variable type) - I cannot choose the MyDropPodHolderVariable in the variable tab, no variable shows up at all in the list, I have several unit variables and none shows up. That's my problem.
Edit: If you get this to work yourself, any chance you could post a map with the working triggers so I could see them? Unless it's too much trouble, of course.
a (bad) workaround I can think of, are to stick actual circular regiongs in some corner of the map, assign them to the trigger, and then turn them off until you need each one, then move it and turn it on (attach it to the unit)...
a workaround that I use myself is I created an X amount of invisible units that take up no space at all. then I used these for the come into range trigger.
for you it would be possible to do the same, and when a droppod is spawned, you'd move this invisible unit to the droppod location instantly. and there ya go, a working event.
you could use an array which you keep looping through, and an X amount of invisible units equal to the maximum amount of droppods that are available at a single time.
another option would be custom scripting it. although I don't know the correct setup for the event.
Hi, got a little problem that I could use some help with.
What I am trying to do is to is to detect when a (any unit) enters within a small area of a drop pod I create in another trigger. And I am using the event Unit - "Any Unit enters within 1.0 of Unit(/point)", but when I want to choose a unit variable I am unable to do just that. I am able to pick a unit already existing on the map, but that doesn't help me at all.
If anyone has an idea why I can't choose a unit from my unit variable in this trigger and could help me with my problem it would be greatly appreciated.
(P.S. my brain is barely functioning at the moment, I'm sure I have missed something obvious)
@Devrak: Go
Probably because you are implementing your solution in an incorrect manner. If you would post your trigger we may be able to help.
When you create the unit with the drop pod, you then have a line that looks like "Set variable [variable name] = (last created unit)", right? Well, is that variable defined locally, or globally?
What I mean is, if you created that variable at the beginning of the trigger that creates the drop-pod, then it's only available in that trigger, and disappears as soon as the trigger finishes. What you need to do is click over in the column on the left, the list of all your triggers, and create a variable over there. This is a global variable that's available for all triggers to use.
KineMorto,
Will post up my trigger then, but I haven't really made much of the trigger yet since I can't get the event to work.
dgh64,
Nope, it's a global unit array variable, created it in the list to the left
My triggers are basically like this:
I also tried creating another map and pick a variable with that event, but it didn't work. It's also only that event that doesn't allow me to pick a unit variable, if I pick "unit dies" for example, I can pick a variable in the event.
@Devrak: Go
When you choose the "Any Unit Enters a distance" event, in the text below, must be an explanation of what kind of variables you need to call to know what unit is each. Try to read it or post here what it says, I don't have the editor here.
For example: Triggering Unit (the unit that comes near), Target Unit (the static unit). Must be something like this...
@Devrak: Go
Events are initialized at the start of the game.
This means that any variables used in an event are the values at the start. so if you would say: "Unit - Any Unit Enters a distance of 1.0 from MyUnitVariable" and the starting value of MyUnitVariable is a certain zealot on your map. When the variable changes its value the event will still trigger on that certain zealot and not the new value.
What you want to use is either an existing unit, conditions, or custom code to create the event on runtime.
@Helral: Go
I'm not sure I get what you mean. Maybe I haven't made myself clear enough. If I take the event Unit - Unit dies for example, I can set the unit to Droppod[1] (my variable) just fine. But when I use the event Unit - Any Unit a distance of 1.0 from Unit I want to set that unit to my Droppod[x], but I can't pick a unit variable in that certain event. Why is it different from the unit dies event?
I guess I could just do a work around with already having the pods in the game, but I'd rather not do that if I can avoid it.
@fr0d0b0ls0n: Go
The explanation says that I should use triggering player the get the unit that gets near, triggering player to get that owner of the unit, but my problem is in the event, not the trigger itself.
You could make a small circular region, and have the trigger that spawns the drop pod also attach the region to the unit. Then the event for your second trigger would be "unit enters region". It would only work for one drop pod at a time, though.
@dgh64: Go
Yeah, thought about that aswell. I will just have to make several regions I guess.
@Devrak: Go
ok I'll try again: Let's assume that you can set a unit variable (which apparently you can't?)
You would get the following event:
Unit - Any Unit enters within 1.0 distance of Droppod[1]
The default value of Droppod[1] is No Unit at the start of the game (I assume this). So basically what your event says at this moment is:
Unit - Any Unit enters within 1.0 distance of No Unit
Now the sc2 engine will not look at the variable anymore since the event has been created during the map initialization. (this does not mean that the trigger has been run)
so when you change your Droppod[1] to Last Created Unit (Let's name the created unit: TerranDroppod), the game will NOT use the following event information:
Unit - Any Unit enters within 1.0 distance of TerranDroppod
but instead it will use:
Unit - Any Unit enters within 1.0 distance of No Unit
I hope that this will be a better explanation of what I posted earlier.
@Helral: Go
Ah yes, thanks for clarifying but then how does the Unit - Unit dies work then?
If I change the event to Unit - Droppod[1] dies wouldn't we have the same problem then? It would be Unit - No unit dies. And then it wouldn't change, and we would have the same problem? Then how come I can pick a variable for that event then?
And I assume there is no way to "update" the event?
@Devrak: Go
Not sure what everyone's getting at... but your problem is probably of data types...
Unit - Any unit enters within X of (point) takes a point, so you cannot use a "unit". What you need to do is get the "point" or position of the unit. So instead of trying to put in your unit variable, use the function "get position of unit" (I think that's what it's called) and THEN, when it asks for the unit, you can put in your unit variable.
@Anthius: Go
There are two different events:
Unit - Any Unit Enters a distance of 1.0 from Unit and
Unit - Any Unit Enters within 1.0 of Point
The first event takes a unit, not a point. I tried your way however, and even though I can get a variable in the way you said, I cannot get it to work. Great.
Take it easy. Lets not get worked up yet...
So I got lost in all the bizzare explanations what you were trying to do...
You want to be able to do "actions" when a unit enters within a certain range of a drop pod???
Is this drop pod a unit or a doddad?
Is there the possibility of being more than 1 drop pod
Assuming the pod is a unit and there will only be one you need this...
THEN, in your other trigger you need
The first time you make this (or any trigger) put an action "Debug Msg" and have it output "Running Trigger (name of trigger) so that way you know the trigger is at least executing. Its a REALLY good practice, and anyone making maps should always do it.
Thanks for helping out Anthius.
Yes, it is a unit, yes there will be more then one doodad. I can get it work all the way except for one part:
•Event: Unit Enters/Leaves Range Of Unit - Check •Unit: Any Unit - Check •State: Enters - Check •Range: SomeRangeVariable - Check •From Unit: MyDropPodHolderVariable (If this isn't a choice, check your variable type) - I cannot choose the MyDropPodHolderVariable in the variable tab, no variable shows up at all in the list, I have several unit variables and none shows up. That's my problem.
Edit: If you get this to work yourself, any chance you could post a map with the working triggers so I could see them? Unless it's too much trouble, of course.
Ahh, Helral answers your question... I did not know that about the SC2 engine... that's unfortunate...
Good to know, I hadn't read through all the responses... my bad.
It looks like this isn't possible without using custom scripts.
@Anthius: Go
Cheers.
@Anthius: Go
Ah yes, as I thought. :) Thanks for trying to help though, I'll find another, more.. complicated way of doing it instead.
a (bad) workaround I can think of, are to stick actual circular regiongs in some corner of the map, assign them to the trigger, and then turn them off until you need each one, then move it and turn it on (attach it to the unit)...
a workaround that I use myself is I created an X amount of invisible units that take up no space at all. then I used these for the come into range trigger.
for you it would be possible to do the same, and when a droppod is spawned, you'd move this invisible unit to the droppod location instantly. and there ya go, a working event.
you could use an array which you keep looping through, and an X amount of invisible units equal to the maximum amount of droppods that are available at a single time.
another option would be custom scripting it. although I don't know the correct setup for the event.