• 🏆 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] How do I....(a trigger-skill question)

Status
Not open for further replies.
Level 4
Joined
Dec 10, 2008
Messages
59
Hello.

I have a question, how do you make the effect of an ability starts only AFTER the ability's projectile hits the target?

thanks in advance for any help =D
 
Level 14
Joined
Jul 1, 2008
Messages
1,314
1. Posibility: Use a damage detection system. Easy, but you have to know, how to use it, and where to find it.

2. Posibility: Trigger it yourself.

I would prefer this way:

You need some variables,

"YourUnit" -> global unit variable,
(save the unit, which should cause this effect in there. )
TempPoint1 -> Point variable,
TempPoint2 -> Point variable,
TempUnit -> unit variable.

Create them in the editor or use your own variables.

First thing is, my idea:

You want to wait, after your unit attacked an enemy, and maybe if some other comparissons return true, so you have to find out, how long the missile of the attack flies to the target.

This is easy to find out. Just remember
JASS:
v = s/t, t = s/v

s is the distance between the attaking unit and the target.
v is the speed of the bullet, you can find out this value in the object editor.

First thing in the trigger is, we find out the distance between target and attacker.
Second thing is, we wait distance/speed seconds, and create the a special effect on or at the position of the unit.

  • Ereignisse
    • Unit - A unit begins the effect on an ability
  • Bedingungen
    • // You could insert other comparissons here, just like some boolean variables usw.
    • (Triggering unit) Equal to "YourUnit"
    • ((Triggering unit) belongs to an ally of (Owner of (Target unit of ability being cast))) Equal to False
  • Aktionen
    • Custom script: local effect e
    • Custom script: local location loc1
    • Custom script: local location loc2
    • Custom script: local unit u = GetSpellTargetUnit()
    • Set TempPoint1 = (Position of (Target unit of ability being cast))
    • Set TempPoint2 = (Position of (Triggering unit))
    • Custom script: set loc1 = udg_TempPoint1
    • Custom script: set loc2 = udg_TempPoint2
    • Wait ((Distance between TempPoint and TempPoint2) / SPEED OF THE ABILITY BULLET) seconds
    • Custom script: set udg_TempUnit = u
    • Spezialeffekt - Create a special effect attached to the overhead of TempUnit using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
    • Custom script: set e = bj_lastCreatedEffect
    • Wait 1.00 seconds
    • Custom script: call DestroyEffect(e)
    • Custom script: set e = null
    • Custom script: set u = null
    • Custom script: call RemoveLocation(loc1)
    • Custom script: call RemoveLocation(loc2)
    • Custom script: set loc1 = null
    • Custom script: set loc2 = null
All these actions can be found in the editor.

Edit: Oh i saw, that you want it after an ability, i changed the trigger.
 
Status
Not open for further replies.
Top