NPC

As I was working on my quest library, I noticed there were almost no support for NPC's, specifically NPC's such as in Warcraft 3 where you could buy items, heroes, etc. if you were within a radius. So my question

1) Is such a feature currently available? 2) Is anyone currently making such a mod? 2b) What features would you like to see in such a mod?

if 1) and 2) are both no, than I'll step back from Quest for a bit to make a viable NPC mod

MAKE CUSTOM GAMES GREAT AGAIN

Finished-
kv checker - https://arhowk.github.io
panorama video series - https://moddota.com/forums/discussion/2021/inclusive-panorama-tutorial-quest-box

My pet project This Cursed World/Crestfallen (name pending)
https://moddota.com/forums/discussion/986/this-cursed-world-rpg#latest

Comments

  • edited February 2015 Posts: 184

    There is support for it, but you would have to do it through Hammer. The Warchasers map has a couple examples of shops. You make an entity with class trigger_shop and define a radius for it. Other than that, I don't think it's possible to spawn a working shop entity dynamically through lua. Also, you're forced with using the default Dota shop behaviors, which you may not want.

    So if you aren't content with these restrictions, you would use Flash to make your own shop UI, have a fast timer check if heroes are in a radius around it. If hero is in radius, make shop UI visible to player, then when hero goes out of radius, hide it. Good work has already been done on a flash shop UI here.

    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.

  • Posts: 858

    Hm.

    What I wanted was for the abilities bar to display stuff like "Talk", "Buy", etc.

    Is there a way to access/view/modify the raw DotA 2 UI code? I saw something where a overlay was placed on the toolbar, but it didn't do anything other than grab x/y coordinates from the default toolbar.

    MAKE CUSTOM GAMES GREAT AGAIN

    Finished-
    kv checker - https://arhowk.github.io
    panorama video series - https://moddota.com/forums/discussion/2021/inclusive-panorama-tutorial-quest-box

    My pet project This Cursed World/Crestfallen (name pending)
    https://moddota.com/forums/discussion/986/this-cursed-world-rpg#latest

  • If you wanted the abilities bar to display stuff like Talk, Buy, etc, you might want the unit to have exactly those abilities.

    If that doesn't suit you and you want to have the UI for whatever reason (which there might be many), you're free to modify the valve UI. I'm guessing you saw something of mine with the overlay, either the PipNumbers or AbilityValues. It shows the principal way of accessing valve elements and changing/using their properties (.visible, .addChild, .removeChild, etc etc).

  • Posts: 858

    For now, I'll just try to focus on investigating this native -> IsControllableByAnyPlayer( nNPCEntityIndex ) as I tried to modify the Dota 2 UI and I don't think I can pull it off as smoothly as I'd like.

    Won't have much time this week though (do I ever have time?...)

    MAKE CUSTOM GAMES GREAT AGAIN

    Finished-
    kv checker - https://arhowk.github.io
    panorama video series - https://moddota.com/forums/discussion/2021/inclusive-panorama-tutorial-quest-box

    My pet project This Cursed World/Crestfallen (name pending)
    https://moddota.com/forums/discussion/986/this-cursed-world-rpg#latest

  • GetSelectedEntities( nPlayerID ) - Get the entities this player has selected (as an array of entity indices). GetQueryUnit( nPlayerID ) - Get the entities this player is querying (as an array of entity indices).

    GetSelectedEntities( nPlayerID ) returns an array of Lua entity indexes. Unfortunately, it's broken so it returns the entity of the currently focused unit (your unit whose stats/abilities etc you're currently looking at) times the number of units you have selected in total.

    For example, if you have beastmaster with hawk selected, but you're currently looking at the beastmaster, it will return 112, 112 or smth like that. If you press 'tab' to switch to the hawk, youre gonna get something like 117, 117. If you're only selecting the beastmaster or the hawk, you're gonna get 112 or 117 respectively. Considering that, you're well off using GetSelectedEntities(playerID)[0] all the time, since it doesn't matter.

    GetQueryUnit( nPlayerID ) returns either -1 or the Scaleform entity index of the unit you're querying. That's a unit that you're inspecting, a non-owned unit of the player.

    The Lua entity index returned by the GetSelectedUnits() can be forwarded to and used by the server(Lua) and so is not usable with the rest of Scaleform API funcs, whereas the Scaleform entity index that gets returned by the GetQueryUnit() is only usable within Scaleform.

    There's a plethora of ways you can go about this to implement a talk to NPC interface, but I guess that's for you to discover how exactly you would go about it. dota_player_update_selected_unit_ and dota_player_update_query_unit events work just fine but provide no parameters, so they can be used as a trigger to run your checking funcs.

    ScaleformAPI is a bit limited because of all this.