flarb
8 months agoPartner
GetUserPerisistentVarWithNullFallback argument at position 0 was the server player
I'm trying to set a player variable, and I get this error:
Error Handling Event:
Error: Exception encountered running bridge method 'GetUserPersistentVarWithNullFallback': GetUserPersistentVarWithNullFallback argument at position 0 was the server player, which is not supported in this method
at Object.invoke (horizon-global.js:156:23)
at Object.getPlayerVariable (file://horizon/horizon/core/HorizonCore.js:6490:36)
at NPCMonster.onProjectileHitMe (NPCMonster.ts:90:56)
at NPCMonster.ts:72:11
at file://horizon/horizon/core/HorizonCore.js:7604:24
at Function.TracingIntegration.trace [as trace] (file://horizon/horizon/core/HorizonCore.js:7833:9)
at file://horizon/horizon/core/HorizonCore.js:7599:32The code in question is a broadcast event I emit from my projectile script for the projectile shooter gizmo. When it hits an entity I send the event like this:
private onProjectileHitEntity(entity: Entity, position: Vec3, normal: Vec3) {
this.sendNetworkBroadcastEvent(ProjectileHitMe, { player: this.props.projectileLauncher!.owner.get(), entity: entity });
this.onHitGeneric(position, normal);
}And in the broadcastevent handler for my monster I try and set a player var using that owner player parameter:
private onProjectileHitMe(player : hz.Player, entity : hz.Entity) {
console.log("projectile hit entity");
if (entity == this.entity) {
this.hit();
let blastedZombies = this.world.persistentStorage.getPlayerVariable(player, "ChickenPlayers:BlastedZombies");
this.world.persistentStorage.setPlayerVariable(player, "ChickenPlayers:BlastedPlayers", blastedZombies + 1);
}
}This script is using default execution. So I'm not sure why it doesn't like the player I'm passing in--is the owner player on the projectile shooter gizmo not the right player object to use?