• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Help with trigger

Status
Not open for further replies.
Level 7
Joined
May 14, 2019
Messages
255
I made a trigger that basically gives +250 gold to a player if a unit goes up to a neutral structure and clicks an ability, how would I identify this unit(the unit that goes near the neutral structure)? If I use Set <Variable> = (Casting Unit) , it sets the neutral structure as the variable.
 
As far as I am aware one cannot do this directly.

One approach would be to guess who used the ability. If only 1 player is nearby the neutral structure then obviously they are the one who used the ability. However if many are nearby this will not be accurate and so might determine the incorrect player.

Another approach is to create a dummy structure for every player that they own and overlap them at the site of the neutral structure. Then when a player selects the neutral structure and with some latency you then change selection to the dummy unit which they then use the ability on.
 
This is a lot more complicated than I thought, I was thinking there was some trigger action that I missed or there was some other way to precisely determine the player, well thanks anyway.
 
There might be another way this could be done, I know you can detect the player that selects a unit with the event Player x selects a unit, you could make a dozen triggers each one activating only when a certain player selects the neutral structure, but each trigger saves the player that selected the structure in a variable, thus making him identifiable.

try this out and see if it helps you
 
So... let me get this straight.
You have a neutral structure with an ability.
What you want, is for players who use this ability to gain 250 gold whenever they use the structures ability while having a unit near it?

It kind of sounds like you are trying to give the structure the ability to "give gold". Why not just give the structure a gold coin item worth 250 gold?
Alternatively, if you want the gold to be a trigger event for condition purposes, you could just make it sell an instantly consumed item with no effect (like a tome with +0), and then track the patron based on the unit aquiring the item. That's how most of these things are made.

Please do tell if I haven't understood what you are trying to do correctly.

It'd be helpful if you clarified the context of this trigger. What is the overall purpose of this? Maybe the thing you are trying to design can be made using a far simpler approach.
 
Status
Not open for further replies.
Back
Top