How can i create scoring in a race map?

Hi, i have a problem with the comunication between a map and the player controller. the game is an online multiplayer.

I have a trigger box that when a player overlap it, he score “X” points. but i dont know how to asign that points to only the player that overlaped it, it just gaving points to all players.

im still a noob in this but, can i make a player index in the GameMode that when a player overlap the trigger box know what player index have?

cheers

This is the lvl blueprint:

And this is my PC:

Hello ,

I can’t exactly gather everything from your blueprints as I can’t read that language but I can get the gist of things.

Does each player have their own Score variable? If so, when the player overlaps the triggerbox, pull off of Overlapped Actor pin, cast to your player’s actor class (not the PlayerController).

From the “As ActorClassNameHere…” pin, you have two different things you can do based off where you’re storing the score variable. If it’s stored in the actor itself, just get the score variable and update that. If it’s stored in the PlayerController, use Get Controller to get a reference to the owning Player Controller and then get the Score variable from that. This should allow you to set their individual score values.

Thanks for your reply!

In the level blueprint i have the player controller ref, then i have a “scructure” that has the player name, image, score" (from the multiplayer blueprint tutorial)

I dont know how to cast the player’s actor class :frowning:

If you need each of the players to have their own score, then you’ll need to give each player their own score variable inside of either the actor class or the playercontroller. If you’re only trying to track the one player’s score, then having it in the level blueprint should be fine.

As for casting to the actor class, this would be whatever blueprint class you’re using for the players in your level, so the vehicle or whatever their physical representation is. You would do something like this:

You would replace “Character” with the name of that blueprint class. [Casting][2] makes it so that when you get the Overlapping Actor (which, according to this blueprint logic, could be any actor in existence as it hasn’t checked what kind of actor it is) you can make it only act (the top executable pin) and execute the following logic if the overlapping actor is of that class. It also lets you start referencing things directly from that blueprint that don’t exist elsewhere, like the score variable if it was stored in your actor class.