• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Focus

Status
Not open for further replies.
Level 16
Joined
Jun 24, 2009
Messages
1,409
Before anyone mention that I miss the event and the condition, I'm using a system that calls the spell most efficiently. The system works perfectly, all other spells work.

I'm making a simple MPI spell similar to the Windrunner's ultimate in DotA. The difference is that I just give her minor attack speed bonus and won't reduce damage. But when I cast the spell it don't gives the hero the attack speed increase ability.

  • Focus
    • Events
    • Conditions
    • Actions
      • Set TempInt = (Player number of (Triggering player))
      • Set TempInt2 = (Strength[TempInt] - 14)
      • Set FCaster[TempInt] = (Triggering unit)
      • Set FTarget[TempInt] = (Target unit of ability being cast)
      • Unit - Add % speed to FCaster[TempInt]
      • Unit - Set level of % speed for FCaster[TempInt] to TempInt2
      • Unit - Order FCaster[TempInt] to Attack FTarget[TempInt]
  • Focus Check
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
    • Actions
      • Set TempInt = (Player number of (Triggering player))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Issued order) Equal to (Order(attack))
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Attacking unit) Equal to FCaster[TempInt]
              • (Attacked unit) Equal to FTarget[TempInt]
            • Then - Actions
            • Else - Actions
              • Unit - Remove % speed from FCaster[TempInt]
              • Set FCaster[TempInt] = No unit
              • Set FTarget[TempInt] = No unit
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Not equal to (Order(move))
            • Then - Actions
              • Unit - Remove % speed from FCaster[TempInt]
              • Set FCaster[TempInt] = No unit
              • Set FTarget[TempInt] = No unit
            • Else - Actions
 
for the units... try setting it to the max number of players... integers should be fine ven if you put 1 as array size... but units should be fine too as they don't need to be initialized...

Is the spell targeted like the original Focus ability? if yes, your two triggers might be conflicting with each other...

anyway, your condition is wrong I think... there is no Attacking unit and attacked unit on that event... Use TriggeringUnit and Target unit of issued order...

I believe this causes the 2nd trigger to run the removal actions after your first... You order him to attack as the last action of the first, the second trigger fires, Condition 1 is satisfied (issued order = attack)... now the second set of conditions will be false since AttackedUnit and Attacking unit are both equal to no unit, meaning the ability will then be removed from your unit...
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
  • Focus
    • Events
    • Conditions
    • Actions
      • Set TempInt = (Player number of (Triggering player))
      • Set TempInt2 = (Strength[TempInt] - 14)
      • Set FCaster[TempInt] = (Triggering unit)
      • Set FTarget[TempInt] = (Target unit of ability being cast)
      • Unit - Add % speed to FCaster[TempInt]
      • Unit - Set level of % speed for FCaster[TempInt] to TempInt2
      • Unit - Order FCaster[TempInt] to Attack FTarget[TempInt]
  • Focus Check
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
    • Actions
      • Set TempInt = (Player number of (Triggering player))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Issued order) Equal to (Order(attack))
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Attacking unit) Equal to FCaster[TempInt]
              • (Attacked unit) Equal to FTarget[TempInt]
            • Then - Actions
            • Else - Actions
              • Unit - Remove % speed from FCaster[TempInt]
              • Set FCaster[TempInt] = No unit
              • Set FTarget[TempInt] = No unit
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Not equal to (Order(move))
            • Then - Actions
              • Unit - Remove % speed from FCaster[TempInt]
              • Set FCaster[TempInt] = No unit
              • Set FTarget[TempInt] = No unit
            • Else - Actions

There is quite a bit of proceural coupling. Try and use negation of the one condition so that only 1 copy of the actions...
Unit - Remove % speed from FCaster[TempInt]
Set FCaster[TempInt] = No unit
Set FTarget[TempInt] = No unit
is used. This is good programming practice as if you ever need to maintain those actions, it means that you do not have to update 2 instances (so less chance of a error occuring).
 
Level 9
Joined
Dec 12, 2007
Messages
489
The problem was that it instantly removed the ability because the hero ordered to cast the spell. Now I added an extra condition that checks if the caster has the spell.
another workaround that i would like to suggest is:

1. at Focus trigger, you add the caster into a unit group, then at the Focus Check, you check again whether the ordered unit is in the unit group before checking the issued order.

2. at Focus Check trigger, change the 'attacking unit' to 'triggering unit', and 'attacked unit' into 'target unit of issued order'.
 
Level 9
Joined
Dec 12, 2007
Messages
489
well that "add unit to group" is there so when the unit cast the spell and triggering the Focus, it doesn't get checked by the Focus Check as the Focus Check will also check the order of casting the spell.

although i haven't confirm which one triggered first, the unit issued order, or starts the effect of an ability.
if the starts the effect of an ability is triggered first, then this is just overcomplicate the trigger.
otherwise well you know about it.

and when the unit has fulfilled the condition for removing the bonus, remove the unit from the unit group too.

also, modifying the spell to base on (unit group and hashtable) instead of variable array will allow the spell to be multi-instanceable.
 
Level 5
Joined
Jul 16, 2009
Messages
80
Marsal, do you know what could have made life easier for you?

- Create a dummy to cast bloodlust on your hero.
- To remove the speed, just set the trigger to remove the buff.

Your conditions are alright (although I've just skimmed through them).
 
Status
Not open for further replies.
Top