HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Orbs and auto-acquire workarounds

01-08-2007, 06:15 PM#1
NmdSnprEnigma
So my problem isn't a huge one, but it runs like this. Working primarily in GUI, I'm using three different orbs to put three different poisons, all of which stack. They orbs don't work when the target auto-acquires, but we know that. Separately, I use this to limit the range of my units.

Code:
Events - Unit is Attacked
Conditions - Attacking Unit is Structure = true
Actions - 
If number of units within TowerRange of Attacking unit matching CondX equal to 0 then
    order attacking unit to stop
elseif distance between attacking unit and attacked unit is greater than TowerRange then
        order attacking unit to right click first unit matching CondX
    else 
        order Attacking unit to right click attacked unit

So essentially every time a unit gets attacked by a tower, it is because of a right click, which is what I want. The orbs work then because it's not auto-acquiring. Problem is this: never on the first shot. The orbs work on the second and subsequent hits, but not the first one. Any thoughts?
01-09-2007, 08:30 AM#2
Chocobo
What about a triggered way to detect when a unit is taking damage?

And lol, your trigger is an infinite loop.
01-09-2007, 08:39 AM#3
rulerofiron99
Make an artificial first shot at start of map.
01-10-2007, 09:27 AM#4
NmdSnprEnigma
sorry, maybe I should've been more specific. If Tower A attacks Unit B, the poison doesn't get applied on the first hit, but does on the second. If Tower A then attacks Unit C, then same thing, not applied first hit. If Tower A then attacks Unit B again, it doesn't kick in the first time still.

@Chocobo: Yeah it does loop, but not infinitely because at some point the attacked unit will move out of range, or die and when the current order of a unit is 'smart' another 'smart' order has no real effect so either way that's no problem. An on damage trigger is no problem but could you explain what you mean a bit? What would you have an on damage trigger do in this case?
01-10-2007, 11:04 AM#5
Chocobo
Quote:
Originally Posted by NmdSnprEnigma
sorry, maybe I should've been more specific. If Tower A attacks Unit B, the poison doesn't get applied on the first hit, but does on the second. If Tower A then attacks Unit C, then same thing, not applied first hit. If Tower A then attacks Unit B again, it doesn't kick in the first time still.

@Chocobo: Yeah it does loop, but not infinitely because at some point the attacked unit will move out of range, or die and when the current order of a unit is 'smart' another 'smart' order has no real effect so either way that's no problem. An on damage trigger is no problem but could you explain what you mean a bit? What would you have an on damage trigger do in this case?

Register all units :

Trigger:
Register PrePlaced Units
Collapse Events
Game - Time Elasped 0.00 seconds of game-time
Conditions
Collapse Actions
Custom Script : set bj_wantDestroyGroup = true
Collapse Unit Group - Pick every units in (Units in (Playable map area)) and do actions
Collapse Loop - Actions
Trigger - Add to Show Damages <gen> the event (Unit - (Picked unit) takes damage)

Trigger:
Detect Unit
Collapse Events
Unit - A unit enters (Playable map area)
Conditions
Collapse Actions
Trigger - Add to Show Damages <gen> the event (Unit - (Triggering unit) Takes damage)

Trigger:
Show Damages
Events
Conditions
Collapse Actions
Set loc = (Position of (Triggering unit))
Floating Text - Create floating text that reads ((String((Integer((Damage taken))))) + !) at loc with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Set the velocity of (Last created floating text) to 15.00 towards 90.00 degrees
Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds

From : http://www.thehelper.net/forums/showthread.php?t=40355

Do whatever in the Show Damages part.


But your trigger is infinite loop as I said. If a unit is attacking a unit, then instantly the smart will order to attack, the trigger runs, the unit smarts again the target unit, the trigger runs...