Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Thaler
User01 Offline
Member

Posts: 97
Threads: 30
Joined: Feb 2013
Reputation: 0
#1
Thaler

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?
02-16-2015, 12:26 PM
Find
Ongka Offline
Member

Posts: 225
Threads: 3
Joined: Nov 2010
Reputation: 20
#2
RE: Thaler

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.

[Image: 18694.png]
02-16-2015, 12:38 PM
Find
User01 Offline
Member

Posts: 97
Threads: 30
Joined: Feb 2013
Reputation: 0
#3
RE: Thaler

Im a beginner in scripting
02-16-2015, 12:49 PM
Find
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#4
RE: Thaler

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.

Derp.
02-16-2015, 02:41 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#5
RE: Thaler

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.

(This post was last modified: 02-16-2015, 04:43 PM by Mudbill.)
02-16-2015, 04:41 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#6
RE: Thaler

(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: (Select All)
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.


Attached Files
.rar   Number Lamps.rar (Size: 25.31 KB / Downloads: 98)

Trying is the first step to success.
(This post was last modified: 02-16-2015, 05:45 PM by FlawlessHappiness.)
02-16-2015, 05:40 PM
Find
User01 Offline
Member

Posts: 97
Threads: 30
Joined: Feb 2013
Reputation: 0
#7
RE: Thaler

@FlawlessHapiness
It's a good idea but I prefer the way like in Killings In Altstadt.
(This post was last modified: 02-17-2015, 11:01 AM by User01.)
02-17-2015, 10:59 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#8
RE: Thaler

Do explain how that was! I don't remember.

Trying is the first step to success.
02-17-2015, 11:16 AM
Find
User01 Offline
Member

Posts: 97
Threads: 30
Joined: Feb 2013
Reputation: 0
#9
RE: Thaler

Heres a picture what it looks like
Spoiler below!
[Image: lhdainspl5py.png]
02-17-2015, 11:53 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#10
RE: Thaler

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 ^^

Trying is the first step to success.
02-17-2015, 12:05 PM
Find




Users browsing this thread: 1 Guest(s)