HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

I need help on figuring distance

07-24-2004, 05:31 AM#1
evilprogrammer
i want to create a spell called early warning. and i need help. i dont know how to make it check how fark Hostile unites are from the hero.

the ability is going to show a green ! above the heros head. and if hostile enemies are close it turns yellow. then when there close it turns red.

i dont know how to make it check distances PLEASE HELP
07-24-2004, 08:42 AM#2
SpadeZ
Well its not actually a case of the hero checking the distance, but the game checking it. You have to create regions around the hero. I suggest 2 regions around the hero. Set them both to different variables. Then make 2 triggers that identify when a unit enters one of the regions. Then u need another 2 triggers to identify when a unit leaves a region and how many units within each region, inorder to turn the "!" back to green. This is just a brief overview. It might be a bit complicated than what i have said, but its close enough.

Hope this helps.
07-24-2004, 02:57 PM#3
evilprogrammer
Quote:
Originally Posted by SpadeZ
Well its not actually a case of the hero checking the distance, but the game checking it. You have to create regions around the hero. I suggest 2 regions around the hero. Set them both to different variables. Then make 2 triggers that identify when a unit enters one of the regions. Then u need another 2 triggers to identify when a unit leaves a region and how many units within each region, inorder to turn the "!" back to green. This is just a brief overview. It might be a bit complicated than what i have said, but its close enough.

Hope this helps.

thanks for the hellp. but i have a question about that

will the regions follow my hero? o_O

or do i have to make it, if so how?
07-24-2004, 03:01 PM#4
Fladian
Isn't it easier to use the Event 'Target Unit comes in range of Target unit'? With a condition meant for Hostile units?
07-24-2004, 03:19 PM#5
evilprogrammer
Quote:
Originally Posted by Fladian
Isn't it easier to use the Event 'Target Unit comes in range of Target unit'? With a condition meant for Hostile units?

hmmm... sounds like it might work, ill check it out thanks
07-24-2004, 03:39 PM#6
evilprogrammer
Quote:
Originally Posted by evilprogrammer
hmmm... sounds like it might work, ill check it out thanks

cant find a trigger that classifies a unit as hostile (enemy players AND creeps) :(
07-24-2004, 03:44 PM#7
Fladian
Events
Unit - A unit comes within 256.00 of Footman 0000 <gen>
Conditions
(Unit-type of Footman 0000 <gen>) Equal to (Random level 1 creep unit-type)
Actions

I think this should work... excluding the action of course.
07-24-2004, 03:49 PM#8
evilprogrammer
Quote:
Originally Posted by Fladian
Events
Unit - A unit comes within 256.00 of Footman 0000 <gen>
Conditions
(Unit-type of Footman 0000 <gen>) Equal to (Random level 1 creep unit-type)
Actions

I think this should work... excluding the action of course.


would this work for enemy units (player 1 player 2 on aand so on?
07-24-2004, 03:51 PM#9
Fladian
No, this only worked for 1 unit... err... sorry, I guess I thought it was for 1 unit only :(
07-24-2004, 03:54 PM#10
evilprogrammer
Quote:
Originally Posted by Fladian
No, this only worked for 1 unit... err... sorry, I guess I thought it was for 1 unit only :(

tsall right, it might not even be possible..... :>

but it would realy come in handy in one of my maps
07-24-2004, 03:55 PM#11
Fladian
I'm sure it is possible but I got a feeling it just slipped my mind... Oh well, more things seem to slip my mind :P

Sorry anyway
-Fladian
07-24-2004, 03:58 PM#12
evilprogrammer
Quote:
Originally Posted by Fladian
I'm sure it is possible but I got a feeling it just slipped my mind... Oh well, more things seem to slip my mind :P

Sorry anyway
-Fladian

if u get any ideaaas about hot to go about doing this, please post !!! ^_^
07-24-2004, 04:11 PM#13
Shimrra
A slight revamp of Fladian's triggers:

Code:
Fladian's Trigger: Revamped
    Events
        Unit - A unit comes within 256.00 of Hero
    Conditions
        ((Triggering unit) belongs to an enemy of (Owner of Hero)) Equal to True
    Actions
07-24-2004, 04:19 PM#14
Fladian
But Shimrra, that only works for 1 hero, right? Or does it work for all heroes right away?
07-24-2004, 04:21 PM#15
evilprogrammer
ill try it out, and see what it looks like thanks !