• 🏆 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] Custom ability not working

Status
Not open for further replies.
Level 4
Joined
Jul 10, 2013
Messages
73
I have a "hotwire" ability that allows a player to steal a car from a computer player and use it.
The player can also obtain a car through the use of building it themselves with money.
My plan for this ability was to have the player use it on a car, have the car be theres while the ability they used to get it (Hotwire) goes away until the car dies.
I have two different cars in my game, one is for the computer that doesn't move and another has movement speed and more hp.
My problem right now is that nothing happens when the ability is used.

  • Hotwire
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Unit-type of (Target unit of ability being cast)) Equal to Car
      • (Ability being cast) Equal to Hotwire (C) (channel)
    • Actions
      • Set Point = (Position of (Target unit of ability being cast))
      • Unit - Remove (Target unit of ability being cast) from the game
      • Unit - Create 1 Car (F) (Human) for (Triggering player) at Point facing Default building facing degrees
      • Special Effect - Create a special effect at Point using Abilities\Spells\Human\DispelMagic\DispelMagicTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Unit - Remove Hotwire (C) (channel) from (Triggering unit)
      • Custom script: call RemoveLocation(udg_Point)
I will have 9 players who can steal cars, thus I will have 9 of these triggers below. If theres a way to have less I would interested!

  • Hotwire1
    • Events
      • Unit - A unit owned by Player 1 (Red) Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Car (F) (Human)
      • (Level of Hotwire (C) (channel) for Hero1) Greater than 0
    • Actions
      • Unit - Add Hotwire (C) (channel) to (Hero1)
 

Jampion

Code Reviewer
Level 15
Joined
Mar 25, 2016
Messages
1,327
I think target unit of ability being cast does not work for "finishes casting", but I am not so sure about it. In most cases you want to use "starts the effect", but if there is some kind channeling going you have to do it differently.
 

Jampion

Code Reviewer
Level 15
Joined
Mar 25, 2016
Messages
1,327
Is the variable Hero1 set correctly?
Your condition "Level of Hotwire greater than 0" means, that the hero has this ability. So bascially what you do is:

if hero has ability hotwire
add hotwire to hero
 
Level 8
Joined
Jan 28, 2016
Messages
486
You can simplify the second trigger, assuming that the neutral players (Neutral Hostile and such) along with Player 10, 11 and 12 don't have access to that unit type.

  • Simplify
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Car (F) (Human)
    • Actions
      • Unit - Add Hotwire (C) (channel) to HeroArray[(Player number of (Owner of (Triggering unit)))]
Just to be clear, the HeroArray variable is a unit array so that you won't need 9 copies of a unit variable.
 
Status
Not open for further replies.
Top