Out of Combat - Passive

Kyuft

Member
Reaction score
11
Hey TH,
I want to make a passive in data that "casts" an effect that gives the unit a shield if it is out of combat/not taking damage for 6 seconds.
For example,
Unit leaves combat
3 seconds: 1 stack
6 seconds: no change
The shield should last until destroyed.
If you could, for the future, also explain how to make it so that it does stack (Every 3 seconds out of combat you get a buff).

-Kyuft:shades:
 

Dave312

Censored for your safe viewing
Reaction score
269
Just thinking aloud:

I would use 2 buffs. Buff1 would be a counter buff designed to count the 6 seconds out of combat. Buff2 would be the stackable buff. Make sure the units start with Buff1 and give it a duration of 6 seconds. For it's Final Effect (effect that executes when the behaviour is removed) make it reapply Buff1. For its Expire Effect (effect that executes when the behaviour lasts it's full duration), make it apply Buff2. Now, you need to give Buff1 a Damage Response which, when the unit takes damage, removes Buff1 (Buff1 should be reapplied automatically because of the Final Effect). This should make it so Buff1 "resets" every time the unit takes damage and will add 1 stack of Buff2 for every 6 seconds (or whatever the duration is) the unit is out of combat.
Now if Buff 2 is non-stackable (i.e maximum stack count is one), then there would be no change for every additional duration out of combat.
As far as getting the shield to be created, you can use the Modification property on Buff2 to apply the shield.

Hope that makes some sense.
 

Kyuft

Member
Reaction score
11
I don't want the effect to ap[ply until 6 seconds after the unit leaves combat.
Like this:
In combat:
Out of combat 1 sec: no change
Out of combat 2 sec: no change
Out of combat 3 sec: no change
Out of combat 4 sec: no change
Out of combat 5 sec: no change
Out of combat 6 sec: apply buff/shield

-Kyuft:shades:
 

Dave312

Censored for your safe viewing
Reaction score
269
Sorry I guess I wasn't clear. Buff1 is a hidden buff designed to make it all work. It counts the 6 seconds out of combat and either resets the counting back to 0 if the unit takes damage (aka in combat), or applies Buff2 if 6 seconds pass without combat. Buff2 is the actual shield buff.
 

Kyuft

Member
Reaction score
11
Sorry for necro-ing, but when I said in-combat, I meant attacking or being attacked. So, how should I make the timer reset if the unit attacks another unit? Would I be able to do this through data? (I think I might have to figure this out with triggers). Something like, If the unit attacks another unit, remove Buff1.

-Kyuft:shades:
 

Dave312

Censored for your safe viewing
Reaction score
269
You can do this through data by adding another buff into the mix. The Damage Response located on a behaviour can respond in two ways: when the unit with the behaviour is attacked or when the unit with the behaviour attacks another unit. You can specify which method the the damage response responds to via the Location property in the damage response. Unfortunately you can't specify both.

So to get this working, simply create another buff, give it a damage response which with the Location set to Attacker and set the Handled property to an effect which removes Buff1. And then give this to your unit. If your having trouble getting this to work, I can post a step by step method.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top