• 🏆 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!

Get buff origin/caster?

Status
Not open for further replies.
Level 3
Joined
Jun 22, 2007
Messages
13
I am currently trying to reimplement my WC3 abilities to SC2 and would like to do it without using triggers, where possible. So far, I was successful but am not sure, how to implement the more advanced abilities without using triggers - if even possible at all.

Question:
Is it possible to figure out the origin/caster of a certain buff and use that as reference for other abilities?

Scenario:
In my multiplayer map, I have a unit (Caster) that can apply a buff to (one and only one) other friendly unit (Target). While being affected by that buff, there is a chance that attacks done by the Caster trigger some bonus effects (healing, etc.) on the Target.

Since it is possible that there are more than one units of type Caster, I need to figure out which buff comes from which Caster, so that the bonus effects are applied from the right source to the right target.

Any ideas or suggestions? I haven't played around with validators yet, so I am not sure if that's a possibility. As said before, I would like to do it without triggers (i.e. not keeping an array of Casters and thier Target that I check on every attack).


Many thanks in advance :)
 
Level 9
Joined
Dec 21, 2006
Messages
490
i have asked this question before and got no answer so i think it is not possible. you could create the same ability 10x times and just validate the buff, e.g. player 1 uses heal1, player 2 uses heal 2 with buff1 and buff2. doing it by triggers would be easier i guess.
 
Level 3
Joined
Jun 22, 2007
Messages
13
@DSG: I was thinking/hoping that a buff must contain this information. The question is if one can test for it. and how.

@Daelin: I am trying to make an ability that is called "Brother in Arms" for my meele healer class. The caster can declare (i.e. apply a buff to) one friendly unit. If the caster has declared a Brother in Arms, every meele attack done by the caster can trigger an effect that heals the designated target.

Since players can pick (and repick) thier classes freely, there can be more than one meele healer per team, so I need to figure out which buff comes from which unit in order to apply the bonus effect to the right target (and give credit to the right healer).

In WC3, I did it purely with triggers and using gamechache to keep track of which healer buffed what unit. For SC2, I was hoping that I can do an area search effect and use a "buff orign equals caster" or such to find the right unit. Applying the buff to a target is no problem, having a certain chance per hit to trigger an effect and doing a search to get all friendly units in range that have the buff is also easy. The question is: how to find the unit that has MY buff and not units buffed by other players in my team.
 
Last edited:
Level 11
Joined
Jul 20, 2004
Messages
2,760
Sorry for the delayed response, wasn't home last night.

Alright, I was *this* close from admitting that it is indeed impossible to do it only via the Data Editor. Except... it isn't! And no, we're not talking about some cheap "different ability/different caster" solution. The solution I am going to present is so generic, it actually works for different casters of the same player!

Start by downloading and testing the map I attached. Damage one of the marines, then place him under the buff. Start hitting units randomly with that caster, then, and notice how feedback effects spawn only on the targeted marine. You can even try and target multiple marines with that ability - it will work!

Now let's discuss the implementation a little.

a) The Ability - it's an Target Effect that calls the Apply effect to apply the buff you want on the target.
  • Buff - periodically generates a persistent effect. Duration of effect is identical with duration of persistent. This approach is necessary in case someone dispels the buff off the target - the persistent needs to be refreshed periodically, otherwise the spell would work even in the absence of the buff.
  • Persistent Effect - is essential for setting up the marker on the target. Its Target Marker field is told to link the marker to the Casting Unit, and label it based on the Link path. For as long as the persistent lasts, targeted units will remain marked. When the persistent is destroyed, all markers are released.
  • Mark effect is in-fact a dummy Damage Effect (deals 0, non-fatal damage). It is necessary, since the persistent itself does not set a marker on the target unit - and neither do the apply behavior and the buff itself (besides, they are 'prior' to the Persistents, so markers could not be set).

b) The Heal Effect - I modified the marine's Gauss Rifle to embed the effect. Therefore, everytime the unit attacks, instead of calling directly the damage effect, first a Set is triggered.
  • Set effect first and foremost sets up the marker tree for the healing effect. I set the Count to 0 so it does not add any subsequent markers (due to the damage/heal effects), and the same match flags (both link and Casting Unit). Next it performs an area search to find all 'brothers', followed by the damage on the target itself.
  • Search Area effect looks for potential brothers globally. We can do little to minimize the search here. It calls the heal effect for all these potential units.
  • Heal Me validates the target prior to the healing by looking for markers. Due to the Markers field on the parent Set Effect, the markers will be located properly!

Notes about the current implementation
- Markers are tricky. In the current implementation, the effect does not stack for the same caster on the same unit! The duration is prolonged, though, if it is cast multiple times on the same unit.


I will not deny the solution was done by means of trial-and-error. Markers are still not 100% clear to me, but I am beginning to understand how they work. If you notice any bugs please let me know and I'll see what I can do to fix them.

Cheers! :thumbs_up:
~Daelin
 

Attachments

  • Brother In Arms.SC2Map
    16.1 KB · Views: 63
Level 3
Joined
Jun 22, 2007
Messages
13
Awesome, thanks Daelin!

Tested your map and that is excatly, what I was looking for. I've noticed Markers befored, but had no clue, what they were supposed to do... I'm really starting to like the flexibility and possibilities of the data editor. I'll play around with markers some more and tell you, if I notice anything.

Thanks again for taking the effort! I'd rep you, but I already did on your ability tuturial so it won't let me :)
 
Last edited:
Level 11
Joined
Jul 20, 2004
Messages
2,760
Markers are probably one of the most complex and poorly studied aspect of the data editor. There are a few tricks about them I will probably present in my next tutorial - it is practically pointless to try and develop chain/wave/cone/nova spells without markers.

Have fun experimenting, though! :)
 
Status
Not open for further replies.
Top