HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

"A unit has not been attacked for 5 sec"? (easy question)?!?!?!?!?!

04-10-2004, 07:53 AM#1
GaDDeN
Ok i need so when a unit is attacked by a unit, he is added to a unit group, and when he has not been attacked by that unit for, lets say 5 seconds, he will be removed from that unit group.

This sounds so easy, but when i sit down and think of how to do it, i just get stuck!

Plz help!
04-10-2004, 01:12 PM#2
johnfn
Hmmm.

First of all, do NOT go !?!?!?!?!?!?!?! (you get the point), especially the topic.

Anyway, on to the trigger! This is actally pretty difficult, i dont blame you for not being able to figure it out.

Variables needed
units_in_array - integerUnit_group[] - unit Array
Time_left[] - integer array

Trigger nr 1
Events:
Generic unit event - A unit is attacked
Conditions:
none
Actions:
units_in_array = units_in_array + 1
Unit_group[units_in_array] = (attacked unit)
Time_left[units_in_array] = 5


Trigger nr 2
Events:
Perodic Event - Every .5 seconds
Conditions:
none
Actions:
For each integer A from 1 to units_in_array do multiple functions
Time_left[integer A] = Time_left - .5
if/then/else multiple functions
if conditions
Time_left[integer A] Less then or equal to 0
Then Actions
set unit_group[Integer A] = (no unit)
Else Actions

Whew! If your confused by that (and i imagine you might be) then ill be happy to explain it.
04-10-2004, 03:09 PM#3
GaDDeN
Ahh..... i think i got most of it, i usually figure out all probs i got.

But i got a much easier sullotion to it. Ur better then me at triggers, so i know u wud get figure this out if u just knew why i needed this:

The thing i make is so ships are affected by the wind. So when they are behind a hill, the wind stop hitting them. The "wind" is a unit that is firing with barrage on all units all the time. So when the wind unit stop hitting something, i need it to stop being affected.

Instead i made so the units are frequently slowed by 5 movement every sec. And when they are hit, the movement is set to the "wind affected movement speed".

Therefor, when they leave wind, they slowly slow down and reach normal speed!

(looks awsom)

Thanks alot anyways, the great about wc3c is all guys that spend time helping others :D
04-10-2004, 05:44 PM#4
johnfn
I could hardly understand that. Do you need me to do something? Please speak using real words, not words like "so i know u wud get figure this out", things like that make no sense.
04-11-2004, 02:42 AM#5
-={tWiStÄr}=-
what about
event - unit is attacked
action - add attacked unit to group
action - wait 5 seconds
action - remove attecked unit from group
it seems simple...
04-11-2004, 01:15 PM#6
GaDDeN
Lol sorry if my post was non-understandable, im not very good at english.

What i meant was i had it figured out. Sorry if u wasted time on helpin me, but i think all of your answers work. I just wanna note one thing about "Twistär"'s sullution:

If you add it to a unit group when hit, and then remove after 5 sec, he will be removed for about 1 sec while he is attacked (if you got that). I need it to be like poison: When he is constantly attacked, he will have this wind affections i talked about, and when he stops being attacked he will loose it.

Anyways, thanks alot for answering even if i figured it myself.