Frictional Games Forum (read-only)

Full Version: Thaler
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I would like to make a shop where you can buy things but it bothers me that the player can't see how many thaler he's got.
Is there a way to script the amount of thaler the player has collected?
You could do a workaround which involves spotlights using shapes of numbers as gobos and have them controlled via script to display the amount of thalers on a sign at the shop.
Depending on how advanced your scripting knowledge is, this could be a bit hard to implement.
Im a beginner in scripting
Then you're gonna have big problems. My only suggestion is either learn the basics of scripting in general before trying out the complex stuff like this, or look at Killings at Altstadt, as they did something simular there. Don't expect to understand too much while looking through it though.
You can easily script the amount they have by using global variables, but displaying it is another deal, as described above.

Every time you pick up the item, you'll run the AddGlobalVarInt("Thalers", 20); if you picked up for example 20 of them. You can then use GetGlobalVarInt("Thalers") when you buy something to check it the player has enough.
(02-16-2015, 04:41 PM)Mudbill Wrote: [ -> ]You can easily script the amount they have by using global variables, but displaying it is another deal, as described above.

Every time you pick up the item, you'll run the AddGlobalVarInt("Thalers", 20); if you picked up for example 20 of them. You can then use GetGlobalVarInt("Thalers") when you buy something to check it the player has enough.

Perhaps, only show how many you have, when you enter the shop.

You don't have to worry about showing it in every map. Just keep the script in the shop-map.
Using 10 different billboard, you'll be able to display what you need to display.
(1,2,3,4,5,6,7,8,9,0)

I actually kinda have a script for that. Let me see if I can rewrite it...

Spoiler below!

PHP Code:
void DisplayMoney()
{
    for(
int i=1;i<100;i++)SetLampLit("MoneyDisplay_"+ifalsefalse);
    
SetLampLit("MoneyDisplay_0"falsefalse);
    
    if(
GetGlobalVarInt("MoneyVar") > 9)
    {
        if(
GetGlobalVarInt("MoneyVar") > 19)
        {
            if(
GetGlobalVarInt("MoneyVar") > 29)
            {
                if(
GetGlobalVarInt("MoneyVar") > 39)
                {
                    if(
GetGlobalVarInt("MoneyVar") > 49)
                    {
                        if(
GetGlobalVarInt("MoneyVar") > 59)
                        {
                            if(
GetGlobalVarInt("MoneyVar") > 69)
                            {
                                if(
GetGlobalVarInt("MoneyVar") > 79)
                                {
                                    if(
GetGlobalVarInt("MoneyVar") > 89)
                                    {
                                        
SetLampLit("MoneyDisplay_90"truefalse);
                                        
SetLampLit("MoneyDisplay_"+(GetGlobalVarInt("MoneyVar")-90), truefalse);
                                        
                                    }
                                    else
                                    {
                                        
SetLampLit("MoneyDisplay_80"truefalse);
                                        
SetLampLit("MoneyDisplay_"+(GetGlobalVarInt("MoneyVar")-80), truefalse);
                                        
                                    }
                                }
                                else
                                {
                                    
SetLampLit("MoneyDisplay_70"truefalse);
                                    
SetLampLit("MoneyDisplay_"+(GetGlobalVarInt("MoneyVar")-70), truefalse);
                                    
                                }
                            }
                            else
                            {
                                
SetLampLit("MoneyDisplay_60"truefalse);
                                
SetLampLit("MoneyDisplay_"+(GetGlobalVarInt("MoneyVar")-60), truefalse);
                                
                            }
                        }
                        else
                        {
                            
SetLampLit("MoneyDisplay_50"truefalse);
                            
SetLampLit("MoneyDisplay_"+(GetGlobalVarInt("MoneyVar")-50), truefalse);
                            
                        }
                    }
                    else
                    {
                        
SetLampLit("MoneyDisplay_40"truefalse);
                        
SetLampLit("MoneyDisplay_"+(GetGlobalVarInt("MoneyVar")-40), truefalse);
                        
                    }
                }
                else
                {
                    
SetLampLit("MoneyDisplay_30"truefalse);
                    
SetLampLit("MoneyDisplay_"+(GetGlobalVarInt("MoneyVar")-30), truefalse);
                    
                }
            }
            else
            {
                
SetLampLit("MoneyDisplay_20"truefalse);
                
SetLampLit("MoneyDisplay_"+(GetGlobalVarInt("MoneyVar")-20), truefalse);
                
            }
        }
        else
        {
            
SetLampLit("MoneyDisplay_10"truefalse);
            
SetLampLit("MoneyDisplay_"+(GetGlobalVarInt("MoneyVar")-10), truefalse);
        }
    }
    else
    {
        
SetLampLit("MoneyDisplay_"+GetGlobalVarInt("MoneyVar"), truefalse);
    }



To use it, call MoneyDisplay(); in void OnEnter()
(I'm sorry that it got this advanced. I couldn't do it simpler)

Ah yes. I also called the money variable for MoneyVar. I hope that's ok.

Alright. You're also going to need some billboards. I've attached those I use.

In the end, all you have to do is put 2 sets of those numbers side by side like this:
[Image: 4284c63ed8.png]

Remember those on the left side are named "MoneyDisplay_10", "MoneyDisplay_20", and so on...

Ask questions if you don't understand.
@FlawlessHapiness
It's a good idea but I prefer the way like in Killings In Altstadt.
Do explain how that was! I don't remember.
Heres a picture what it looks like
Spoiler below!
[Image: lhdainspl5py.png]
Oh, that seems like he made a lot of different items with numbers on them. And then checked every time he picked up more coins... A complicated way... But you can try that ^^
Pages: 1 2