Player specific scaleform?

Hey I'm having some trouble with some scaleform stuff, basically I'm trying to make a build interface similar to that of wc3. However when the build ability is fired in lua, the menu appears for all players, not just the one who fired it. I'm only using a method to check if the playerID in lua matches GetLocalPlayer in flash, but this still shows the build panel to all players if I use panel.visible.

Is there a way to only show parts of your UI to a specific player, given their playerID?

Comments

  • edited February 2015 Posts: 1,670

    Scaleform always runs individually for each player, what you might be doing is firing the event and then not catching the particular player who fired it in your actionscript.

    For example, in this PlayAgain.as which implements a simple Resurrect at latest save point? message, I have a custom event, "warchasers_player_died" subscribed like this:

    this.gameAPI.SubscribeToGameEvent("warchasers_player_died", this.OnHeroDied);
    

    And in OnHeroDied, each client will have to check its GetLocalPlayer() to match with the fired event arguments.

    public function OnHeroDied(args:Object) : void {
        //Only show this in the corresponding player UI
        var pID:int = globals.Players.GetLocalPlayer();
        if (args.player_ID == pID) {
                //Do stuff
        }   
    }
    

    Another possibility is that your module wasn't correctly setup'd.

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

  • Posts: 36

    on the event going to flash, add a "playerid" key or something similar, and compare it on flash with globals.Players.GetLocalPlayer()

  • Posts: 6

    Ah that's it thanks guys! :highfive: