In App Purchasing Question

allc1865allc1865 Member, PRO Posts: 777
Hello, everyone!
I have a question about in app purchasing. I was watching GSHelper's tutorials on it and he was using integers in his table for coins, but I'm using upgrades for bullets, so I was wondering how to make it so when you buy the upgrade, it switches to the bullet you just bought.
What I have is When touch is pressed > in app purchase item rules > change attribute to the weapon you want to buy. But that doesn't work because when you touch the button, it changes the attribute whether you buy it or not, which I can't have.

Any help would be appreciated. Thanks!

Best Answers

  • grimmagelolgrimmagelol Posts: 18
    Accepted Answer
    Did u change in your main character when attribute =1 0r whatever the # your upgrade is to spawn the bullet of that upgrade? I'm making a game like this also

    :P just without the shop. It should work the same even tho i havn't tried to make the tables yet iv been testing with a actor 10x10 pixels which i called power up which should work the same as a point on a table.

    What i did was when the actor Power up collides with main Player to change attribute to 1.

    In the rule where u put the fire button = space.

    I made rules Under the do section for each power up. Rule is attribute = 1 . Under the do section add a timer which will spawn your bullet at a certain speed. Spawn an actor in the timer. I put Spawn level.2 Lazer bullet.

    So after u pick up the power up your main bullet turns to lv.2 bullet.

    It should work the same way with the table and a shop. When the player has enough $ and touches the power up in the shop change attribute to 1. Then minus his score/Cash.

    When u die change power up back to 0 so u can regain your power ups from shop/Colliding with a upgrade.

    I hope this helps :o It might not but at least i tried to answer :)
  • j75j75 Posts: 235
    Accepted Answer
    Forget about the tables. Use an attribute instead.
    The tables work great for coins because of the numerous changing values, but not needed for a simple iap such as yours.

    You only need a boolean attribute which has two options, true or false.
    -True will equal upgraded weapon
    -False will equal stock weapon

    Do you see what I mean? You don't need tables and certainly not an integer. Just an on or off.

Answers

  • allc1865allc1865 Member, PRO Posts: 777
    Hi, @grimmagelol, Thanks for your reply! I have the bullet spawning and working correctly and everything, but my problem is that when you press the button to buy the power weapon upgrade, it gives you the upgrade even though you haven't even checked out yet.
    The GSHelper video was on coins and they were using integers. The table that's used says, Product ID: coins_100 > Amount: 100.
    I'm not sure how to turn the amount 100 to reference my weapon upgrade instead of a number.
  • j75j75 Member, PRO Posts: 235
    Not sure but...
    Try using a boolean attribute instead of a table.

    if IAP is paid ... change attribute NewBullet to true

    when gun trigger pressed
    if New.Bullet is true ... shoot new bullets
    otherwise shoot normal bullets

    I'm new to this so don't quote me here
  • brickamatorbrickamator Member Posts: 316
    That should work
  • allc1865allc1865 Member, PRO Posts: 777
    @jesse75, how would I say that IAP is paid if there's no tables involved?
  • j75j75 Member, PRO Posts: 235
    edited December 2013
    It sounds like you are changing the attribute with another rule. Let the IAP change it for you. Basically the IAP is charging the user to change an attribute.

    Drag the IAP behavior into your project.
    You will see that it has a "Change Attribute" function.


    Basically it would be like this.

    When IAP is purchased, Change Attribute game.newbullets to true -- then save attribute

    When the gun/firing actor is loaded, it will check game.bullets to see if it is true or false.

    If true, it will shoot your custom bullets, if false, it will shoot normally.
  • allc1865allc1865 Member, PRO Posts: 777
    @jesse75, okay. When I drag the In App Purchase Item behavior my project this is what it says and I would have to put something there.

    image

    Is this what you're talking about?
    Thanks for your reply. I'm trying to understand :) ;)
  • j75j75 Member, PRO Posts: 235
    edited December 2013
    Beneath that line there should be another field called "Change Attribute"

    image
  • allc1865allc1865 Member, PRO Posts: 777
    Right. But in that line you put a reference to your table, or do I leave that blank?
    Thanks.
  • j75j75 Member, PRO Posts: 235
    aha! I see. What you need to do now is look for the video tutorial of setting up IAP's with Apple.

    When you create an IAP on ItunesConnect you have to make a product ID. This can be named anything like, "custom_bullets_iap" etc.

    Basically the line in your picture will have that name/ID in it. This line tells the game what IAP to buy.

    If you had laser beams as an IAP, that product ID could be called "laser_bullets" and that would be your IAP Product ID.

  • j75j75 Member, PRO Posts: 235
    edited December 2013

    Video Part #1





    Video Part #2

  • allc1865allc1865 Member, PRO Posts: 777
    @jesse75, thanks for your reply!

    Right. That's what I have set up and everything. But, the video I watched has coins and the integer in the table is equaled to 100. I'm trying to change that 100 to my actual weapon upgrade because I'm not using coins I'm using images. That's what I'm having trouble with.
  • allc1865allc1865 Member, PRO Posts: 777
    Hi, thanks so much. This helped me out a lot! :) ;) It works great now!
Sign In or Register to comment.