Page 1 of 1

Custom Coin Counter

PostPosted: January 26th, 2013, 4:59 am
by Blablob
Custom Coin Counter

Here is a look at how you can make your own coin (or "Square") counters.

Code: Select all
150x50~.61bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.149bX.130abaa.6aaac.9bX.129abaa2.6ac3.8bX.128abaa3.6ac4.7bX.127abaa4.6ac5.6bX.88aa19.6aa144.6aa144.6aa125~~~~0;128;1496;1;0;0~6:coinTracker;0;2;9999;9999;1;1;subtitle,2,Coins%3A%20%7B%24g_COINS%7D,100:sleep,10:subtitle_off:goto,0|40;208;1464;|40;368;1488;|40;400;1488;|40;400;1456;|40;368;1456;|44;1056;1480;add,g_COINS,g_COINS,5|40;560;1488;|40;592;1456;|40;624;1424;|40;655;1393;|40;688;1392;|40;720;1392;|40;752;1392;|40;784;1424;|40;816;1456;|40;848;1488;|40;1152;1472;add,g_COINS,g_COINS,74|40:coin1;1568;1472;move,coin2,1456,1424,1,0|40:coin2;1413;1658;move,coin3,1539,1424,1,0|40:coin3;1496;1658;move,coin4,1456,1488,1,0|40:coin4;1413;1722;move,coin5,1524,1456,1,0|40:coin5;1461;1690;|2:exit;1913;1701|6;-1;1304;9999;9999;0;1;branch,5,2,g_COINS,100:goto,0:camera,1,0,0,0,exit,0,0,10:move,exit,1904,1504,1,0:sleep,30:cameraoff~Custom%20Coin%20Counter~Bryan%20Pearson~3~4;0;0~0~4;0~0;0;3~1359203977~0.3


To do this, I used a hitbox trigger, which displays the number of coins and goes through a loop so that it always updates. You have to be careful with loops though; if they run too quickly (e.g. without a sleep function), the game will lag horrendously. I found this out the hard way.

Here is how the hitbox trigger looks:

  1. Subtitle: "Coins: {$g_COINS}"
  2. Sleep: 10 frames
  3. Subtitle Off
  4. Go to Line 1

Pretty self-explanatory. You can change the Sleep function to update however often you like. Something interesting I found out is that no matter how low you set the Sleep duration, the game won't lag; however, a sleep duration of say 1 or 2 makes Subtitles to read because they appear and disappear too quickly (play around with it yourself to see what I mean). Also, you need that Subtitle Off function otherwise subtitles will keep appearing on top of each other.

A couple other things I'll point out: Super Squares are kind of broken right now. Besides not having a sound effect, they won't automatically update the coin counter. You have to manually use the Add function to add the amount of coins you want. You can also customize the value of regular Squares by doing the exact same thing. (Just subtract 1 from however many coins you want to add, because Squares will add 1 by default.)

Re: Custom Coin Counter

PostPosted: January 26th, 2013, 10:52 am
by Raz
Runouw said super squares are special, not made to add to the kill counter. EDIT: coin, not kill. was just messing with stuff on minecraft


Also, did a similar thing in my shop level. I did something different though.
I set all the squares to stop the trigger then activate the trigger that displays the amount of coins.
it's really easy if you just use shift to place all the squares, so you don't have to addthat trigger to each one over and over.

Re: Custom Coin Counter

PostPosted: January 26th, 2013, 11:09 am
by fourinone
Code: Select all
150x50~.7050aa450~~~~0;144;1464;1;0;0~40;235;1473;stoptrigger,coincounter:activate,coincounter|6:coincounter;112;1422;64;64;0;1;subtitle,1,Coins%3A%20%7B%24g_COINS%7D,50:sleep,9999:goto,1|40;266;1473;stoptrigger,coincounter:activate,coincounter|40;295;1471;stoptrigger,coincounter:activate,coincounter|40;322;1472;stoptrigger,coincounter:activate,coincounter|40;256;1434;stoptrigger,coincounter:activate,coincounter|40;283;1434;stoptrigger,coincounter:activate,coincounter|40;303;1436;stoptrigger,coincounter:activate,coincounter|44;392;1472;add,g_COINS,g_COINS,10:stoptrigger,coincounter:activate,coincounter~My%20Level~~1~1;0;0~0~0;0~0;0;3~1359227121~0.3


Here's the way I did it. It updates immediately upon collecting a coin, and keeps the subtitle paused otherwise.

Re: Custom Coin Counter

PostPosted: January 26th, 2013, 11:47 am
by Blablob
Raz wrote:I set all the squares to stop the trigger then activate the trigger that displays the amount of coins.
it's really easy if you just use shift to place all the squares, so you don't have to addthat trigger to each one over and over.

That's not what I did, though. I used a single hitbox trigger which covers the entire level. I didn't do anything to the squares themselves.