Can't get a Star counting system to log best results.

Hello. I've been having a problem for quite a while and can't figure it out, no matter how many Youtube videos I watch.

My game is the common 3 star system and main achieving goal.
Each level contains 3 stars and they can be collected and be recorded in the Level Select area.
Currently, the problem is that on the level select tiles the best star count is not recorded, rather the most recent one.

game.Stars is my star counter.

My code after game.LevelComplete is set to true is:
When Game.Stars is > Than tableCellValue(Game.Table Stars, self.What Level Am I ,1)...Change table value to:
Table:Table Stars
Row: self.What Level Am I
Column:1
Value: game.Stars

and then after that I have "Save Table: TableStars"

Where the text is displayed the code for the Display Text is:
tableCellValue( game.Table Stars, self.What Level Am I,1)

All help is appreciated! Thanks guys.

Best Answer

  • HC_DKHC_DK Posts: 92
    Accepted Answer
    As @KevinCross already said, your code looks like it should.
    Have you checked that the code in the actor on the scene is the same as the "original" actor?
    I have experienced that eventhough I made changes in the "original" actor, the actor on the scene was not "updated". The scene actor was still LOCKED when this happened.

    Hope you get the picture....

Answers

  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited August 2013
    On first glimpse your code looks correct. Are you only testing it in the Creator or via the Viewer installed on your device? If so saved attributes and tables are wiped every time you run it. The only way you can test saved tables is on the device installed as an app.

    Apologies if you already knew this.
  • NilsVeidisNilsVeidis Member Posts: 12
    @HC_DK @KevinCross Both great tips. I'll try them both and let you know the results.
  • NilsVeidisNilsVeidis Member Posts: 12
    @HC_DK @KevinCross

    Okay so I tried both and the problem is still there.

    I'll clarify what I want to happen, and what is happening.

    What I want to happen: If I get 3 stars on level one log on the level 1 tile that I received 3 stars. If I reopen level one but only get 2 stars, the level tile still represents the best star count (3).

    What is happening: If I get 2 stars on level one log on the level 1 tile that I received 2 stars. Then if I reopen level one and get 3 stars, the level tile represents that I got 3 stars. Then, if I reopen it again and get 2 this time, the level tile displays that I got 2 stars, rather than the greatest star count.
  • NilsVeidisNilsVeidis Member Posts: 12
    @HC_DK @KevinCross
    Figured it out. Thank you @HC_DK because when I put the rules of the "original" actor and the actor in scene I noticed one slight difference in order. This solved the issue.
    Thanks for the help! Appreciate it a lot!
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    Do you have a behavior in an actor that that's copying a table, and possibly overwriting/resetting the table you're saving too?
  • NilsVeidisNilsVeidis Member Posts: 12
    @KevinCross wouldn't this be doing the same thing?

    When Game.Stars is > Than tableCellValue(Game.Table Stars, self.What Level Am I ,1)...Change table value to:
    Table:Table Stars
    Row: self.What Level Am I
    Column:1
    Value: game.Stars

  • KevinCrossKevinCross London, UKMember Posts: 1,894
    No, the copy table behaviour overwrites a table with the table you're copying and would be another reason why your data isn't saving between each session.

    You may not be copying tables at all, and if that's the case then just ignore me. It looks like you've sorted it anywho,
  • NilsVeidisNilsVeidis Member Posts: 12
    Okay I'll look into it but thanks for the advice! Now I ran into another problem... Not sure if you can find my questions but I would truly appreciate your help if you can provide it!
Sign In or Register to comment.