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

[Trigger] Charge Help

Status
Not open for further replies.
Level 1
Joined
Sep 24, 2010
Messages
5
Hi There. Im making a map with one of my friends, he however made a massive trigger error in a charge spell for a ram.

The problem is that when you cast it, you go invulnerable, you may however move around and cancel the straight line movement and therefore be invulnerable while auto-attacking anything you want until it runs out.

We also wanted to take collision off too so you can go through enemy hero's and units but has however made you able to go through the areas of the map your not supposed to go through.

It also destroy's towers which we dont want it to do.

Any help could be appreciated


The Trigger is :

  • Charge
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Charge
    • Actions
      • Unit - Turn collision for (Triggering unit) Off
      • Unit - Set (Triggering unit) movement speed to 385.00
      • Unit - Make (Triggering unit) Invulnerable
      • Unit - Order (Triggering unit) to Move To (Target point of ability being cast)
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Special Effect - Create a special effect at (Position of (Triggering unit)) using Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit - Cause (Triggering unit) to damage circular area after 0.00 seconds of radius 110.00 at (Position of (Triggering unit)), dealing ((Real((Level of Charge for (Triggering unit)))) x 50.00) damage of attack type Siege and damage type Unknown
          • Wait 0.50 seconds
      • Unit - Set (Triggering unit) movement speed to (Default movement speed of (Triggering unit))
      • Unit - Make (Triggering unit) Vulnerable
      • Unit - Turn collision for (Triggering unit) On
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
*Do NOT use Waits in Loop Actions as it will cause bugs*
You must use *Damage Target* action, not Damage Area action as this will damage EVERYTHING I mean EVERYTHING in that AOE (110) from the center of the position (this includes self, allies, enemies, neutrals, towers, buildings, etc)
Damage Target action is usually related to *(Picked unit)* as this will damage ONLY selected units, not as same as Damage Target but before this, you must set a variable using Unit Group variable and later on you will use in Unit Group action
It will be something like this:
  • Unit Group - Pick every unit in EnemyGroup and do (Actions)
    • Loop - Actions
      • Unit - Cause Caster to damage (Picked unit), dealing ((Real((Level of Charge for Caster))) x 50.00) damage of attack type Siege and damage type Normal
The '*' sign indicates that the information is important for this kind of spell to work out
 
Level 9
Joined
May 27, 2006
Messages
498
That's because player still has control of the unit, therefore he can give orders to it, overriding the ones you give by triggers. You can prevent that by adding Locust ability to unit, or giving control of it to neutral player for the duration.
Also, you have a few leaks in your trigger:
  • Unit - Order (Triggering unit) to Move To (Target point of ability being cast)
do:
  • Set point = (Target point of ability being cast)
  • Unit - Order (Triggering unit) to Move To t_point
  • Custom script: call RemoveLocation(udg_point)
  • Special Effect - Create a special effect at (Position of (Triggering unit)) using ...
  • Unit - Cause (Triggering unit) to damage circular area after 0.00 seconds of radius 110.00 at (Position of (Triggering unit)), dealing ... damage of attack type Siege and damage type Unknown
do:
  • Set point = (Position of (Triggering unit))
  • Special Effect - Create a special effect at point using ... model
  • Unit - Cause (Triggering unit) to damage circular area after 0.00 seconds of radius 110.00 at point, dealing ... damage of attack type Siege and damage type Unknown
  • Custom script: call RemoveLocation(udg_point)
defskull said:
*Do NOT use Waits in Loop Actions as it will cause bugs*
Not neccessarily, if there is no other loop using integer A at the time, it won't cause any bugs. Tho of course the best solution is to use a custom integer variable instead, to prevent any collision from happening.

