Jump to content

Photo

"Free Parking"-esque Money-Spent Counter


  • Please log in to reply
17 replies to this topic

#1 kurt91

kurt91

    Follower of Destiny

  • Members
  • Real Name:Kurtis
  • Location:Eastern Washington University

Posted 20 September 2014 - 02:12 AM

You know the board game "Monopoly", right? A lot of people when they play it will come up with an unofficial house rule where all money taken from players through Income Tax or Luxury Tax is awarded to the player that lands on Free Parking. I want to do something similar.

 

I want to have an Info Room where it keeps track of how many Rupees you spend there in total. Once you hit a certain number, you're awarded an item. The idea is that instead of paying for information, you're donating money to somebody, with the three choices merely being made into how big of a donation you want to make at once. Once you've donated a substantial amount of money over time, you're given a present for your generosity.

 

Is this possible to make, and if so, could somebody script this for me? I have a low-tech backup plan on how to make this work, depending on if String Control codes can be used in Info Room strings (As well as if String Control codes can check before giving the item that Link doesn't already have it), but it would work a lot better and be a bit less clunky if I can use the scripted solution. 



#2 Avaro

Avaro

    >w<

  • Members

Posted 20 September 2014 - 05:21 AM

I would definetly use string control codes for the infos, to increase a custom counter by how much you just paid. Then you can use a script on the screen to check if the custom couter reached a certain amount. :)

 

The code for increasing a counter is \10\X\X. First X is the counter you want to use, second X is the amount.



#3 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 20 September 2014 - 06:49 AM

Actually, this should be very simple, with a shoppe script that I use, modified from MM:

I use it to give change back, when buying items, in part of an RPG system. It tracks how much was spent, the number of coins that would be, and produces a Rand that calculates out how much space to free in a wallet (wallets have a volume capacity, not a value capacity in my game).

All I'd need to do is strip away the calculation, and add a value to a desired counter for you. You can set the counter, and the value, as args, and set the info string as an argument, and it'd work like a pay-for-info screen, except that you could buy all three without needing to exit, and re-enter. You could also make the information vanish forever when bought, or make it only available when the player has certain items, etc; as you wish.

#4 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 20 September 2014 - 12:10 PM

Would you like each donation size to be an individual FFC? How would you like to trigger it? By stepping on it like an Info Room? Or by walking up and pressing A? Or some other way?



#5 kurt91

kurt91

    Follower of Destiny

  • Members
  • Real Name:Kurtis
  • Location:Eastern Washington University

Posted 20 September 2014 - 04:00 PM

I wanted it to look like a normal Info Shop room when the player goes in, and function identically. Any other way would make it too obvious that you'd get something for donating enough money simply because of the obvious work that went into it. I want the item received (Blue Ring) to be a complete and total surprise for the player the first time that they see it.



#6 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 20 September 2014 - 04:58 PM

So, here's how I would see it working:

 

Each donation FFC would be a separate FFC, which you can place to look like an info room.

Each FFC displays its price below it, which should look just like the one in an info room.

Standing on the FFC will make a string play and increase the count, and remove all of the donation FFCs on the screen (until you leave/re-enter)

Once the count gets over the limit, a new string plays and you're given a set item.

