PDA

View Full Version : [Trigger] Question about add event action


darkrider
09-24-2008, 05:21 PM
if i add an event to a trigger via "add event" action and i do that a lot of times... the new added events will replace the older ones? or will they stack in a bunch of events on the same trigger?

Dr Super Good
09-24-2008, 05:41 PM
It will keep stacking until you destroy the trigger. Even if the unit dies for a specific unit event, it will be kept and thus may leak if you are not careful.

darkrider
09-24-2008, 09:57 PM
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?

Dr Super Good
09-24-2008, 11:58 PM
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.

zandose
09-25-2008, 03:34 AM
I just took a glimpse. If this is to detect when a unit is hit I suggest you use a attack detect engine.

Intuitive Damage Detection System - Wc3campaigns (http://www.wc3campaigns.net/showthread.php?t=100618)
ADamage - a damage detection and prevention engine - Wc3campaigns (http://www.wc3campaigns.net/showthread.php?t=102079)
Light Leakless Damage Detect - Wc3campaigns (http://www.wc3campaigns.net/showthread.php?t=101865)

darkrider
09-25-2008, 04:19 AM
well... i found this one very interesting ADamage - a damage detection and prevention engine - Wc3campaigns (http://www.wc3campaigns.net/showthread.php?t=102079)... also griffen looks cool


But i have a very big problem... i have no idea about jass :/

zandose
09-25-2008, 02:40 PM
Look's like your getting plenty of help from wc3campaigns :)

Captain Griffen
09-25-2008, 04:04 PM
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
09-25-2008, 04:38 PM
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?

Captain Griffen
09-25-2008, 10:58 PM
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.

Dr Super Good
09-25-2008, 10:59 PM
Ah this would explain random map crashes that occur in some maps.

13est
09-26-2008, 05:13 PM
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.

Dr Super Good
09-26-2008, 11:21 PM
Its cause you leak a ton.

Stick to Captian Griffins ways or systems as he knows these things.

Captain Griffen
09-26-2008, 11:45 PM
13est, if you're going to use GUI, have on trigger which has all of the events and then fires off all of the damage event triggers, that way you don't have more than one damage event per unit, and thus less leaks.