HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Order detecting triggers

03-13-2004, 10:55 PM#1
Kaluo
Is there any condition or easy trigger to detect how far a unit is from a given point? 2 things i'm working on in my map right now are these.
1 - For reasons i'm not going to get into my hero has an ability based on firebolt that has 0 cooldown. However, with 0 cooldown you can set the spell to a million waypoints and just send one powerful firebolt with all your mana when you finally get in range. I can detect when this order is given but i need a way of detecting if the ordered unit is farther than the max range of the ability away from its target.

2 - A starcraft style nuke ability. I would create a graphic at target location of nuke just as the 6 casting time ability was begun. (unit begins casting ability doesnt work till these 6 seconds are over) Once again i could create a trigger to detect where the ability was cast, but then the graphic is displayed even if the unit is all the way across the screen and moving toward the location to cast. Any ideas anyone?
03-14-2004, 02:21 AM#2
volvo64
Create a unit group of "units within range xxx of casting unit" and if the ability is cast on a unit within that range then go ahead and cast it, otherwise cancel the order. That's my suggestion at least, it's kind of hard to tell what you're doing.
03-14-2004, 03:34 AM#3
Grater
For distance, use a real comparison.
ie:
Code:
(Distance between (Position of (Ordered unit)) and (Position of (Target unit of issued order))) Greater than 700.00
03-14-2004, 12:44 PM#4
Kamux
Try using the event: a unit starts the effect of an aibllity. This turns on when the abillty is actualy cast.
03-14-2004, 10:06 PM#5
Kaluo
Thanks grater, it worked great for problem 1. however number 2 isn't working for reasons im unaware of, take a look

Nuclear Strike
Events
Unit - A unit Is issued an order targeting an object
Conditions
(Issued order) Equal to (Order(inferno))
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of (Ordered unit)) Equal to Artillery Master
(Distance between (Position of (Ordered unit)) and (Target point of issued order)) Less than or equal to 900.00
Then - Actions
Cinematic - Ping minimap for (All players) at (Target point of issued order) for 6.00 seconds, using a Flashy ping of color (100.00%, 0.00%, 0.00%)
Game - Display to (All players) the text: ((|c00ff0000 + (Name of (Owner of (Ordered unit)))) + has begun to guide a nuke! you have 7 seconds to stop him!|r)
Special Effect - Create a special effect at (Target point of issued order) using Abilities\Spells\NightElf\TrueshotAura\TrueshotAura.mdl
Set Special_Effects[1] = (Last created special effect)
Wait 6.00 seconds
Special Effect - Destroy Special_Effects[1]
Else - Actions


If you understood that know also that the spell has a 900 cast range and that the order string for it is definitely inferno.
03-15-2004, 11:23 AM#6
Crossblade_XX
Im confused kaluo, are you using a regular order as a trigger for a spell? like move/attackmove/attack?

if at all possible, use a custom ability and an event - unit begins casting an ability trigger to do all that, you can still have all your point distance calculations, and ive never had a problem with a trigger-based spell of that nature.

ive never even considered using an order as a triggering event for a triggerbased spell.

try making a dummy spell that doesnt do anything, then make a trigger that goes
Nuclear Strike
Events
Unit - A unit Begins casting an abliity
Conditions
ability being cast is equal to (whatever your dummy spell is)
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of (triggering unit)) Equal to Artillery Master
(Distance between (Position of (triggering)) and (Target point of casting ability)) Less than or equal to 900.00
Then - Actions
Cinematic - Ping minimap for (All players) at (Target point of casting ablity) for 6.00 seconds, using a Flashy ping of color (100.00%, 0.00%, 0.00%)
Game - Display to (All players) the text: ((|c00ff0000 + (Name of (Owner of (triggering unit)))) + has begun to guide a nuke! you have 7 seconds to stop him!|r)
Special Effect - Create a special effect at (Target point of casting ability) using Abilities\Spells\NightElf\TrueshotAura\TrueshotAur a.mdl
Set Special_Effects[1] = (Last created special effect)
Wait 6.00 seconds
Special Effect - Destroy Special_Effects[1]
Else - Actions
do nothing


if you do exactly that trigger and it still doesnt work, i will be stumped because i dont see a syntax error or any conflicting actions within your trigger, so my only thinking is that maybe theres a problem with basing the event off of an order. so give it a shot and let me know how it works out