| 10-27-2003, 05:03 PM | #1 |
Okay, so I'm happily working away on a custom skill and I wonder: Is there a way to refer to a unit type, or atleast a unit variable in a unit enters range event trigger? I've been trying to find a way to get this to work for a while, with no luck. Any sugestions would be nice. |
| 10-27-2003, 05:07 PM | #2 |
there is an event called unit enters range. just make a trigger like this event- --unit enters range 700 of (whatever) condtition- --unit-type of triggering unit is equal to (whatever) action- --set close guy = triggering unit --run (name of the trigger you are trying to run when a unit is close and needs a variable) ignoring conditions also you should make the other trigger have no event or condition. should work. |
| 10-27-2003, 05:25 PM | #3 |
I know there is a unit enters range event, but the problem is this :) I can't set a variable inside that event for some reason. I can only select units on the map currently and that's no good, since the skill summosn the unit(s) that the enemies will be coming in range of. I have unit variables, unit-type variables, and unit group variables set but alas, it is to no avail since I have to be able to set a variable as the unit the range is set around in the first place. If I can't get this to work I'll just use an immolation base I guess... |
| 10-27-2003, 05:44 PM | #4 |
Go check out the post I started in the Trigger and Utility Repository... I did this to set up my Oil Patches... download the map and check the "Oil Initialization" trigger or the "Refinery Built" trigger in the "Resources" folder. EDIT: Here's a link to the thread: Trigger Examples for Newbs and Experts Alike |
| 10-27-2003, 08:56 PM | #5 |
i believe you could just use last created unit if you use trigger to summon the unit. as soon as you use the trigger to summon the unit than hit set variable = last created unit and it will set the summoned unit to a variable. if you are actaully summoing the unit with an ability you could just instead switch it to using trigger and that would solve everything. atleast iu think that it would. not 100% certain of what you are talking about. |
| 10-27-2003, 09:04 PM | #6 |
Supra, he's saying that the Trigger Event "Unit Within Range" doesn't allow you to use a variable, which is correct. The way around this, as illustrated in my example map, is to use the action "Trigger - Add Event" which will let you use a variable in the event. |
| 10-28-2003, 01:00 AM | #7 |
Or use Jass... |
| 10-28-2003, 05:25 AM | #8 |
Uh, even in JASS you can't use variables for that event... it's not just that WE won't let you, it's because the units stored in those variables aren't registered before that trigger event is registered. That's why you have to use the "Trigger - Add Event" If you meant use JASS to do the "Trigger - Add Event" then yes, you could do that, but why would you want to when you can do it with the GUI triggers? |
| 10-28-2003, 05:30 AM | #9 |
also you could create a trigger with no event at all and have it set the variable. than create another trigger that reads when unit enters range run the variable setting trigger ignoring all conditions. that would be an easy way to do it. |
