#Not fully clear what u want to do.

1 messages · Page 1 of 1 (latest)

lavish ruin
#

Basically this is being triggered by a FactionPlayerTriggerEntity. It's doing some math stuff with a scoring system, and the trigger also pops up a Hint with directions to the next faction trigger. I want this hint to only be displayed on the HUD of players in the faction of the player that triggers the faction trigger.

#

@fathom field

fathom field
#

ah ok

lavish ruin
#

Is there a better way of doing this? I'm not familiar with Rpl and Rpc, but I know I need to learn it.

fathom field
#

RPC send message to all broadcast, you need filter on proxy side

#

show only on specified players

#

playerID more than enough for that

#

not need RplId

lavish ruin
#

Is filtering happening in the player controller entity? Is that something I'll have to mod the DefaultPlayerControllerMP entity?

fathom field
#

small example for send message from server to proxy

daring geyser
#
         //Get Local Controlled Entity - SCR_ChimeraCharacter
        IEntity player = SCR_PlayerController.GetLocalControlledEntity();
        //Get the players FactionAffiliationComponent
        FactionAffiliationComponent fa = FactionAffiliationComponent.Cast(player.FindComponent(FactionAffiliationComponent));
        
         //If it has a FactionAffiliationComponent
        if(fa)
        {
            //Check to see if the players faction name is the same as index 0 from the FactionManager
            if(fa.GetAffiliatedFaction().GetFactionName() == GetGame().GetFactionManager().GetFactionByIndex(0).GetFactionName())
                SCR_HintManagerComponent.GetInstance().ShowCustomHint("Only show for faction index 0", "Faction Sepcific", 10);
                //Send Hint if they are the same
        }        
        //If it doesn't have a FactionAffiliationComponent do nothing..
#

Wouldn't this work?

fathom field
#

He uses faction trigger, so he can get all faction players inside trigger. Just need get playerIds and send message to all.

daring geyser
#

Or he could just see if the local entity is in said faction

#

I'm also not sure how SCR_HIntManagerComponent works

#

I just threw an example together

fathom field
#

Rpc() call maybe not working in workbench, you need test on dedicated server.
in my tests Rpc() call just ignored on WB player-hosted servers.

#

And my position selection for code, not accidental.
GameMode easy to earn from anywhere, run on server and its have RplComponent. Its good place for server->proxy messages. But you can place another place too.

lavish ruin
#

I tried this but haven't been able to try it on my dedicated server yet. Tom, I'm guessing your code has the hint print regularly, and if it's on a dedicated server than through Rpc?
I tried this in work bench and as expected it ran the non-Rpc method. Trying to fully understand how the process works - Does the Rpc method call on each proxy machine, so that get local variables are specific to the proxies and not the player who triggered the trigger?

#
void ShowCheckpointInfo(int checkpointIndex, int factionIndex)
    {
        string cpHintTitle = GetHintTitle(checkpointIndex, factionIndex);
        string cpHintDesc = GetHintDesc(checkpointIndex, factionIndex);
        if (RplSession.Mode() == RplMode.Dedicated)
        {
            Rpc(RpcDo_RecieveHint, factionIndex, cpHintTitle, cpHintDesc);
        }
        else
        {
            RpcDo_RecieveHint(factionIndex, cpHintTitle, cpHintDesc);
        }
    }
    
    [RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
    void RpcDo_RecieveHint(int factionIndex, string cpHintTitle, string cpHintDesc)
    {
        Faction localFaction = SCR_FactionManager.SGetLocalPlayerFaction();
        FactionManager facMan = GetGame().GetFactionManager();
        Faction fValidate = facMan.GetFactionByIndex(factionIndex);
        if (localFaction != fValidate)
        {
            Print("This Rpc call is ignored!", LogLevel.WARNING);
            return;
        }
        SCR_HintManagerComponent.GetInstance().ShowCustomHint(cpHintDesc, cpHintTitle, m_iHintTextDuration);
    }
fathom field
#

In case of RplRcver.Broadcast, all proxies get message. You can't send array of playerids who is your target players.

#

its not problem if you use some rpc calls but bad when you want send to 88 players

#

there is more cheaper way to minimalize network usage