Current issues with implementing building ghost

edited February 2015 in General

I spent a lot of time today and yesterday trying to get building ghost going, without much success. So far, here's what we got:

Gfy is too big for forum

Essentially this integrates with my BuildingHelper library, and prints out closed and open squares in an area around the cursor according to the building size.

The current BIG problem with building ghost is getting the target point AND the time the user clicked the ability. You can have one or the other, but not both. For example, you can have a DOTA_ABILITY_BEHAVIOR_TOGGLE which is fine for getting the time the user clicked the ability, but then you have no target point. If you have a DOTA_ABILITY_BEHAVIOR_POINT ability, you have the target point, but no idea when the ability click occurred.

If you try combining them, like DOTA_ABILITY_BEHAVIOR_POINT | DOTA_ABILITY_BEHAVIOR_TOGGLE, _POINT will be overridden. DOTA_ABILITY_BEHAVIOR_POINT | DOTA_ABILITY_BEHAVIOR_IMMEDIATE immediately gives you the point of the cursor. DOTA_ABILITY_BEHAVIOR_POINT | DOTA_ABILITY_BEHAVIOR_NO_TARGET doesn't work either.

So then I tried force casting a _POINT ability with CastAbility right after the user casted a _TOGGLE. This unfortunately just immediately gives you the cursor position. Same thing with CastAbilityImmediately.

Then I tried putting hero:GetCurrentActiveAbility() in a timer, hoping it would fire when the _POINT ability was clicked. It did not, and only fires during the phase part (i.e. the part where the point has already been selected by the player, and the hero is moving towards that point). I tried this same idea with ability:IsActivated(), no luck.

Next with Flash I tried listening to globals.Loader_actionpanel.gameAPI.OnAbilityClicked, which only fires if the user clicks the ability with the mouse, and not otherwise.

Another different approach would be to use a _TOGGLE, and get the first left click of the user. But I don't think we can get normal mouse clicks through flash?

Ultimately if we're able to get the time BEFORE the 'phase' stage of the point ability, then we can move forward implementing building ghost. :biblethump:

Treat everyday as if you are a student, not a master. The student learns, grows and sees beauty. The master becomes bitter, resentful, and stagnates.

Comments

  • edited February 2015 Posts: 1,670

    :pogchamp: It works :pogchamp:

    RTS just got back one of its key mechanics! And of course, commendable that you're sharing it with the community, not like some sad others, who decide to just keep it to themselves for their personal benefit.

    Awesome job man! I need to add badges to the forums hehe

    The concept of Modding Community doesn't go well together with Competitive Business
    My Project Page || My GitHub Profile ||

  • Posts: 184

    Thanks Noya!

    Treat everyday as if you are a student, not a master. The student learns, grows and sees beauty. The master becomes bitter, resentful, and stagnates.