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);
gms_p2p_send(p2p_kill,other.owner);
instance_destroy();
}
p2p_received script :
//See http://gamemakerserver.com/help/script/gms_script_set_p2p/
switch(argument0)
{
case p2p_kill:
//Don't forget to actually add the statistics on the site!
gms_highscore_add(1463, gms_highscore_self_score(1463) + 1)
break;
}
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
Hi,
Did you define the p2p callback script first?
Chibi
(Topicstarter)
on
28 Mar 2018, 12:26:24
No,
There was no p2p callback script in the example, do you mind posting the code here ?
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:
gms_script_set_p2p(p2p_received);
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 :/
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.
Size43
(Administrator)
on
28 Mar 2018, 19:19:31
I think AouabAdYT is asking whether you have
gms_script_set_p2p(p2p_received)
Somewhere near the gms_settings call.