HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Why doesn't this work?

08-24-2004, 07:45 AM#1
Psyborg
I am trying to make some abilities that apply to all player controlled heros that are only active when they are near enemy units. The following is all I could think of.. It doesn't work.. Does anyone have a more elegant solution or know why its not doing anything.?

Code:
    Events
        Time - Every 2.00 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in (Units in (Playable map area)((((Picked unit) is A Hero) Equal to True) and ((Owner of (Picked unit)) Equal to (Random player from (All players controlled by a User player))))) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Number of units in (Units within 1000.00 of (Position of (Picked unit)) matching (((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True))) Greater than 0
                    Then - Actions
                        Unit - Add Force of Will  to (Picked unit)
                        Unit - Add Focus Mind to (Picked unit)
                        Unit - Remove DIS Mind Focus  from (Picked unit)
                        Unit - Remove DIS Force of Will  from (Picked unit)
                    Else - Actions
                        Unit - Add DIS Force of Will  to (Picked unit)
                        Unit - Add DIS Mind Focus  to (Picked unit)
                        Unit - Remove Force of Will  from (Picked unit)
                        Unit - Remove Focus Mind from (Picked unit)
08-24-2004, 09:56 AM#2
volatile
Not sure what you're trying to have happen but I don't know why u used this here
(Random player from (All players controlled by a User player)))))

U wouldn't do a random player would u? If you want to affect people in an area around your hero like an aura then do something like this...

Trigger1
Unit Learns Extreme Heat
Events
Unit - A unit Learns a skill
Conditions
(Learned Hero Skill) Equal to Extreme Heat Aura
Actions
Set ExtremeHeatHero = (Triggering unit)
Trigger - Turn on Extreme Heat Aura Effect <gen>

Trigger 2 (initially off)
Extreme Heat Aura Effect
Events
Time - Every 1.00 seconds of game time
Conditions
Actions
Set ExtremeHeatBuffGroup = (Units within 500.00 of (Position of ExtremeHeatHero) matching (((Matching unit) belongs to an enemy of (Owner of ExtremeHeatHero)) Equal to True))
Unit Group - Pick every unit in ExtremeHeatBuffGroup and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Percentage life of (Picked unit)) Equal to 100.00
Then - Actions
Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 1.00)
Else - Actions
Do nothing

For this aura effect I am using a negative value healing ward aura, this trigger basically just sets any units life around the hero to [hero life = hero life - 1] so that the aura will start to subtract life (Healing ward aura won't subtract life if the units health is at 100%). This is a good example of doing an action to a unit in the aura area as a periodic event. Hope this helps :D
08-24-2004, 02:33 PM#3
Psyborg
It's not for an aura..

I was trying to exclude computer controlled hero's from gaining the ability..

What I am trying to do is make an ability that can only be used when other enemy units are around. The target of the ability is the self. For some reason I couldn't get the unit begins casting an ability blah blah... issue order stop to work in terms of preventing the ability use when enemy units are not around, plus I wanted disabled icons.