question

chorustempo avatar image
chorustempo asked

Add objects to all new player accounts?

It suggests using objects for player information. However, it doesn't say how to set these up via the game manager.

I'm using 3 objects on each player account to store character information. So Object1 will have all the data for character1. During the game, the information on this object will get updated with things like appearance, inventory items, skill points, etc. Then other players can read this object to get information about their opponent.

So when a new player account is created, I want them to automatically get these Objects added to their account with default key values. I can add items to all players on creation (via the catalog), but I can't see the option to add objects. Is it under a different name?

unreal
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

chorustempo avatar image chorustempo commented ·

The only other way I've tried it is via cloudscript revisions (I'm not a programmer, so have mangled together bits of code I've found elsewhere to get the below). However, it doesn't like the first line for some reason:

// Create 3 character objects with default values for all new player accounts.
    entity.SetObjects(
{
    Entity: { Type:"title_player_account", Id: currentPlayerId },
    Objects: [{
        ObjectName: "Char1Info",
        DataObject: {"NAME":"None","TYPE":"None","LOOK":"Eye3xHairC2xHairS4xSkin6x","GROUP":"None","LOC":"None","ACTION":"None","CORESTATS":"XP0xHLTH0xCCAP0xMXCAP0xCLEK0xMXLEK0xCDSP0xMXDSP0xCLIB0xMXLIB0","":""}
},
    {
        ObjectName: "Char2Info",
        DataObject: {"NAME":"None","TYPE":"None","LOOK":"Eye3xHairC2xHairS4xSkin6x","GROUP":"None","LOC":"None","ACTION":"None","CORESTATS":"XP0xHLTH0xCCAP0xMXCAP0xCLEK0xMXLEK0xCDSP0xMXDSP0xCLIB0xMXLIB0","":""}
},
    {
        ObjectName: "Char3Info",
        DataObject: {"NAME":"None","TYPE":"None","LOOK":"Eye3xHairC2xHairS4xSkin6x","GROUP":"None","LOC":"None","ACTION":"None","CORESTATS":"XP0xHLTH0xCCAP0xMXCAP0xCLEK0xMXLEK0xCDSP0xMXDSP0xCLIB0xMXLIB0","":""}
    }]
});
0 Likes 0 ·
chorustempo avatar image chorustempo commented ·

I guess I need something different in the top line, like...

// Create 3 character objects with default values for all new player accounts.
handlers.Add3CharObjectsToNewAccount = function (args) {
    var request = PlayFabId: currentPlayerId; 
    }
    entity.SetObjects(
{
    Entity: { Type:"title_player_account", PlayFabId },
    Objects: [{
        ObjectName: "Char1Info",
        DataObject: {"NAME":"None","TYPE":"None","LOOK":"Eye3xHairC2xHairS4xSkin6x","GROUP":"None","LOC":"None","ACTION":"None","CORESTATS":"XP0xHLTH0xCCAP0xMXCAP0xCLEK0xMXLEK0xCDSP0xMXDSP0xCLIB0xMXLIB0","":""}
},
    {
        ObjectName: "Char2Info",
        DataObject: {"NAME":"None","TYPE":"None","LOOK":"Eye3xHairC2xHairS4xSkin6x","GROUP":"None","LOC":"None","ACTION":"None","CORESTATS":"XP0xHLTH0xCCAP0xMXCAP0xCLEK0xMXLEK0xCDSP0xMXDSP0xCLIB0xMXLIB0","":""}
},
    {
        ObjectName: "Char3Info",
        DataObject: {"NAME":"None","TYPE":"None","LOOK":"Eye3xHairC2xHairS4xSkin6x","GROUP":"None","LOC":"None","ACTION":"None","CORESTATS":"XP0xHLTH0xCCAP0xMXCAP0xCLEK0xMXLEK0xCDSP0xMXDSP0xCLIB0xMXLIB0","":""}
    }]
});
0 Likes 0 ·

1 Answer

·
Rick Chen avatar image
Rick Chen answered

Yes. You can set a rule on player creation event to execute your CloudScript function which updates the player's entity objects.

But the entity objects can only store small amount of data. If you want to store more data, I suggest using Player Data instead.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.