• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Detect Casting Player

Status
Not open for further replies.
Level 8
Joined
Oct 12, 2011
Messages
483
I have a building on say Player 2 that has the "Select Hero" ability and some random spell. Thus, when you, Player 1, run a Hero up to the building, you can select the building and cast the spell. What I want to know is if you can tell which player casts the spell, supposing that there are several players all with heroes who run up to the building so they can cast the ability. A specific example would be asking if one could find out which player casts Reveal off of a Goblin Laboratory.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
@deathismyfriend: multiple players can have the same building selected.

Instead of making it an ability, would it be possible to make it sell a unit/item instead?
Then you can check for the owner of the sold unit and do your ability-stuff in that trigger.

Another way to do this is to create the same ability X times (where X is the amount of players that can cast the ability).
Put each of these abilities in a spell book, and disable that spell book for all players who shouldn't be able to cast the spell.
This requires some more work and creates multiple objects, but it definitely works.
 
Level 8
Joined
Oct 12, 2011
Messages
483
@ap0calypse Well the purchase unit/item will work, but I was just hoping that I wouldn't have to have that little stock indication number.

@deathismyfriend Yeah, it would still bug, so I won't use it.
 
Level 8
Joined
Oct 12, 2011
Messages
483
There's a box around the number that blocks part of the icon, but I'm fine with using units even with the integer. Or I'll have 6 separate shops for each player all layered together and have some trigger that clears up which one is selected.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Sadly, the integer is placed on top of the icon. Also, it turns out that the Spell Book solution does not work.
My bad: you should locally remove the spell book from the player with the shared building.

In case Neutral Passive owns the shop, then you should use a GetLocalPlayer()-check and remove the spell book-ability (for Neutral Passive) within that block for all players that should not be able to use that ability.
Still has the drawback of having to select the spell book first, then the ability (which might even be more bothersome than the stock integer).
 
Status
Not open for further replies.
Top