HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Generic Unit-attack trigger on damage possible?

01-20-2007, 05:10 PM#1
Brash
is there a way to get a generic unit to trigger an event on the damage of another generic unit? nothing localized.

i want this one trigger to go off the moment a unit is attacked so that it looks like it's connecting at the same time.

the best way i've come up with is using an orb effect buff and starting it the moment it detects that buff BUT.. i want this to stack with other buffs/orbs/bash/crits.. no interupts.

is this possible?
01-20-2007, 05:38 PM#2
Jacek
on map init, pick all units, add event to other trigger - (Picked unit) takes damage. make second trigger - unit enters playable map area, add event to other trigger (the one you pick in action before) - (Entering unit) takes damage.

the trigger you are adding events to is now generic unit takes damage event

decipher it for yourself haxbbq
01-20-2007, 05:59 PM#3
Brash
i dont quite grasp what you are saying. something about having one trigger on the event of map initiatiation to add an event to a 2nd trigger of unit takes damage.. is that all you are saying? because it seems like you are also saying something else. what's the purpose of a "pick all" though? and it sounds like there are 3 trigs involved here.
01-20-2007, 07:02 PM#4
oNdizZ
Trigger:
Melee Initialization
Collapse Events
Map initialization
Conditions
Collapse Actions
Collapse Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
Collapse Loop - Actions
Trigger - Add to asd <gen> the event (Unit - (Picked unit) Takes damage)

thats what he's talking about. since the event you want isn't generic you'll have to pick every unit at map init (and when they are created/entering the map area) and use the action that adds a new event to a specific trigger.
that way you'll have one event for every unit = you'll get what you want.
01-20-2007, 07:28 PM#5
Brash
okay i tried what he said and it keeps stacking events.. first time the unit receives damage it runs trigger once..

2nd time they are damaged it runs the trigger twice because now it added a 2nd event of the same thing..

eventually i'll have a hundreds of events because it will keep adding them to that trigger every time a unit enters. (this map spawns a lot of new units regularly)



Edit> well it seems to work after further tests.. since my map is a defense map that spawns unit after unit will this cause any lag having zillions of events in that one trigger?
01-20-2007, 07:49 PM#6
Ammorth
Yes. Try looking into damage detection systems instead.
01-20-2007, 07:53 PM#7
rain9441
It might cause lag.

I've noticed that if you add the event "Specific unit takes damage" to a trigger 1000000 times, you won't get lag. Units that are destroyed, removed, etc, will never fire the trigger (some optimizing must take place behind the scenes)...


The lag comes when you have such a trigger and it is extremly complex. If 100 units are taking damage 100 times a second, you're trigger will be executed 10000 times a second, so if you're trigger has any sort girth to it, you're going to get serious lag.

If you keep it simple, it won't lag. Avoid game cache calls if at all possible, and if you must.... I'd suggest only having one call, GetStoredInteger(), which returns some index to some array/struct.

I had a tower defense map do this once, and it noticably lagged any computer when alot of action was going on (and in tower defense, at later stages, one can assume theres lots of damage being dealt fairly often).

good luck!
01-20-2007, 09:07 PM#8
Brash
is there a way to restrict it to only certain kinds of damage? like attacks only and not damaging spells? or only certain kinds of damaging spells and not others that cause damage?



i really would like to keep it restricted to just attacks done in a regular fashion of seeing the unit swing and actually hit the unit.

<edit> ammorth
Quote:
Yes. Try looking into damage detection systems instead.
if you are referring to orb detections this must be something that stacks with orbs and bash/crits.

unless if there are other systems i'm unaware of.

<edit again>
ah ha! i found a way to do it without an orb and only during attacks. i have a whole seperate trig detect when a unit is attacked.. then i assign that attackING unit to a var.. then in the other main trigger i have it so that that unit is compared to the damaging unit and when the two match, it does the actions.. then it takes that var from the attackING unit and it sets it to equal 'no unit' so that this way it waits for the attack trigger to reassign it again..

then i have a 3rd trigger that waits for all of the starts effect/begins casting/channeling ability events to occur and if that happens i know that it's a spell they are attempting to damage the unit with so i immediately have this trig assign the "attackING" unit var = to "no unit" again so that this way it's always guaranteed that that unit will not match the condition checker found in the main trigger that looks for the damaging source unit.

mahaha

thx guys.