| 07-15-2007, 03:33 PM | #1 |
Dear wc3campaigns-forum, How can I create a select-hero abillity that will only select units owned by the player that owns the shop. Normaly that abillity is used for neutral shops and will target every unit (with inventory) thus granting controll over the building to any player. I know about the abillity the race-shops use (thats 'common shop' or something) that will only select your own units, but that abillity will not work with 'sell item' (the abillity necessary to add items to shops via trigger) properly. That means: If you won't to sell items you added using triggers, from a shop that uses 'common shop' instead of 'select hero' you have no way of detecting the unit buying or even the shop selling the item (or at least I didn't find one...) So my question is: Is there any way to change "select hero' in a way that will make it select only my own units?You have my gratitude, Patpup |
| 07-15-2007, 03:48 PM | #2 |
Base your unit off the racial shops. Or copy the ability list they have. |
| 07-15-2007, 03:57 PM | #3 |
As I wrote, using the ability of the racial shops doesn't work. Heroes buying stuff using said ability don't get detected via 'buying unit' ! Means you can't use them in triggers. |
| 07-15-2007, 04:04 PM | #4 |
Idea: make them permanently invisible (the ability shade has) and make sure nothing has True Sight. Only their owner will be able to shop in them as no one else will see them. |
| 07-15-2007, 04:21 PM | #5 |
Invisibility would circumvent the problem, thats right, however due to the concept of the map (which I don't really won't to explain unless necessary, its a bit complicated ), the shops themselfes have to be visible.For now I created a trigger that deselects the shop whenever someone other than the owner selects it. It's not perfect but I guess it does the trick. Thanks for your braincells CommanderZ, this works for now if someone else has an idea on how to adress this problem more directly, he's welcome! |
| 07-15-2007, 04:22 PM | #6 | |
Quote:
|
| 07-15-2007, 04:27 PM | #7 |
darn... as expected,...what should I say, maybe I looked up the wrong FAQs, right? However, I'll try this now. Thank you. Edit: Sorry, doesn't seem to work. The shop still selects enemy heroes (or enemy shops still select my hero - and sell him items). Are you sure this works the way you describe it? Am I sure I did it right? (no) I just added those 4 abillities (same sequence as above) and nothing else. Hm I'll remain with the selection-thingie for now. |
| 07-15-2007, 07:30 PM | #8 |
Too bad :( I was pretty sure it used to work. |
| 07-15-2007, 09:23 PM | #9 |
You could do something like this Trigger: If a player selects a tavern (or whatever shop) and the player is not the owner of the shop, then they immediately either clear their selection, or go back and select their hero. EDIT: This is not the shop selecting units, but rather the player clicking on the building. So they enemy heros will still be selected by the shop, but they won't be able to use it. It's not the best solution but it will work. |
| 07-15-2007, 09:26 PM | #10 |
Except it ain't immediate. There is a considerable delay; enough for hotkey usage. |
| 07-15-2007, 09:45 PM | #11 |
fluff, thanks, thats what I already did .I tried using hotkeys to trick the system, but I found that to be impossible (although you see the shop, the game doesn't react to your hotkey fast enough). Doesnt warcraft work off its code trigger by trigger? According to my understanding the game should, the moment the unit is selected and the event kicks in, go through all the trigger before taking into account any buttons you pressed, am I wrong ? |
| 07-17-2007, 04:38 AM | #12 |
Hotkeys don't work for items and units added to the shop by trigger. Select Hero/Select Unit are the abilities that make the shop available to everybody. Unfortunately, they're necessary for items in the "Items Sold" field or items added by trigger (not for "Items Made" though, like ladder race shops). You could make a workaround with units. Give the shop Shop Sharing and Sell Units. Add your dummy units by trigger. When a unit is purchased, get the player with GetOwningPlayer(GetSoldUnit()) (you cannot use GetBuyingUnit() without Select Hero/Select Unit). Look for a unit owned by the player with an empty inventory slot within range of the shop and give the item to it, else refund the purchase or drop the item on the ground by the shop, or something. |
| 07-17-2007, 12:25 PM | #13 |
Well if hotkeys don't work, deselecting the shop is safe anyway so I see no problem with keeping that. |
