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

[Solved] What's wrong with my trigger

Status
Not open for further replies.
Level 5
Joined
Feb 18, 2009
Messages
123
  • Kurohitsugi
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Hadou #90 : Kurohitsugi
    • Actions
      • Unit - Create 1 Kurohitsugi Dummy for (Owner of (Triggering unit)) at (Position of (Target unit of ability being cast)) facing Default building facing (270.0) degrees
      • Set Kurohitsugi = (Last created unit)
      • Unit - Pause (Triggering unit)
      • Animation - Play (Triggering unit)'s spell throw animation
      • Set kurohitsugi_base_damage = ((Real((Intelligence of (Triggering unit) (Include bonuses)))) x ((((Real((Level of Hadou #90 : Kurohitsugi for (Triggering unit)))) - 1.00) x 0.50) + 3.00))
      • Unit Group - Pick every unit in (Units within 512.00 of (Position of Kurohitsugi) matching (((Matching unit) is A structure) Equal to False)) and do (Actions)
        • Loop - Actions
          • Unit - Pause (Picked unit)
          • Unit - Make (Picked unit) Invulnerable
          • Unit Group - Add (Picked unit) to Kurohitsugi_Target
      • Wait 2.00 seconds
      • Unit Group - Pick every unit in Kurohitsugi_Target and do (Actions)
        • Loop - Actions
          • Unit - Make (Picked unit) Vulnerable
          • Unit - Cause Kurohitsugi to damage (Picked unit), dealing (500.00 + (kurohitsugi_base_damage - ((kurohitsugi_base_damage x 1.50) - (0.02 x (Real((Intelligence of (Triggering unit) (Include bonuses)))))))) damage of attack type Spells and damage type Magic
          • Unit - Unpause (Picked unit)
      • Special Effect - Create a special effect at (Position of Kurohitsugi) using Objects\Spawnmodels\Undead\UCancelDeath\UCancelDeath.mdl
      • Unit - Remove Kurohitsugi from the game
      • Unit - Unpause (Triggering unit)
      • Wait 1.00 seconds
      • Special Effect - Destroy (Last created special effect)
the idea is to create a Kurohitsugi spell like in bleach, but the triggers seems only work until this point
  • Kurohitsugi
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Hadou #90 : Kurohitsugi
    • Actions
      • Unit - Create 1 Kurohitsugi Dummy for (Owner of (Triggering unit)) at (Position of (Target unit of ability being cast)) facing Default building facing (270.0) degrees
      • Set Kurohitsugi = (Last created unit)
      • Unit - Pause (Triggering unit)
      • Animation - Play (Triggering unit)'s spell throw animation
      • Set kurohitsugi_base_damage = ((Real((Intelligence of (Triggering unit) (Include bonuses)))) x ((((Real((Level of Hadou #90 : Kurohitsugi for (Triggering unit)))) - 1.00) x 0.50) + 3.00))
      • Unit Group - Pick every unit in (Units within 512.00 of (Position of Kurohitsugi) matching (((Matching unit) is A structure) Equal to False)) and do (Actions)
        • Loop - Actions
          • Unit - Pause (Picked unit)
          • Unit - Make (Picked unit) Invulnerable
          • Unit Group - Add (Picked unit) to Kurohitsugi_Target
why?

sorry if there is any miss spelling for my bad english
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
1- You can always use "(Triggering Player)" to replace "(Owner of (Triggering Unit))" It's faster for you, and more efficient for the trigger/system.

2- Welcome to the world of "Leaks". Whenever you use some things like Points (Position of...) Special Effects, Unit/Player Groups (Pick every unit in *UnitGroup* and do...), they remain stored in memory, and if you don't clean/remove them, you'll store them as gargabe, and eventually, your game will lag a lot, and become unplayable.

2.1. To use Points (Position of...) create a Point Variable (I'll call it "Point"), declare it before using it (Set Point = Position of ...), use it (Create 1 xxx in Point) and then remove it [Exactly this -> Custom script: call RemoveLocation(udg_Point) where "Point" is "Your_Point_Variable_Name"].

2.2. To use UnitGroups create a UnitGroup Variable (I'll Call it "Group") declare it before using it (Set Group = Units within 512.00 of Your*Point*Variable matching (((Matching unit) is A structure) Equal to False)) and do (Actions)) then use it (Pick every unit in *Group* and do...) then remove it [Exactly -> Custom script: call DestroyGroup(udg_Group) where "Group" stands for Your_Group_Variable_Name.

2.3 Most special effects can't be destroyed inmediatly after creating them. If you use wait's between creation and destroying, you'll may create another special effect in the mean time, and destroying (last Created special effect) would destroy the last one, not the one you would want to.

3- Wait actions are bad, mean. I don't like them. Try to avoid them unless you really need to. Wait actions break some relations between the actions and the objects involved in the Trigger event.

4- So far, What's wrong with the trigger? What's what you want to achieve? What is it supposed to do?

5- You declared " Set Kurohitsugi = (Last created unit) ", then you used a Wait action, and then another action involving "Kurohitsugi". The "Wait" breaks the unit variable relation. I'm not sure about this, but I think so =/.

6- The way it's right now, it will only be castable by one unit at the same time. If two units casts the ability at the same time it will bug.
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
- put a debug message after this >>> Wait 2.00 seconds and see what happen...
- waits are fine as long as the spell is used by 1 unit only and has cooldowns...
- i can only see loads of leaks here >>> positions, groups, effects...
- in some instanses, pause unit when casting an ability is really bad coz it will loop your spell forever...
- anyway, maybe your group is empty?...
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
waits are fine as long as the spell is used by 1 unit only and has cooldowns...
You forgot to mention, (Triggering unit) can use Wait as much as it wants and doesn't occur any bug to it

Since (Triggering unit) is the native function, it is already MUI in all aspects.

  • Triggering Unit
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Divine Shield
    • Actions
      • Wait 5.00 seconds
      • Unit - Hide (Triggering unit)
This trigger is indeed, MUI.

Also, the usage of local variable + wait = MUI too
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
It does not say it is wrong or not, but it will make the trigger not MUI (well, there is a way to make it MUI back, just follow the previous post for conditions)

If you does not use Wait efficiently, it can ruin your trigger to become non-MUI

What is MUI ?
It stands for Multi-unit Instanceable. It means that 2 or more units in the same map, can cast the spell simultaneously with no bugs at all

Okay, now to test if your trigger is MUI or not, just test your current spell trigger with 2 units casting it simultaneously

You will notice that only one of the unit execute the spell correctly while the other, stumble and stuck

This is because the trigger will read the last assigned value for the unit

There are 2 methods to make your trigger MUI; Indexing or Hashtable

To learn more about MUI/MPI: Hashtable and Indexing
 
Level 5
Joined
Feb 18, 2009
Messages
123
i think its ok if the trigger isn't MUI because its only for a hero in an arena
and anyway i think the event A unit Begins casting an ability is not good so i changed it toStarts an effect of an abilty, and follow Spartipilo's post
then its now working thanks to all of you:goblin_good_job::thumbs_up:
 
Status
Not open for further replies.
Top