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

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.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
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.
 
Level 7
Joined
May 14, 2019
Messages
255
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.
 
Level 9
Joined
Mar 17, 2017
Messages
464
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
 
Level 8
Joined
May 21, 2019
Messages
435
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.
Top