Too few destructibles triggers

i tried to restore the mana of a unit that attacks a tree but, that is impossible because i can not add an event for when a tree is attacked. only is event for destructibles is alive or dead(destrutible dies).

2 Likes

Hopefully they add more events, etc. to the trigger editor. Otherwise, you might have to use JASS.

You might want to use event “Unit - A unit Is issued an order targeting an object” with conditions: “(Destructible-type of (Target destructible of issued order)) Equal to [Your tree]” and “(Issued order) Equal to (Order(harvest))” (or (Order(attack)) or whatever ability you are using).

1 Like

no, that is not doing anything.

Okay. Yeah, it turns out it’s a bit harder than I initially thought. Closest thing probably is a trigger something like this:

Untitled Trigger 001
    Events
        Unit - A unit Is issued an order targeting an object
    Conditions
        (Destructible-type of (Target destructible of issued order)) Equal to Summer Tree Wall
        Or - Any (Conditions) are true
            Conditions
                (Issued order) Equal to (Order(harvest))
                (Issued order) Equal to (Order(smart))
    Actions
        [YourActions]

This, though, has a problem: it is ran only once and only when you click the tree. If you want to, like, track every hit, your best guess is to make a unit that looks like a destructible.

Butcher is correct the best way to do this currently is create a unit that looks like a tree. Would be nice to have more triggers.

that suggestion would not work because my ideas will be used by one faction, out of multiple factions. the already suggested script does not work at all, not even once. my idea is based on the alien faction in earth 2160.

Well, it worked just fine (with the problem I mentioned) when I tested it, so you must then have something wrong or different in your case. And if it’s not possible to make a fake-destructible out of a unit, I guess you’re out of luck. You could ask around in hiveworkshop or somewhere, if someone knew if you could make it all in JASS, but I wouldn’t count on it. Just to get the unit that constructs a building requires some quite complex JASS scripting - and even that is not fool-proof.

that suggestion would not work because my ideas will be used by one faction, out of multiple factions.

I fail to see how this stops you from using a unit that looks like a destructible

that is because the other faction does not use that resource system. the hive workshop have all but banned me for no reason. the web master hates me.

Well, you can make the trigger to also check the owner of the attacking and/or the unit-type.

Well, you can make the trigger to also check the owner of the attacking and/or the unit-type.

This. There are tons of different checks you can do with units.

you are welcome to suggest something but, trees is a part of my map, so is gold mines.

Hmm… Yeah, it turns out it’s even more complicated after all. I’d suggest not to make anything too complicated, as Reforged might bring an easy solution to it. Like simply adding an event “A destructible is attacked”.

You could work around it by making units look like trees, but even that’s not so simple, as trees actually have three models (one with just stand animation, one with all the animations when they are being hit, so they swing, and one with animation when they are dead (just the stump on the ground)), plus they use a separate texture file added onto it, which cannot be added to units. At least not so easily as to just adding it in the Object Editor.