• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Neutral Hostile Unit Stops Attacking if Ordered to Beserk after being taunted

Status
Not open for further replies.

qbz

qbz

Level 4
Joined
Dec 1, 2019
Messages
80
I can attach a video if it helps, but basically, if I fight my neutral hostile unit without taunting it, it will function as expected, casting berserk every X seconds and continuing to attack its target. However, if the unit was taunted before being ordered to berserk, it will still correctly cast berserk on itself, but after the cast, it's frozen in place and will not attack my units until it is taunted again. The taunt only has to come before the ordered enrage, the unit does not have to still be under the effects of taunt when ordered to enrage in order for the issue to occur.

Issuing an attack move order at the frozen unit's feet briefly after the berserk order does not fix it. The implementation is pretty simple, just a timer calling IssueImmediateOrderBJ. If I "unstick" the frozen unit with another taunt, it will continue to function as expected. The issue wont occur if the taunting unit dies before the next enrage cast. Wondering if anyone knows whats going on here. Are there known issues in taunt/order interactions?
 
Level 12
Joined
Feb 5, 2018
Messages
521
Have you tried creating a custom taunt? Something like this:

  • Melee Initialization
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Taunt (Channel)
    • Actions
      • Set VariableSet TempCaster = (Triggering unit)
      • Set VariableSet TempAoE = 375.00
      • Set VariableSet TempLoc = (Position of TempCaster)
      • Set VariableSet TempGroup = (Units within 375.00 of TempLoc matching (((Matching unit) belongs to an enemy of (Owner of TempCaster).) Equal to True).)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A structure) Equal to False
              • ((Picked unit) is dead) Equal to False
              • ((Picked unit) is Magic Immune) Equal to False
            • Then - Actions
              • Set VariableSet TempTarget = (Picked unit)
              • Unit - Order TempTarget to Attack TempCaster
            • Else - Actions
      • Custom script: call RemoveLocation (udg_TempLoc)
      • Custom script: call DestroyGroup (udg_TempGroup)
 
  • Like
Reactions: qbz
Level 6
Joined
Dec 31, 2017
Messages
138
  • Set VariableSet TempGroup = (Units within 375.00 of TempLoc matching (((Matching unit) belongs to an enemy of (Owner of TempCaster).) Equal to True).)
  • Unit Group - Pick every unit in TempGroup and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) is A structure) Equal to False
          • ((Picked unit) is dead) Equal to False
          • ((Picked unit) is Magic Immune) Equal to False
        • Then - Actions
          • Set VariableSet TempTarget = (Picked unit)
          • Unit - Order TempTarget to Attack TempCaster
        • Else - Actions
This approach is quite suboptimal.


  • Set VariableSet TempGroup = (Units within 375.00 of TempLoc)
  • Unit Group - Pick every unit in TempGroup and do (Actions)
    • Loop - Actions
      • Set VariableSet TempTarget = (Picked unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (TempTarget is A structure) Equal to False
          • (TempTarget is dead) Equal to False
          • (TempTarget is Magic Immune) Equal to False
          • ((TempTarget belongs to an enemy of (Owner of TempCaster).) Equal to True)
        • Then - Actions
          • Unit - Order TempTarget to Attack TempCaster
        • Else - Actions
This is better.
 
  • Like
Reactions: qbz

qbz

qbz

Level 4
Joined
Dec 1, 2019
Messages
80
Channel/script based taunt makes no difference. Bizarre.


I'm using C# cross compiled to lua, but idt thats the problem, this is the end of my project and things have been going fine with it so far. Believe I more or less translated your suggestion.


Code:
        const float kTauntRadius = 450.0f;
        group g = CreateGroup();
        GroupEnumUnitsInRange(
            g,
            GetUnitX(aa.m_UnitCache.m_Caster.Value),
            GetUnitY(aa.m_UnitCache.m_Caster.Value),
            kTauntRadius,
            null
        );

        player nh = Player(PLAYER_NEUTRAL_AGGRESSIVE);
        unit u = FirstOfGroup(g);
        while (u != null)
        {
            GroupRemoveUnit(g, u);
            if(IsUnitAliveBJ(u) && IsUnitOwnedByPlayer(u, nh))
            {
                IssueTargetOrder(u, "attack", aa.m_UnitCache.m_Caster.Value);
            }
            u = FirstOfGroup(g);
        }
 

qbz

qbz

Level 4
Joined
Dec 1, 2019
Messages
80
Even the most simple version of this I can spin up, not going through my ability system nonsense, experiences the issue. This works fine until he's taunted. He continues to cast berserk every 10 seconds but stops attacking if he was taunted before berserking.

upload_2020-3-5_8-49-43.png
 

qbz

qbz

Level 4
Joined
Dec 1, 2019
Messages
80
update. Hive discord was able to help me. Still not sure whether or not its a bug, but a simple work around is issuing a "stop" order shortly after your berserk order. Issuing an attack order at the unit's feet also works, my mistake in trying that was that I tried to use the order string "attackmove" which doesn't exist. Both of the following work to solve this issue,


Code:
                IssuePointOrder(s_Stalagg, "attack", GetUnitX(s_Stalagg), GetUnitY(s_Stalagg));
                IssueImmediateOrder(s_Stalagg, "stop");
 
Status
Not open for further replies.
Top