Once the count is over the limit, all donation FFCs will remove themselves when you enter the room (can't donate any more).

 

That sound good?



#7 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 20 September 2014 - 05:18 PM

That'd be a touch collision trigger.

I'm not sure if you can easily make the 'guy' flicker-fade out in a manner identical to the internal method. Is there a ghost function to replicate that death effect? I honestly don't recall one, but it's been a very long day, and I'm about to retire, so I'll turn this over to MM, as the codebase is his, and he probably has an improved version, so you don't need a fork, of my fork.

#8 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 20 September 2014 - 05:26 PM

Oh yeah, didn't even think about the flickering-out guy. This would be much easier if you'd just decide to live without that.



#9 kurt91

kurt91

    Follower of Destiny

  • Members
  • Real Name:Kurtis
  • Location:Eastern Washington University

Posted 20 September 2014 - 05:36 PM

I don't think that would be an obvious enough tell that it was anything beyond a typical Item Room. I mean, you'd have to play these games near religiously and have a very sharp eye for detail to catch that. Your description with the three FFCs with the prices under them sounds like exactly what I need.



#10 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 20 September 2014 - 06:07 PM

Done and tested. HUZZAH!

 

Requires you to have stdExtra.zh, and to have set its COLOR_WHITE constant to a color that's white in your tileset.

Each different amount FFC should have the same values in D0 (can be 0), D2, D3, and D5.

D1 (amount) should obviously be different in each one, and D4 (thanks message) can be the same or different.

import "std.zh"
import "stdExtra.zh"
import "string.zh"
import "ffcscript.zh"

// D0: Index of the Screen->D variable to store donation amount
    // Can be shared between multiple tiles of different amounts
// D1: The amount to donate
// D2: The total amount of money before getting the reward
// D3: Reward item
// D4: Message to play when donating
// D5: Message to play when you get the item
ffc script donationTile{
    void run(int d, int amount, int total, int reward, int successMessage, int itemGetMessage){
        // Find out how much has been donated so far
        int startingAmount = Screen->D[d];
        
        // Until all the money has been donated,
        // or money has been donated since entering the screen
        while(Screen->D[d] < total && Screen->D[d] == startingAmount){
            
            // If Link touches FFC and has enough money
            if(DistanceLink(this) < 8 && Game->Counter[CR_RUPEES] >= amount){
                Screen->Message(successMessage);
                
                Game->Counter[CR_RUPEES] -= amount;
                Screen->D[d] += amount;
                
                // If the money exceeds the total
                if(Screen->D[d] >= total){
                    WaitNoAction(60);
                    holdUpItem(reward, true, true, true);
                    Screen->Message(itemGetMessage);
                }
            }
            
            // Draw amount below FFC
            Screen->DrawInteger(0, this->X, this->Y + 24, FONT_Z1, COLOR_WHITE, -1, 16, 16, amount, 0, OP_OPAQUE);
            
            Waitframe();
        }
        this->Data = 0;
    }
}

Edited by MoscowModder, 20 September 2014 - 06:10 PM.


#11 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 20 September 2014 - 08:29 PM

Hmm...

I think that Kurt might want that to carry between different pay for info stores, selling different information, so you would want to store the value donated in a global variable, and make a global function to give the item when that amount reaches a specific amount.

If you rely on Screen->D to hold the value of payments, and Kurt wants this to carry between info shoppes, that won't work; but he also didn't specify that point.

import "std.zh"
import "stdExtra.zh"
import "string.zh"
import "ffcscript.zh"

const int DONATION_VALUE = 500; //Set to value in rupees that is needed to activate free item.
const int DONATION_ITEM = 51; //Set to item to give for global donations as a reward. 
int donationTotal;

// D0: Index of the Screen->D variable to store donation amount
    // Can be shared between multiple tiles of different amounts
// D1: The amount to donate
// D2: The total amount of money before getting the reward
// D3: Reward item
// D4: Message to play when donating
// D5: Message to play when you get the item
// D6: Set to 1 or higher, if donation count, and reward aren't global.
// i.e. A special reward for each individual info shoppe.
// Set to 0 for global only.
// Set to 1 for this shoppe only.
// Set to 2, to be for this shoppe, and global.
ffc script donationTile{
    void run(int d, int amount, int total, int reward, int successMessage, int itemGetMessage, int onlyHere){
        // Find out how much has been donated so far
        int startingAmount = Screen->D[d];
        
        // Until all the money has been donated,
        // or money has been donated since entering the screen
        while(Screen->D[d] < total && Screen->D[d] == startingAmount){
            
            // If Link touches FFC and has enough money
            if(DistanceLink(this) < 8 && Game->Counter[CR_RUPEES] >= amount){
                Screen->Message(successMessage);
                
                Game->Counter[CR_RUPEES] -= amount;
                Screen->D[d] += amount;
                donationTotal += amount;
                
                // If the money exceeds the total
                
                if ( onlyHere == 0 ) {
                    if( donationTotal >= DONATION_VALUE ) {
                        WaitNoAction(60);
                        holdUpItem(DONATION_ITEM, true, true, true);
                        Screen->Message(itemGetMessage);
                    }
                }
                else if ( onlyHere == 1 ) {
                    if(Screen->D[d] >= total){
                        WaitNoAction(60);
                        holdUpItem(reward, true, true, true);
                        Screen->Message(itemGetMessage);
                    }
                }
                else if ( onlyHere == 2 ) {
                    if(Screen->D[d] >= total){
                        WaitNoAction(60);
                        holdUpItem(reward, true, true, true);
                        Screen->Message(itemGetMessage);
                    }
                    if( donationTotal >= DONATION_VALUE ) {
                        WaitNoAction(60);
                        holdUpItem(DONATION_ITEM, true, true, true);
                        Screen->Message(itemGetMessage);
                    }
                }

            
            // Draw amount below FFC
            Screen->DrawInteger(0, this->X, this->Y + 24, FONT_Z1, COLOR_WHITE, -1, 16, 16, amount, 0, OP_OPAQUE);
            
            Waitframe();
        }
        this->Data = 0;
    }
}
(The 'just in case' edit. )

#12 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 20 September 2014 - 09:08 PM

Yeah, I was working on the assumption there would be one donation shop, or else multiple separate donation shops with different counts. You can take whichever version fits best.



#13 kurt91

kurt91

    Follower of Destiny

  • Members
  • Real Name:Kurtis
  • Location:Eastern Washington University

Posted 20 September 2014 - 11:16 PM

I'm sorry, I should have specified. There's only going to be one donation place in the quest, so MoscowModder's script should work fine. Thank you very much for putting this together for me. I had the idea to do something like this for a unique way to earn the armor upgrade, and the backstory is a subtle hint to watch out for Rupoor items when you try to earn money.



#14 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 20 September 2014 - 11:43 PM

Well, now that that's done, I went ahead and submitted it to the DB.



#15 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 21 September 2014 - 07:01 AM

Can I use this too?




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users