How to attach/upgrade items when you buy them with coins/points in the game.

DaGreatnessDaGreatness Member Posts: 82
edited October 2013 in Working with GS (Mac)
I am trying to figure out how to attach/upgrade/equip my character/actor in the game so that he is able to buy engine parts for his car, from the points he collected. I already know how to add the points and save them, but i am not being able to attach or equip the items that were bought with the coins to the actor/character so they can use it when the game starts.

Basically, i want to know how to equip bought items to my character/actor for him to she he is able to use them in the game.

Thanks in advance

PS sorry, if this is a NOOB question, but some insight or direction would be much appriecated.

Comments

  • KevinCrossKevinCross London, UKMember Posts: 1,894
    You could have a table for the player that has a row for all of the possible upgrades and in the column next to each have a 1 or 0 to know if they have that upgrade. It'll be tidier than dozens of attributes.

    With that table you can then spawn each upgrade (if by attach you mean visually) if it contains a 1 in the relevant row. You can do all of your rules using that table too I.e. If they press a particular key or button check to see if they have the upgrade and if so do the action for it.

    To check if a table cell contains a 1 in a rule try adding a game attribute called something like game.valueOne and set it as 1 by default, then in your rules you check the table like this:

    If game.valueOne = tableCellValue(upgradesTable,relevant upgrade row, 2)

    If you're using the nightly builds it would be

    If tableCellValue(upgradesTable,upgrade row, 2) = 1

    You could also set the tableCellValue into a game attribute and use that in the rules if you prefer that, it just means extra code in your game.

    I hope I haven't confused you :)
  • DaGreatnessDaGreatness Member Posts: 82
    KevinCross......THANK YOU FOR RESPONDING!

    So I am able to create the table and set up the 4 rows with the values of 0 because i want all 4 items to be locked out for now. and set it so when the player reaches the point value it unlocks.

    I kind of got confused when you wrote this
    "With that table you can then spawn each upgrade (if by attach you mean visually) if it contains a 1 in the relevant row. You can do all of your rules using that table too I.e. If they press a particular key or button check to see if they have the upgrade and if so do the action for it."

    What do you mean do all the rules using that table?
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    Apologies if I confused you but yes you are right set them as 0 until they have the upgrade(s) and if you need to check if they have the upgrade in your code you check the appropriate row in the table
Sign In or Register to comment.