Question on expressions vs score

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • I am one of the many new humble bundle people and I have gone through the entirety of the tutorial... I am trying to expand upon the choco tutorial game by adding random item drops, special abilities, etc.

    One of the things I haven't been able to figure out is how to add lives every X number of points.

    I effectively want to do something like the first 100, then at 200 more, then 300 more, etc (assuming 1 point per pop).

    I have my score counter I am just unsure how to read the value from it and test against that value.

    Thanks

  • I happen to have made a lot of games in the past that give an extra life every 1000 points. So I will try to explain how to do it.
    I have a global value, called "Score Keeper".
    I check to see if the value of the current Score minus the value of Score Keeper is greater or equal to 1000. If so, then add an extra life and add 1000 to score keeper (make sure score keeper starts at zero whenever you start a new game).

    You can easily do this for 100 instead of 1000. And it doesn't matter if it goes over, or if you get enough points to get two extra lives at once. It will still work.


    edit: Since you're new I just thought I would add, that to do the aforementioned check, I think you probably want "compare two general values".

    Spiritia: Spirit of Friendship: Please login to see this link.

  • Hey, it's a bit weird, but to read the score you need to right click the icon for Player 1 in the event editor (as a new condition) instead of the Score Object. It should then show "Compare to player's score".

  • I guess I am having a problem writing the expression... (and I don't have an option to compare to player's score from that event box actually).

    If I wanted an extra life at a score of 100, 300, 600, 1000, etc... how might I go about finding help on how to do that?

    Please login to see this attachment.

    Edited once, last by Valdier: adding a screenshot (December 10, 2013 at 12:36 AM).

  • Ah, it's not an event to check the players score. It's a condition :) Similar to the ones you have for Collisions. So, make a new condition and then right click on the Player 1 icon and you should see "compare to player's score".

    Then you can check if it's 100 and give the player an extra life! Here's an example image. I've also added a condition to make sure the player only gets one life when their score is 100, just so the event doesn't trigger forever and give them a tonne of lives. This condition can be found under the "Special" Object menu (two computer screens, one with a question mark).

    Please login to see this picture.

  • This is pretty much exactly what I am looking for... the problem I run into is... I don't know how to enter that condition into the list.

    When I enter a new condition and add:

    score( "Player 1" ) mod(100*(lives(score( "Player 1" )"-2))=0

    I can an error saying the syntax is wrong. (I've done a lot of programming in my life so the concept of what I am trying to do seems basic enough, I'm just not sure how to actually enter the condition)

  • Use the Compare Two General Values condition:

    Please login to see this attachment.
    Make sure you type it in correctly. The syntax you typed above wouldn't be right. Here's how RhysD had it:

    Please login to see this attachment.

    Also, you don't need the Always condition in that event, as it will be read regardless of it.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!