1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  4. Choose your ride to damnation in the 5th Special Effect Contest Poll.
    Dismiss Notice
  5. The winners of the 13th Techtree Contest have been announced!
    Dismiss Notice
  6. The 13th Music Contest Poll is up! Vote for the best tracks in this symphony of frost and flame.
    Dismiss Notice
  7. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  8. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Detecting Projectile Launch

Discussion in 'World Editor Help Zone' started by Melth, Nov 1, 2015.

  1. Melth

    Melth

    Joined:
    Jul 8, 2013
    Messages:
    201
    Resources:
    2
    Maps:
    2
    Resources:
    2
    In a map I'm making, there are towers which have limited ammo and fire only when ordered to Attack Ground (and which are given a Stop order to make sure they only fire once per Attack Ground order).

    The issue I have is that to make it work properly, I need to subtract from their ammo count precisely when they actually fire. If I subtract when they're merely ordered to fire, then the ammo is deducted for nothing if the player gives another order before the tower actually shoots.

    If the towers had Combat - Weapon Type : Missile, I could just give them Searing Arrows or something and track when the mana is subtracted easily enough. However, the towers need to have Artillery weapon type, which means Searing Arrows won't work for them. Is there another good way to detect precisely when the projectile fires?


    Failing that, another option which would work nearly as well would be to make the tower unresponsive to further orders for, say, half a second after getting the initial Attack Ground order. In that case, I could just subtract ammo when the order is given and the hapless player couldn't waste ammunition by issuing another order before the shot actually happens.

    However, I don't want to prevent further orders by doing things like changing the turret's owner temporarily or deselecting it and making it temporarily unselectable. It's important that the interface be as convenient as possible for firing several shots in quick succession, so I'd need the tower to stay selected but just ignore all new orders until it finished firing. Is there a way to do that?
     
  2. DEE-BOO

    DEE-BOO

    Joined:
    Apr 4, 2010
    Messages:
    505
    Resources:
    1
    Icons:
    1
    Resources:
    1
    Solutions:
    1. Use a Damage detection system. Whenever a projectile hits a target, subtract ammo.
    2. Continue with the searing arrow idea and just trigger the additional splash damage. (Probably need a DDS for this too)
    3. Lose the attack ground completely and make a custom channeling spell that fires projectiles every second and stops when ammo is zero. Base the spell off channel and make set Data - Disable other abilities - True (This will make the firing continuous and ignore other orders). Accompany this with a trigger like this: If tower attacks and tower is an ammo tower, make attacking unit cast "Shoot" at position of attacked unit.
     
  3. Melth

    Melth

    Joined:
    Jul 8, 2013
    Messages:
    201
    Resources:
    2
    Maps:
    2
    Resources:
    2
    Of those only 3 could work since ammo must be subtracted on missed shots too and since searing arrows must be unit targeted rather than point targeted.

    As far as I can recall though, Channel can't actually have projectile art. So what I would have to do with Channel would be something really clumsy like create a dummy unit target at the point Channel is aimed on, create a dummy unit launcher at the turret's point, and have the launcher make an attack or cast a spell that launches a projectile at that target unit and then trigger AoE damage when the target unit dies. And I'd need to get the animations synched up to look like it's an actual attack by the turret. There's got to be a less kludgy way.
     
  4. DEE-BOO

    DEE-BOO

    Joined:
    Apr 4, 2010
    Messages:
    505
    Resources:
    1
    Icons:
    1
    Resources:
    1
    There are Missile Systems available on the hive, so you don't have to do it yourself.
     
  5. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,640
    Resources:
    3
    Spells:
    3
    Resources:
    3
    Well... You could make the tower have instant damage (like melee units) and nullify the damage with triggers, then use a dummy unit to attack the target with 0 damage point or cast a missile ability with 0 cast point or use a missile system if that is what you want to simulate the real attack.
     
  6. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,125
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    I came here to recommend an instant-damage invisible missile but Wietlol beat me to it.
     
  7. Melth

    Melth

    Joined:
    Jul 8, 2013
    Messages:
    201
    Resources:
    2
    Maps:
    2
    Resources:
    2
    I'm going with the channel version and got everything working. However, the tower does not turn toward the point it casts the dummy spell at. This obviously makes things look wrong.
     
  8. PublishedShadow

    PublishedShadow

    Joined:
    Jun 2, 2013
    Messages:
    599
    Resources:
    2
    Maps:
    2
    Resources:
    2
  9. Melth

    Melth

    Joined:
    Jul 8, 2013
    Messages:
    201
    Resources:
    2
    Maps:
    2
    Resources:
    2
    The towers are perfectly capable of turning to attack (they're based on ancient protectors) and they did that just fine when they were actually attacking ground rather than casting Channel. The trouble is that they don't seem to turn to cast spells in particular.

    Edit: That guide does solve the problem, though the tower doesn't turn quite the way it did when it turned naturally to attack. Still, it looks good enough.
     
    Last edited: Nov 2, 2015
  10. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,125
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    You can also play its "attack" animation
     
  11. Spellbound

    Spellbound

    Joined:
    Jan 9, 2005
    Messages:
    1,963
    Resources:
    16
    Icons:
    1
    Skins:
    5
    Spells:
    9
    JASS:
    1
    Resources:
    16
    The way I went about detecting projectile launch would be to use a DDS with a custom projectile system. The unit's own projectile is set to no model, and the projectile speed to the maximum value (10,000), and the projectile type or w/e it's called (I don't have the editor open right now) to either Missile or Instant. Then you detect when damage is dealt, damage type, and whether it's spell damage or not, and then create your missile with the custom projectile system and trigger the splash damage yourself. You can see it in action here. Granted, for just 1 unit that may be a bit excessive, so if you found another way, that's probably for the best.

    Another thing you might want to do, would be to set the backswing point and the other one to 0.00 both so that the missile fires the second the unit attacks, so there's no hope of stopping it from launching. Then you can just use 'a unit is attacked' event. Doing this does mean your tower will fire at the start of it's animation though, and can look weird.
     
  12. Yugata

    Yugata

    Joined:
    May 12, 2014
    Messages:
    129
    Resources:
    0
    Resources:
    0
    Have you tried making a pretend attack ground spell?
    Instead of setting the tower's attack type to artillary, just disable it entirely. From what I read, this tower will only attack when ordered to do so, and will only do it once.
    So my idea would be to make a spell based off of Blizzard or Rain of Fire and make it look like the attack ground thing. This way, the tower only "attacks" when ordered to cast the spell. Have the spell cost 1 mana, and that should work somewhat like you want. (I think?)

    Edit: Ok, everything I just said has already been mentioned. This is why I need to learn to read.
     
  13. Acutesharpness

    Acutesharpness

    Joined:
    Aug 14, 2007
    Messages:
    935
    Resources:
    3
    Maps:
    3
    Resources:
    3
    Trick solution, when unit is attacked event, after that record the tower in variable Unit.
    Trigger 2: every 0.05 second, use a variable Real to track the attack swing time.
    Trigger 3: Detect stop/hold commands + any spell or thing that will prevent tower from attack, etc freezing breath or attack slow by liquid fire and alter the attack swing values from here, this will work flawlessly with any bugs.
     
  14. Melth

    Melth

    Joined:
    Jul 8, 2013
    Messages:
    201
    Resources:
    2
    Maps:
    2
    Resources:
    2
    Yeah, I tried and rejected that idea before posting since it looked too silly. Plus I actually like there being a slight delay and thus time to cancel the order and reconsider one's aim without penalty.


    I'm not quite sure what you're proposing here. Trigger 1 and 3 are simple enough of course, but what do you mean by "track the attack swing time"?
     
  15. Acutesharpness

    Acutesharpness

    Joined:
    Aug 14, 2007
    Messages:
    935
    Resources:
    3
    Maps:
    3
    Resources:
    3
    When the attack is been ordered there is a animation time before firing, attack delay for entertainment and realistic purpose, by removing it you will be able to do it easily but sacrificing this fun element. In triggee 1 turn on Trigger 2, at Trigger 3 still change value of attack swing value also you can stop trigger 2 if you want.
     
  16. Spellbound

    Spellbound

    Joined:
    Jan 9, 2005
    Messages:
    1,963
    Resources:
    16
    Icons:
    1
    Skins:
    5
    Spells:
    9
    JASS:
    1
    Resources:
    16
    He's saying start a timer when the 'a unit is attacked' event that ends when the backswing time is reached. Aka, you manually time for the duration between the attack and the launch and use the end of the timer as the moment you reduce the ammo count. Any order change during the timer other than attack would result in the timer ending prematurely, and thus the ammo not being deducted.