@OP
Regarding the way you deal damage, it indeed would've been better if you used the method defskull suggested. This would allow you to prevent towers from being damaged, and also damaging each target only once, making it possible to balance the damage. So your trigger would look like that:
  • Actions:
    • Unit - Turn collision for (Triggering unit) Off
    • Unit - Set (Triggering unit) movement speed to 385.00
    • Custom script: call UnitAddAbility(GetTriggerUnit(), 'Aloc') == since the Locust ability isn't visible on GUI dropdown menu, you have to use jass
    • Set point = (Target point of ability being cast)
    • Unit - Order (Triggering unit) to Move To point
    • Custom script: call RemoveLocation(udg_point)
    • For each (ram_int) from 1 to 10, do (Actions) <===== custom integer variable ram_int
      • Loop - Actions
        • Set point = (Position of (Triggering unit))
        • Special Effect - Create a special effect at point using Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
        • Special Effect - Destroy (Last created special effect)
        • Set EnemyGroup = (Units within 110.0 of point, matching (((Matching unit) is Building Equal to False) and ((Owner of (Matching unit)) is an enemy of (Owner of (Triggering unit)) Equal to True) and ((Matching unit) is in DamagedGroup Equal to False)))
        • Unit Group - Pick every unit in EnemyGroup and do (Actions)
          • Loop - Actions
            • Unit - Cause Caster to damage (Picked unit), dealing ((Real((Level of Charge for Caster))) x 50.00) damage of attack type Siege and damage type Unknown
            • Unit Group - Add (Picked unit) to DamagedGroup
        • Custom script: call RemoveLocation(udg_point)
        • Custom script: call DestroyGroup(udg_EnemyGroup)
        • Wait 0.50 seconds
    • Unit Group - Clear DamagedGroup
    • Unit - Turn collision for (Triggering unit) On
    • Unit - Set (Triggering unit) movement speed to (Default movement speed of (Triggering unit))
    • Custom script: call UnitRemoveAbility(GetTriggerUnit(), 'Aloc')
Locust ability makes the unit untargetable, therefore it can't be damaged and there is no need to turn it invulnerable.
 
Last edited:
Level 33
Joined
Mar 27, 2008
Messages
8,035
"That's because player still has control of the unit, therefore he can give orders to it, overriding the ones you give by triggers. You can prevent that by adding Locust ability to unit, or giving control of it to neutral player for the duration."

OR
You can do like this:
  • Unit - Pause (Triggering unit)
This is also to prevent the unit to follow other order
And after the spell has finished its effect, you must add this:
  • Unit - Unpause (Triggering unit)
This is to re-enable the unit to be controlled again
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Yes, Pause/Unpause action states that a unit under this action will NOT perform ANY order (but will perform AFTER unpausing the unit, so it's no use because when the caster will be unpaused once the effect is finished casting (at the end of the Target Point Ability))

Pause/Unpause cannot be used with Order Move To action
It must be used with Move Unit Instantly and play the walk animation of the unit

Problems:
If you add Locust ability to the Caster, it will look weird because we can't pick the unit while or even look at his HP / MP / Stats / Armor / etc
If you add the Caster to the Neutral Unit, the gold gain will be given to Neutral Unit, if any enemy unit is killed, therefore the Caster (which is Player Controlled Unit) will suffer a gold loss
 
Level 9
Joined
May 27, 2006
Messages
498
defskull said:
If you add Locust ability to the Caster, it will look weird because we can't pick the unit while or even look at his HP / MP / Stats / Armor / etc
It's quite commonly used in many games, so it doesn't look that weird, and people won't freak out if they can't check a units' hp for 2 seconds.

defskull said:
If you add the Caster to the Neutral Unit, the gold gain will be given to Neutral Unit, if any enemy unit is killed, therefore the Caster (which is Player Controlled Unit) will suffer a gold loss
You can use whatever other unit still under the original players' control, it isn't much of a problem.

Imho using pause only makes things more complicated, since you have to create entire movement trigger and mess with proper animation playing (those just always have to bug for me...). Also, afair, dying paused units often bug (don't play death anim, don't despawn), which would require another trigger detecting such units' death, and so on...
 
Status
Not open for further replies.
Top