HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Unit - Unit Within Range

07-16-2003, 08:00 AM#1
element_5
I'm working on setting up a new resource (oil) and I've got everything down except the event I need for when the worker returns to the drop off point. Unit - Unit Within Range would work great if I could use a unit variable with it instead of only pre-placed structures. Anyone know how I can get this working? Here is the trigger that works, but can only use pre-placed structures :(

Code:
Return Oil
    Events
        Unit - A unit comes within 250.00 of Town Hall (WC2) 0002 <gen>
    Conditions
        ((Entering unit) is in ugrHasOil) Equal to True
    Actions
        Game - Display to (All players) the text: Entered Region
        Unit Group - Remove (Triggering unit) from ugrHasOil
        Animation - Remove the gold animation tag to (Triggering unit)
        Set intOilAmt = (intOilAmt + 100)
        Trigger - Run Update Mutiboard <gen> (ignoring conditions)
07-16-2003, 09:35 AM#2
Download
Theres no direct way for it, but theres a way around it. Create a invisible unit on the spot where the to-be-created unit will be, and select that one as the indicator. That way when the building is created, you still point to the invisible unit which is in the center of it.
07-16-2003, 10:02 AM#3
element_5
There would still be the problem of not being able to select anything but pre-placed units.
07-16-2003, 10:19 AM#4
Download
No because you preplace the invisible unit.
07-16-2003, 10:38 AM#5
element_5
I can't pre-place the unit correctly if I don't know where the player is going to build his refineries. If you meant pre-place the unit and then move it to the building, it's a good idea, I'll go try it :D

EDIT: It worked! Another big roadblock to my TC has been breached :ggani:
07-16-2003, 10:56 AM#6
Sen
You can do this without jass, but it would be much better WITH jass, as you can cleanup after yourself if a building dies or what not.

Without Jass:

Use the blizzard editor's "create event for trigger" action. Create a new event each time a new building is created of that type. Problem solved, but it will leave "hanging" events and is just generally not an elegant solution... more of a quick hack.

With Jass:

Create a new trigger with each one and destroy the trigger with tracking triggers (maybe use an array and a unit group) so that you only have triggers running with the events for the buildings you have.