Author Topic: Checking treasure chests with VCE  (Read 1279 times)

I was wondering if there was a way to check how many treasure chests a player has found using VCE, and if so what the name of the value is?  I was going to use score to keep track of players' chests, but player persistence doesn't save score if you're running a default mini-game.  Any ideas?

Put an event like this on every chest:

onActivate Client VCE_modVariable Chests ADD 1
onActivate Self VCE_savevariable Client Chests

Put an event like this on every chest:

onActivate Client VCE_modVariable Chests ADD 1
onActivate Self VCE_savevariable Client Chests

But will it be saved by player persistence if a player leaves and rejoins?  Because that's why I was originally going to use score.

Code: [Select]
registerSpecialVar(GameConnection,"chestCount","%this.numFoundTreasureChests");

Throw this into the script of an add-on you have, then you can just use the <var:cl:chestCount> replacer.

Code: [Select]
registerSpecialVar(GameConnection,"chestCount","%this.numFoundTreasureChests");

Throw this into the script of an add-on you have, then you can just use the <var:cl:chestCount> replacer.

Thanks a million!

Update: It isn't working.  I tried adding it as a footnote to the treasure chest cs file, and when I try to check <var:client:chestCount> in-game it always returns true.  Did I do something wrong?

Okay, the problem seems to have been because brick_treasure_chest, being a default add-on, is automatically re-downloaded if the one you have is missing or different upon start-up.  I added the code in question to event_variables and it works fine.  Thanks again!