• 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] Rendering a unit unrecruitable until a research is done and Charge ability for cavalry units.

Level 3
Joined
Feb 2, 2025
Messages
11
I'm currently designing the roster of the human faction in my map and i'm currently trying to have their Knights evolve into another unit (like the headhunters do), problem is both the knight and their evolved version are available for recruitment right from the start in the building i've set up for them.

I would also like to make an autocast Charge ability for Cavalry units that stuns, damages and slightly knocksback enemy units caught in it (but that also damages them in return if their target has a passive ability that i intend to give to spearmen units, in essence i want to make a Warcraft version of a Battle for Middle Earth cavalry charge).

How should i proceed ?
 
Last edited:
Level 30
Joined
Aug 29, 2012
Messages
1,383
Are you using the Berserker Upgrade research? Everything should be handled by these fields

1740094721816.png


Otherwise you'll have to do it via trigger with this action

  • Player - Make Knight (Upgrade) Unavailable for training/construction by Player 1 (Red)
And then make it available and disable the former unit type
 
Level 3
Joined
Feb 2, 2025
Messages
11
@Chaosium I was indeed using the berserker upgrade as a template, but the problem persisted despite that. Turns out that adding your line in a trigger fixed my first problem, thanks for your help.

Now i wonder, how should I proceed to have my Cavalry Charge ability going ? Is it even possible to add it in the first place ?
 
Last edited:
Level 30
Joined
Aug 29, 2012
Messages
1,383
You can use an autocast ability like Frenzy that does nothing itself, paired with a dummy caster to cast war stomp or something in order to damage/stun in an AOE, that's for the base of your ability

Then for your spearman ability you could do something like this

  • Unit Group - Pick every unit in (Units within 250.00 of (Position of (Triggering unit)) matching ((Level of (YourPassiveSpell) for (Matching unit)) Equal to 1).) and do (Actions)
    • Loop - Actions
      • Unit - Cause (Picked unit) to damage (Triggering unit), dealing 100.00 damage of attack type Chaos and damage type Normal
As for the knockback though, I'm sure there are some ready to use systems on the Hive, it's a bit more tricky to do
 
Level 18
Joined
Dec 20, 2012
Messages
269
I highly recommend Bribe's GUI Knockback 2.5D v4.2.5.0 for your knockback needs.
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
In order for units to actually autocast an ability (no matter if a player or cpu controls them), the specific conditions for that ability must be met. There are a variety of different spell cast behaviors, so you will need to pick an autocaster that vaguely mimics the situations you'd like Charge to be cast. Here is a list: Base abilities for custom spells cast by melee-game AI units, and there is also the WC3 Ability Insight Document.
 
Level 3
Joined
Feb 2, 2025
Messages
11
I'm sorry, you must think that i'm a noob, but i'm struggling to set up the Charge Ability (without the knockback effect for now). In essence I'm trying to have my unit deal double it's damage when the ability is activated and stunning it's target as well as other nearby units once they land an attack. After either the ability's countdown runs out or the unit lands an attack (whichever goes first), the ability's personal buff effect wears off (to represent the unit losing their momentum).
i'm struggling on the very first part of it.
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
Mind sharing an in-game description of it?
an autocast Charge ability for Cavalry units that stuns, damages and slightly knocksback enemy units caught in it (but that also damages them in return if their target has a passive ability that i intend to give to spearmen units, in essence i want to make a Warcraft version of a Battle for Middle Earth cavalry charge).
In essence I'm trying to have my unit deal double it's damage when the ability is activated and stunning it's target as well as other nearby units once they land an attack. After either the ability's countdown runs out or the unit lands an attack (whichever goes first), the ability's personal buff effect wears off (to represent the unit losing their momentum).
i'm struggling on the very first part of it.
Seems pretty clear to me, Daffa. Activate ability, gain charge buff; if unit completes an attack with this buff: consume buff, deal double damage, and do knockback/stun in local area around the attacked unit.

