Newbie Question

I am new to GS and have a question I assume is fairly basic. I am messing around with some tutorials and have a simple game set up where you collect x amount of gems and a portal spawns to take you to another level. Level 1 requires 3 gems be hit before the portal spawns and level 2 requires 5 gems to spawn the portal. My problem is no matter what I do the portal continues to spawn when I hit 3 gems on level 2. I have created a GemCount integer attribute and I also have a GameFunction actor which currently is spawning my portal when the game.GemCount >2. How do I set this up to vary the GemCount for additional levels? Sorry again for the basic question, and thanks in advance for any help.

Best Answer

Answers

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    edited December 2016

    I would create a Actor Level Attribute on the Portal that keeps track of how may gems need to be picked up to show that portal. Like this:

    In the portal actor create an Attribute called gemTrigger. Say you want five gems to open the portal so gemTrigger =5.

    Then use a Rule in the portal that states:

    If game.GemCount > gemTrigger: Open the portal.

    Then on each portal you can set a different number for genTrigger.

  • ToqueToque Member Posts: 1,187

    I'm guessing the actor that keeps track of gems is same for every level and set at 3.
    You could have game attribute level. Then rules for every different level for number of gems you want before finishing.

  • dstokes1714dstokes1714 Member Posts: 4

    Thanks for the help. I am getting closer but still running into an issue. I created a game attribute (GameLevel) and set it to 1 initially. I then have different criteria set to spawn portals based on GemCount and GameLevel. When I hit the portal and load the next level, I am resetting the Gem Count to 0 and incrementing the GameLevel by 1 (game.GameLevel +1). My problem is, when I clear level 1 and enter level 2 for some reason my GameLevel is being set to 3. Level clears after that are incrementing by 1 without any problem, but for some reason my first level increments my number 2 instead of 1. Any ideas as to what may be happening on my first level clear? Thanks again for the help.

  • dstokes1714dstokes1714 Member Posts: 4

    That's it! Thanks a ton for all of the help. I had a duplicate copy of my function in my first level. Once I removed it everything works as expected. Thanks again!

Sign In or Register to comment.