• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Question about add event action

Status
Not open for further replies.
Level 11
Joined
Dec 31, 2007
Messages
780
  • Gordon attacks with bone breaker
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • Bone_Breaker_Boolean Equal to False
      • (Unit-type of (Attacking unit)) Equal to Minotaur Gordon
      • ((Attacking unit) is an illusion) Not equal to True
      • (((Attacked unit) is A structure) Not equal to True) and (((Attacked unit) belongs to an ally of (Owner of (Attacking unit))) Not equal to True)
      • (Random integer number between 1 and 100) Less than or equal to Bone_Breaker_Percentage
    • Actions
      • Set Bone_Braker_target = (Attacked unit)
      • Trigger - Add to Gordon Deals damage with bone breaker <gen> the event (Unit - Bone_Braker_target Takes damage)
      • Trigger - Turn on Gordon Deals damage with bone breaker <gen>
  • Gordon Deals damage with bone breaker
    • Events
    • Conditions
      • (Damage source) Equal to Gordon
    • Actions
      • Set Bone_Breaker_Boolean = True
      • Set Bone_Breaker_Extra_Damage = (Damage taken)
      • Set Location4[49] = (Position of Gordon)
      • Floating Text - Create floating text that reads (String((Integer(Bone_Breaker_Extra_Damage)))) at Location4[49] with Z offset 90.00, using font size 12.00, color (100.00%, 20.00%, 20.00%), and 10.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Set the velocity of (Last created floating text) to 80.00 towards 90.00 degrees
      • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
      • Special Effect - Create a special effect attached to the chest of (Attacked unit) using Objects\Spawnmodels\Human\HumanBlood\BloodElfSpellThiefBlood.mdl
      • Special Effect - Destroy (Last created special effect)
      • Trigger - Turn off (This trigger)
      • Unit - Cause Gordon to damage Bone_Braker_target, dealing Bone_Breaker_Extra_Damage damage of attack type Chaos and damage type Universal
      • Custom script: call RemoveLocation(udg_Location4[49])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 30
        • Then - Actions
          • Unit - Set level of Cripple |Demonic Harp Slow for Bone_Breaker_Caster to ((Level of Bone breaker ( Minotaur Gordon ) for Gordon) + 13)
          • Unit - Order Bone_Breaker_Caster to Stop
          • Unit - Order Bone_Breaker_Caster to Undead Necromancer - Cripple Bone_Braker_target
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Bone_Braker_target has buff Broken leg ) Not equal to True
            • Then - Actions
              • Unit - Set level of Cripple |Demonic Harp Slow for Bone_Breaker_Caster to ((Level of Bone breaker ( Minotaur Gordon ) for Gordon) + 9)
              • Unit - Order Bone_Breaker_Caster to Stop
              • Unit - Order Bone_Breaker_Caster to Undead Necromancer - Cripple Bone_Braker_target
            • Else - Actions
              • Do nothing
      • Set Bone_Breaker_Boolean = False

Mr doctor... those are my triggers... what do you suggest?
 
Level 14
Joined
Nov 20, 2005
Messages
1,156
Don't destroy triggers casually. DestroyTrigger can cause major bugs that can basically cause a map to implode. My system does so only rarely, and in very well defined circumstances, and even then I have made sure to provide a way to disable that and just let it build up events leaking. As such...

Use JASS and make it that a single trigger is used per event. That way all event leaks can be easilly delt with without interfearing with other still used events.

Is several years out of date.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,223
How is it several years out of date? WC3 has not changed much JASS wise since the first few patches so how can it be out of date?

Also I have never had any problems caused by destroying triggers. It causes your map to implode in what way?

I take it using 1 trigger that occasionally gets cleaned (destroyed and remade) is more efficent?
 
Level 14
Joined
Nov 20, 2005
Messages
1,156
How is it several years out of date? WC3 has not changed much JASS wise since the first few patches so how can it be out of date?

