EditPersistentObject(persistentObjectId , new_persistentObjectStruct)

Description

This function edits a persistent object after you provide its ID.

Syntax

EditPersistentObject(persistentObjectId ,  new_persistentObjectStruct)
ArgumentDescription

persistentObjectId

The ID of the persistent object. (this is RNet's Per. Obj. ID, not GM instance or GM object ID) This must be a Number.

new_persistentObjectStruct

The edited properties of the persistent object. This must be a Struct with all the properties in key-value form.

Returns

N/A

Example Implementation

//Get the ball first (assuming you dont know its POid)
var ballPOid = -1;
with(oPersistentObject){
    if(persistentObjectProperties.type == "ball"){
        ballPOid = persistentObjectId
    }
}
var ball_updated = {
    type: "ball",
    _x : 400,
    _y : 400
}
EditPersistentObject(ballPOid,ball_updated)

This requests the server to edit the ball's properties, and is likewise updated on everyone else's screen.

Last updated