Instance Owner

Posted by Chibi
Well, I'm trying to use the script from the extension example, but it seems like it doesn't add the highscore to the correct owner as I expected.

if (other.owner != gms_self_playerid() && !gms_team_player_is_friend(other.owner)){
gms_chat(" was killed by " + gms_other_get_string(other.owner, "name"), c_red);

p2p_received script :


    case p2p_kill:
        //Don't forget to actually add the statistics on the site!

        gms_highscore_add(1463gms_highscore_self_score(1463) + 1)

The Issue Here's that even though the owner is defined, and it does kill the right character, it doesn't send that "p2p_kill" to the right owner.

Suggestions ?

Replies (7)

Last message on 30 Mar 2018

AouabAdYT on 27 Mar 2018, 16:18:34

Did you define the p2p callback script first?
Chibi (Topicstarter) on 28 Mar 2018, 12:26:24
There was no p2p callback script in the example, do you mind posting the code here ?
AouabAdYT on 28 Mar 2018, 19:31:00
Hi Chibi,

I had exactly the same problem when i first checked the example i couldn't find the "gms_script_set_p2p(p2p_received)" but it's actually in the [Room Start] event of obj_player and exactly written like this:
//We're going to handle some P2P messages to track kills:

So obviously your problem is that you didn't define the p2p callback script.

Note that these example are just begginers tutorials , you'll have to use other functions and use your own logic to make your game , the examples are not everything. You have the "Documentation" here in the website for help.
Chibi (Topicstarter) on 28 Mar 2018, 20:14:30
Oh, I see but yeah I even called it, but I still get the same mistakes when trying to sync the object owner :/
AouabAdYT on 28 Mar 2018, 23:30:06
Can you expand ?

I need more details.

By the way , make sure to call gms_script_set_p2p[/script](p2p_received) before you actually enter the ingame , either in room start event (before all create events) or when calling gms_settings[/script] , right after it.
AouabAdYT on 30 Mar 2018, 13:53:30
Solved :)
Size43 (Administrator) on 28 Mar 2018, 19:19:31
I think AouabAdYT is asking whether you have


Somewhere near the gms_settings call.