• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • The Hive's 34th Texturing Contest: Void is now concluded, time to vote for your favourite set of icons! Click here to vote!

Faction change spell, need help

Level 2
Joined
Aug 21, 2021
Messages
8
Hello ! I'm trying to create a “madness” spell that would be based on the Bloodlust spell but in addition to that would make the target hostile (neutral hostile), I took the Bloodlust base and renamed the buff to Madness I then tried to make the rest of the spell using triggers to allow to force a faction change for 15 sec.
Unfortunately this doesn't seem to work, when my caster casts the effect on a target (whether ally or enemy) it does receive the Madness buff along with the Bloodlust effects but it doesn't change team.

This is the first time I've used triggers for spells, and I don't have a lot of experience with worldedit, so I'd be happy if someone could tell me what's wrong with my trigger.

Below is a screen shot of the script and customs data for the Madness spell, if required :


rgerghty.png



zert.png

erthy.png

zerr.png
 

Uncle

Warcraft Moderator
Level 74
Joined
Aug 10, 2018
Messages
7,949
Hello, so here's how you can post your triggers, doing so will make your life easier and make it easier for others to assist you.

Suggested fixes:

1) Change the Event from "Begins casting an ability" to "Starts the effect of an ability". Begins is like the pre-cast stage which can be cancelled. This Event is often used to introduce your own "Targets Allowed" requirements and Order the caster to cancel the spell manually if need be.

2) Change (Targeted unit) to (Target unit of ability being cast). That Event Response is meant to be used with the "Acquires target" Event. When choosing an Event Response, check to see if there's a "tip" tooltip near the bottom of the window that explains what Event it's meant to be used with.

3) I have no idea if (Previous owner) works, I've never used it before and didn't even know it existed to be honest. If the unit doesn't change back then assume this could be part of the reason why.

4) This trigger will break the moment you cast Madness on a unit that already has the Madness buff. When a trigger executes, it creates a new instance of itself. Multiple instances can exist at a time. These instances don't know about one another and will not work together (unless specifically designed to do so). In other words, your first instance of the ability will interfere with the second instance.

For example, here's a timeline of events when casting it twice on the same unit, with [Timestamps]:
[0:00] You cast Madness on the Paladin, changing it to Neutral Hostile, and starting a 15.00 second Wait.
[0:02] You cast Madness again on the same Paladin, changing it to Neutral Hostile again, and starting a completely separate 15.00 second Wait.
[0:15] The first Madness's Wait will have finished and the unit's ownership will change back to it's "Previous owner".
[0:17] The second Madness's Wait will have finished and the unit's ownership will change back to it's "Previous owner".

See the issue? The first cast is going to end the second cast early. What you need to do is avoid using Waits and instead design your trigger to work similar to a stopwatch, where each time you start it you either start a fresh timer OR restart an existing timer. In other words, each Unit should only ever have one "Madness Buff Timer" running at a given time.


Here's an example of a temporary Charm effect I've made for someone in the past that avoids the issue mentioned above:
Note that you'd want to check for a Buff -> "If Charm_Unit has buff Madness Equal to False" in the Charm Loop trigger to ensure that the effects end early if the Buff is dispelled. So you'd check for that in addition to checking the Charm_Duration.
  • Charm Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Charm_UnitGroup and do (Actions)
        • Loop - Actions
          • -------- If the Duration is <= 0.01 then it's finished: --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • Charm_Duration[Charm_CV] Less than or equal to 0.01
                  • (Charm_Unit has buff Madness) Equal to False
            • Then - Actions
            • Else - Actions
^ I deleted the other Actions to help clarify what needs to be changed here. Do not actually delete anything.
 
Last edited:
Level 2
Joined
Aug 21, 2021
Messages
8
Wow! Thanks a lot for the quick and complete answer, I'll try to post my future problems (which may happen more than once) the right way next time.
I'll try your suggestions and see if I get anywhere.
Thanks again.
 
Top