| 01-03-2006, 04:39 AM | #1 |
I'm trying to create stealth for a hero, and have only certain abilities allowed only when stealthed. I'm using windwalk. It gives you a buff, and it breaks when you attack or use an ability. I've been able to make the right conditions to detect when a unit is issued the order to do a spell and has the windwalk buff. The problem is that it never acknowledges my order unit action. I want it to stop/hold, but it runs ahead and does the ability anyway and says the message alert "Cannot use this ability unless stealthed.". The pitfall I'm having is that I can't find a way to cancel the units order to execute a stealth only ability, just detect when it's doing that. Also there isn't any way in the ability event/condition that I know of that can check if it has the buff, because I'm using windwalk so the buff is destroyed when they attack/cast an ability. So it doesn't seem to have the buff at the moment the player "starts the effect of an ability". Any ideas or different solutions? |
| 01-03-2006, 08:36 AM | #2 |
its actually more simple ten that: have the stealth only abilitys require a research to use, and when te unit casts windwalk, give that research to the owning player. Wen te unit breaks stealt, take te research away. |
| 01-03-2006, 08:52 AM | #3 |
As far as I know, you can't unlearn researches. You could do a similar thing with a building, though. |
| 01-03-2006, 10:14 AM | #4 |
Can't really find a way to undo research. That would be a cool way of doing it if there's a trigger that can delete research. Cause it adds in the tooltip Requires: Stealth. It looks cool. |
| 01-03-2006, 10:32 AM | #5 | |
Quote:
yeah, ither works. a dummy unit required for the ability is the same as a research. |
| 01-03-2006, 11:03 AM | #6 |
Yep make it require a unit , an invisible unit with Aloc, and just create that unit for the player when on stealth mode and remove it after stealth mode |
| 01-03-2006, 10:10 PM | #7 |
That's somewhat simplier than what I did, and will get around the only problem I had with it. Which was you couldn't upgrade the stealth abilities while stealthed. When they researched it I had a duplicate dummy power that was the one being researched, and they share the same bar position so I'd swap disable/enable of them when the stealth was on or off (wait for conditions). Since using the ability breaks the windwalk/stealth this condition would fire the same. I used the dummy one as requires research, so it had the requirement warning when that one was up. I think I'll go refine it with this new info. |
| 01-04-2006, 01:31 AM | #8 |
While this does allow you the ability to research a new rank of a stealth skill in stealth I see issues with multi-instancing this unit. It's a hero so I'm only allowing one per player, but probably in the end in most applications only 1 or 2 per game. I went and revised this trigger to hold a unit array, any of you guys tell me if this will work to allow this function properly in multiplayer. The problem is with my "wait conditions" to monitor the buff, and then doing that and depending on "last created unit". Other map triggers can interfere with that during the waits. So I figured I need to store the dummy units reference to remove it after the buff expires or is removed. VARIABLE = StealthUnit(1 to 12) Events - A unit starts the effect of an ability. Conditions - Ability being cast = Stealth Actions - Unit - Create unit Stealth 1 for owner of triggering unit at center of map facing 0.0 degrees For Each - Integer A from 1 to 12 Do Actions If Conditions - Unit Type of StealthUnit(Integer A) not equal Stealth (meaning the array spot is open for use.) Then - Set StealthUnit(Integer A) to LastCreatedUnit Wait until triggering unit has buff Stealth = true checking every 0.10 seconds Wait until triggering unit has buff Stealth = false checking every 0.10 seconds Unit - Remove Unit StealthUnit(Integer A) Set StealthUnit(Integer A) to No Unit (Clean up basically) Skip remaining actions. Else - Do Nothing (Just loop back and look again for a free index space) This obviously won't work if a single player has two of this unit since their researches will only need 1 unit to be present. The question is though is will this work for multiplayer? I don't know much about how variables work in multiplayer, I'm assuming they're shared, but are they only present client side and will their never be a trigger overlap when it checks for "last created unit". Thanks guys for the help. |
| 01-04-2006, 01:39 AM | #9 |
Nope not exactly working, I put an ally in there with the same hero and granted unit control. It worked smoothly for a second, but then it seemed like at some point one of the stealth units failed to get destroyed for one of them and his stealth abilities where stuck on while the others functioned normally still. Seems that when two are in action it only removes the last unit regardless of who's owning it, so I have to see exactly where my loop is failing at. UPDATE - Apparently Integer A is a global thing too and isn't locally instanced with the trigger/player/etc. So when player 2 goes stealth it advances Integer A from the loop to 2, and it applies to the same to the original triggering players reference. It becomes 2 so when it does it's clean up it cleans up at index 2 instead of 1. So I made another loop nested in there and seeks through the array until it finds a unit that is "Stealth" and belongs to the triggering player. Takes that index and puts it into the clean up of the unit and array index contents. With a few minutes of testing with all the situations that my windwalk/stealth can do (wait until duration runs out / attack someone / use an ability) both units owned by different players seems to function idependantly of each other now. I hope though that this still works multiplayer and still look forward to comments (reassuring ones and warning ones both) ;) |
| 01-04-2006, 06:13 AM | #10 |
Yes, your solution should work without problems, but it's really a long way around the problem. Just use the (player number of (owner of (triggering unit))) as the array index, instead of looping through it. There's no need to store a unit in the first empty array spot. |
| 01-04-2006, 11:18 PM | #11 |
Gotcha, good idea. I can probably kill the loops then. Thanks for pointing that out. |
