• 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.

[Trigger] 2nd times the charm

Status
Not open for further replies.
Level 10
Joined
Jan 21, 2007
Messages
576
Alright im making and upcoming map called The Tavern and it includes various heroes created by people here at the hive but this is besides the point.

One ability is called Mind Flay, the first time it is cast not all the dummy units are either created or receive the items created via trigger im not sure wich. I think usualy 1 unit gets the spell from the item casted on them the first time i cast mindflay. But the 2nd+ times i cast it it works perfectly does anyone know whats wrong?

  • MF I
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Mind Flay - Mind Flayer
    • Actions
      • Set L = (Position of (Casting unit))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 600.00 of L matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of (Casting unit))) Equal to True))) and do (Actions)
        • Loop - Actions
          • Set Mana_MindFlay = (Mana_MindFlay + (Integer((Mana of (Picked unit)))))
          • Unit - Set mana of (Picked unit) to 0.00%
          • Set L = (Position of (Picked unit))
          • Special Effect - Create a special effect at L using Abilities\Spells\Human\DispelMagic\DispelMagicTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Custom script: call RemoveLocation(udg_L)
          • Unit - Cause (Casting unit) to damage (Picked unit), dealing ((Real(Mana_MindFlay)) / 3.20) damage of attack type Chaos and damage type Normal
          • Set Mana_MindFlay = 0
          • Set L = (Position of (Picked unit))
          • Item - Create Dummy MI Item at L
          • Unit - Create 1 Dummy Unit for (Owner of (Casting unit)) at L facing Default building facing degrees
          • Hero - Give (Last created item) to (Last created unit)
          • Custom script: call RemoveLocation(udg_L)
          • Hero - Order (Last created unit) to use (Item carried by (Last created unit) in slot 1) on (Picked unit)
          • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation(udg_L)
 
Level 5
Joined
Jun 23, 2004
Messages
126
For starters, instead of doing that silly thing where you create an item and then give it to the hero, simply use the function that "creates item for hero". It's either under the Hero or Item section.

This is where you use debug messages. This trigger seems fine, probably some other factor is influencing it. Set up messages that play whenever something happens. Or maybe don't add the expiration timer and make the unit visible so you can click it and see if it gets the item and what slot it's in and whether it can cast it.
 
Level 10
Joined
Jan 21, 2007
Messages
576
First off i already did all of what you have both said hers what the spell does:

Adds up all the mana of all nearby enemy units and sets it to a variable then it sets all enemy units mana to 0 it then divides the variable by 3.2 and deals w/e that equals to each indiviguale unit. At the same time an illusion is made of each nearby enemy unit.

The item is a castable mirror image it is given to the dummys then they cast it on all nearby enemies. The first time the spell is cast only 1-2 dummy units are created regardless of how many nearby enemies there are. I am well aware of the "Create item for hero" (wich is under hero not item btw) function but i tried this to c if it affected it at all. The dummy units inventory only has 1 slot the item -will- be in slot 1 ^^.
 
Status
Not open for further replies.
Top