• 🏆 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!

Editing Purge

Status
Not open for further replies.
Level 6
Joined
Aug 5, 2017
Messages
251
I want Purge to become Surge, the spell with the same dispelling effect. but it's for friends and can increase movement speed. I edited Data - Movement Frequency Update to -5, so that friendly units gain speed for a short time, but not only that it's not working, but Purge seems to be lacking other effects. Anyone knows the reason here?
Also, I would like to add an effect to the unit that allows itself to gain mana after an attack has been done.
 
Last edited:
Level 14
Joined
Aug 31, 2009
Messages
775
You're going to need to use an indexing system.
Here's how I'd implement a spell that gives 100% movement speed for 5 seconds (which slowly decays) and then returns the unit to its normal speed after.

First, create some variables.
An integer variable. (eg. "Index")
A unit array variable. (eg. "SurgeTarget")
A real array variable. (eg. "SurgeTimer")
Another integer variable. (eg. "SurgeCount")

Now create 2 triggers.

First trigger: "Casting"
  • Events
    • A unit starts the effect of an ability.
  • Conditions
    • (Ability being cast) equal to (Surge)
  • Actions
    • Set SurgeCount = (SurgeCount + 1)
    • Set SurgeTarget[Surge Count] = (Target Unit of ability being cast)
    • Set OriginalMovespeed[SurgeCount] = Base Movement speed of (Target unit of ability being cast)
    • Set SurgeTimer[SurgeCount] = 100.00
    • If ((SurgeCount) equal to 1) then (Turn on (Surge Loop Trigger)) else (Do nothing)
Second Trigger: "Surge Loop Trigger" (Initially TURNED OFF Trigger)
  • Events
    • Time - Every 0.05 seconds of game time.
  • Conditions
  • Actions
    • For Each Integer (Index) from 1 to (SurgeCount) do:
      • If / Then / Else (Multiple Functions)
        • Conditions
          • [SurgeTimer[Index]] not equal to 0.00
        • Then
          • Set SurgeTimer[Index] = (SurgeTimer[Index] - 1.00)
          • Unit - Set movement speed of SurgeTarget[Index] = ((SurgeTimer[Index] / 100) + 1) x Base movement speed of SurgeTarget[Index])
        • Else
          • Unit - Set movement speed of SurgeTarget[Index] to (Base movement of SurgeTarget[Index])
          • If (SurgeCount equal to 1) then (Turn off (This Trigger)) else (Do nothing)
          • Set SurgeCount = (SurgeCount - 1)

By hive's standards, it's not that good, as I'm not recycling the indexs, but for the most part this should do its job. If you want to change the "100%" movement speed to something else, then change this:

  • Unit - Set movement speed of SurgeTarget[Index] = ((SurgeTimer[Index] / 100) + 1) x Base movement
to match whatever you need.
 
Last edited:
Level 14
Joined
Aug 31, 2009
Messages
775
Um, the buttons don't mean anything. It's just a visual thing.
It's only showing as a "?" button in my code above because I didn't write "Set" with a capital S. In your map, it won't matter.

I've edited the above post anyway to fix it now.
 
Level 14
Joined
Aug 31, 2009
Messages
775
As for the mana regain:

  • Events
    • A unit is attacked
  • Conditions
  • Actions
    • For Each Integer (Index) from 1 to (SurgeCount) do (Actions)
      • If / Then / Else (Multiple Functions)
        • If (Conditions)
          • (Attacking Unit) equal to (SurgeTarget[Index])
          • (SurgeTimer[Index]) greater than 0.00
        • Then (Actions)
          • Unit - Set mana of (Attacking Unit) to ((Mana of (Attacking Unit) + 25))
        • Else (Actions)
Again, change the value of 25 at the end to whatever amount of mana you want to use. However, this system is abusable - if you spam the "Stop" command on a unit that was affected by surge, it will repeatedly generate mana. This is because "A unit is attacked" is trigger whenever the unit ATTEMPTS to attack, not when it LANDS the attack. In order to fix that abuse, it's WAY beyond what I can code from memory, and you'll need to look into a Damage Taken system (there's a lot on Hiveworkshop, but they're probably too complex for you to understand).
 
Last edited:
Level 11
Joined
Jan 25, 2017
Messages
213
Unit - remove all buffs from (triggering unit)

Just use clarity potion as base ability so the mana regain can be controlled how you want and also used when mana is full. Use the above for the dispelling effect and Damage's stuff for the movement.

Done.
 
Level 14
Joined
Aug 31, 2009
Messages
775
Um.

So something really as simple as:

  • Events
    • Unit - A unit is attacked
  • Conditions
    • Unit-type of (Attacking Unit) equal to (Bloodelf Whatever)
  • Actions
    • Unit - Set mana of (Attacking Unit) to (Mana of (Attacking unit) + 20)
I mean, if that's all you wanted, I guess you've never used World Editor before, right? This is elementary stuff.
 
Level 6
Joined
Aug 5, 2017
Messages
251
Almost. I want to show you one last thing:
AcBGF5f.png

Notice something different?
Those 2 Unit buttons? One user did show me how to access it. New Action -> - Search for Text - -> I typed Movement Speed. That's what the user said. In my case, it doesn't work. Look above:
Is there a workaround here?
 
Level 14
Joined
Aug 31, 2009
Messages
775
Um, it's correct, but why does it say "Last Created Unit" and "Triggering Unit". I told you to change them as I said to "SurgeTarget[Index_surge]".

Something like:
  • Unit - Set SurgeTarget[Index] movement speed to (((SurgeTimer[Index] / 100) + 1) x (Default movement speed of (SurgeTarget[Index]))
and
  • Unit - Set SurgeTarget[Index] movement speed to (Default movement speed of (SurgeTarget[Index]))
Surely you noticed that "Triggering Unit" and "Last Created Unit" mean absolutely nothing in your code, and so of course they don't work, right?
 
Last edited:
Level 14
Joined
Aug 31, 2009
Messages
775
I was typing all the trigger coding by hand from memory, so that's why the wording may be slightly different.

If it's "Set (Unit) movement speed to ___" or "Set movement speed of (unit) to ____". I'm sure you're able to see they're the same thing, even if I typed it slightly differently.
 
Status
Not open for further replies.
Top