Also I have never had any problems caused by destroying triggers. It causes your map to implode in what way?

Because we learned. We learned the hard way. Destroy trigger can cause the handle stack to get screwed. This means that two handles can have the same index. Handle variables work by indexes. This means two handles have the same variable. Everything can then break.

I take it using 1 trigger that occasionally gets cleaned (destroyed and remade) is more efficent?

Less chance of bugging and more memory efficient. Note that it also puts the trigger to sleep for 10 minutes before destroying it.
 
Level 1
Joined
Feb 27, 2007
Messages
8
If you don't know jass like me you can use this.

  • add event
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Set Locate_Unit = (Entering unit)
      • Trigger - Add to ice tower <gen> the event (Unit - Locate_Unit Takes damage)
      • Trigger - Add to shaman tower <gen> the event (Unit - Locate_Unit Takes damage)
      • Trigger - Add to duffman <gen> the event (Unit - Locate_Unit Takes damage)
      • Trigger - Add to Level 6 run <gen> the event (Unit - Locate_Unit Takes damage)
      • Trigger - Add to Level 9 Magic Shield <gen> the event (Unit - Locate_Unit Takes damage)
      • Trigger - Add to Level 10 Last Will <gen> the event (Unit - Locate_Unit Takes damage)
      • Trigger - Add to Level 13 invulerable <gen> the event (Unit - Locate_Unit Takes damage)
      • Trigger - Add to Level 15 sprint <gen> the event (Unit - Locate_Unit Takes damage)
      • Trigger - Add to Level 16 heal <gen> the event (Unit - Locate_Unit Takes damage)
      • Trigger - Add to Level 20 wind walk <gen> the event (Unit - Locate_Unit Takes damage)
      • Trigger - Add to Level 22 rejuvenation <gen> the event (Unit - Locate_Unit Takes damage)
      • Trigger - Add to Level 30 Massive roots <gen> the event (Unit - Locate_Unit Takes damage)
As you se it activates a lot of triggers, and for me it works.

Here is an example when I use it to get an random ice attack.
  • ice tower
    • Events
    • Conditions
      • (Unit-type of (Damage source)) Equal to Ice Tower
      • ((Attacked unit) has buff Phoenix Fire) Equal to True
    • Actions
      • Unit - Create 1 (Ice Tower) for (Owner of (Damage source)) at (Position of (Attacked unit)) facing (Position of (Attacked unit))
      • Unit - Order (Last created unit) to Attack (Attacked unit)
      • Unit - Add a 0.35 second Generic expiration timer to (Last created unit)

But I have had a few problems when attaching it to running mobs in TD's but I don't know what the problem was but I fixed it by turning on and off the trigger.

Example:
  • Level 13 invulerable
    • Events
    • Conditions
      • (Mana of (Attacked unit)) Greater than or equal to 10.00
      • (Unit-type of (Attacked unit)) Equal to Level 13
    • Actions
      • Trigger - Turn off (This trigger)
      • Unit - Create 1 (level 13) for Neutral Hostile at (Position of (Attacked unit)) facing (Position of (Attacked unit))
      • Unit - Order (Last created unit) to Undead Banshee - Curse (Attacked unit)
      • Unit - Add a 0.35 second Generic expiration timer to (Last created unit)
      • Unit - Set mana of (Attacked unit) to ((Mana of (Attacked unit)) - 10.00)
      • Unit - Make (Attacked unit) Invulnerable
      • Trigger - Turn on (This trigger)
      • Wait until (((Attacked unit) has buff Divine Shield) Equal to False), checking every 0.49 seconds
      • Unit - Make (Attacked unit) Vulnerable


EDIT: IMPORTANT this is not tested stable by me. And you should think twice and rather talk with a "pro" before.
Even though I am using it, I do not want to recommend this to you.
 
Last edited by a moderator:
Status
Not open for further replies.
Top