If your game install is updated you can use the "any unit takes damage" event and "damage from normal attack" boolean condition to determine when such an attack occurs. For older patches or if you want more control over the damage event you can use something like Damage Engine 5.A.0.0 (there are compatibility versions for even older patches). In any case it's actually a very simple ability trigger:
  • YouCanDoIt.trigger
    • Events
      • Unit - Any unit takes damage
      • -------- or use a DamageEngine event: --------
      • Game - OnDamageEvent becomes Less than or equal to 0.00
    • Conditions
      • ((Damage Source) has buff CHARGE_BUFF) equal to True //use appropriate variable instead of TU if using DamageEngine
      • (Damage from normal attack) equal to True
      • -------- if using the DamageEngine event you don't need an equivalent condition, because the Less than or equal in the event means it will only run for unit attacks (see the system documentation) --------
    • Actions
      • Set C = (Damage Source)
      • Set T = (Triggering Unit)
      • -------- or if using damage engine : --------
      • Set C = DamageEventSource
      • Set T = DamageEventTarget
      • -------- --------
      • Unit - Remove CHARGE_BUFF from C
      • Unit - Cause C to damage T for DamageEventAmount using attack type Magic and damage type Universal //use the "event damage" response if not using DamageEngine
      • -------- the above line [I]should[/I] deal damage that isn't reduced by armor (again) since that damage number itself was already reduced by armor (it depends if you use a system or not and which event you use if you do, but just think about it and come to the conclusion about what you should do) --------
      • Set P = (Position of C)
      • Custom script: set bj_wantDestroyGroup = true //clean a unit group leak in the next line below:
      • Unit Group - Pick every unit in (Units within RANGE of P) and do (Actions)
        • Loop - Actions
          • Set PU = (Picked Unit)
          • If (All conditions are true) then do (Then actions) else do (Else actions)
            • If - Conditions
              • (PU is Alive) equal to True
              • (PU belongs to an enemy of C) equal to True
              • (PU is Invulnerable) equal to True
              • -------- etc. for all necessary filters so only the correct units get knocked (the ones that return true for all of these conditions) --------
            • Then - Actions
              • -------- do the knockback for a valid target PU here --------
            • Else - Actions
      • Custom script: call RemoveLocation(udg_P) //match the variable name of your point variable here, but keep the udg_ prefix
 
Last edited:
I'm sorry, you must think that i'm a noob, but i'm struggling to set up the Charge Ability (without the knockback effect for now). In essence I'm trying to have my unit deal double it's damage when the ability is activated and stunning it's target as well as other nearby units once they land an attack. After either the ability's countdown runs out or the unit lands an attack (whichever goes first), the ability's personal buff effect wears off (to represent the unit losing their momentum).
i'm struggling on the very first part of it.
Hello there.
On stream I did this if that could help you.
 

Attachments

  • charge test.w3m
    64.4 KB · Views: 3
Level 3
Joined
Feb 2, 2025
Messages
11
I've managed to get my charge and charge reflection abilities going, for now the charge only stuns the cavalier's main target (instead of all the nearby enemy units like I initially intended) and I've yet to wrap my head around properly setting up the Knockback 2.5D system to have the charge knockback in place. Still here's how my system goes right now.
  • Charge Effect Damage
    • Events
      • Unit - A unit takes damage
    • Conditions
      • ((Damage source) has buff Charge ) Equal to True
      • (Damage From Normal Attack) Equal to True
    • Actions
      • Set VariableSet Attacker = (Damage source)
      • Set VariableSet Target = (Triggering unit)
      • Set VariableSet Target_Base_Damage = (Base Damage of (Triggering unit) for weapon index 0)
      • Set VariableSet Target_number_of_damage_dies = (Dice Number of (Triggering unit) for weapon index 0)
      • Set VariableSet Target_faces_per_damage_dice = (Dice Sides of (Triggering unit) for weapon index 0)
      • Unit - Remove Charge buff from Attacker
      • Unit - Remove Charge Impact from Attacker
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability: (Unit: Target's Ability with Ability Code: Brace For Impact ! )'s Boolean Field: Check Dependencies ('achd')) Equal to True
        • Then - Actions
          • Unit - Cause Target to damage Attacker, dealing (((Real(Target_Base_Damage)) + ((Real(Target_number_of_damage_dies)) x (Real(Target_faces_per_damage_dice)))) x 3.00) damage of attack type Pierce and damage type Universal
        • Else - Actions
          • Unit - Cause Attacker to damage Target, dealing (Damage taken) damage of attack type Magic and damage type Universal
Any idea how I can set up the knockback in that Trigger ? I know that's probably something easy, but due to my inexperience i'm missing it : my attempts to set it up ended up in failure so far.

Edit : NEVERMIND, finally managed to figure Knockback 2.5D out, I only have the "area stun" part of the charge left to setup, but that shouldn't be too hard. Thank you, everyone, for your help.
 
Last edited:
Top