##permanently changing attribute**

RyanScottRyanScott Member Posts: 10
edited July 2012 in Working with GS (Mac)
Hello,

I'm trying to implement a kiip achievement but I only want it to be available once within the game.
Basically,

I want an attribute to be changed to 1 and to then change back to 0 permanently.

but I also need a way so that when the player comes back to the scene with the kiip achievement it doesn't display the same achievement before it was locked.

Any ideas?

Because this is what will happen:

attribute finish level=1
change attribute kiip to 1

when kiip=1
display kiip achievement
after 0.1 seconds change attribute kiip achievement to 0

in this process players still can re-earn the achievement because the change kiip attribute to 0 only happens after it is 1.

Comments

  • BarrytheBraveBarrytheBrave Member Posts: 134
    You could have another attribute called 'kiip earned' which is set to 0.

    Then have the rule:

    If kiip=1 and has 'kiip earned' = 0
    Trigger the achievement
    Change 'kiip earned' to 1

    The 'kiip earned' attribute will change to 1 the first time the achievement has been earned, and nothing ever changes it back, so it will never trigger the achievement again.

    Or a variation on this theme - basically adding more attributes is a good idea.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited July 2012

    @RyanScott

    Hi Ryan, I think I get what you're saying. So you'll need another attribute that'll keep your attribute at 0 after it has been 1 before.

    Make a boolean called KiipDone

    attribute finish level=1
    When KiipDone is false
    change attribute kiip to 1
    display kiip achievement
    after 0.1 seconds change attribute kiip achievement to 0
    change KiipDone to true

    Don't forget to save KiipDone as well, so it loads as true next time.

    ----------

    Edit: @ooi beat me to it by seconds!

    I've been thinking, it can be even simpler:

    ---- forget the boolean---

    attribute finish level=1
    When attribute kiip is 0 --- make sure that kiip is a game attribute
    change attribute kiip to 1
    display kiip achievement

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • RyanScottRyanScott Member Posts: 10
    edited August 2012
    @gyroscope thanks for helping me out. That's exactly what I wanted!

    awesome and hi-five :)

    do I need to have a timer after 0.1 seconds change attribute and save the attribute once it changes to 1? (referring to your simpler solution)

    attribute finish level=1
    when attribute kiip is 0
    display kiip achievement
    timer (after 0.1 seconds change attribute to 1 and save attribute)

    @ooi thanks for your input :)


  • BarrytheBraveBarrytheBrave Member Posts: 134
    edited August 2012
    No problem :D
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited August 2012

    @RyanScott

    Hi Ryan, you don't need any timer; because even though you're changing the attribute kiip to 1 before the achievement, the achievement is in the same Rule so will not be affected and will still work that one time.

    In other words, keep the Rule in the order I suggested, you'll have no problems:

    attribute finish level=1
    When attribute kiip is 0 --- make sure that kiip is a game attribute
    change attribute kiip to 1
    display kiip achievement

    To answer your other question: yes; best to save the attribute kiip and load it even for starting a new game, otherwise the kiip reward will still be able to be shown and used.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    May I suggest not using a boolean? If you start with kiip=0 (not achieved) and then set it to 1 (achieved) and then finally to 2 (used), it should function the way you want it to.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited August 2012

    Hi @tatiang , I just can't see the point of using one more step; with a boolean, the true (1) state is both the achieved stated and therefore the used state... two steps instead of three....just sayin'...

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    @gyroscope As I understood it, the problem was that after the boolean reset to 0/false, the initial condition would run again (When kiip=0), so to avoid that the attribute would have to change to a value that wouldn't trigger a condition. But I might have missed something.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    OK, I understand where you're coming from; but as long as the true state is saved and then loaded as true, it'll still be true (1) and so the rule won't run again (because it says when the boolean is 0), if you see what I mean.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • RyanScottRyanScott Member Posts: 10
    edited August 2012
    thanks guys for your help, much appreciated :)
Sign In or Register to comment.