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
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: 103)

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


Messages In This Thread
Thaler - by User01 - 02-16-2015, 12:26 PM
RE: Thaler - by Ongka - 02-16-2015, 12:38 PM
RE: Thaler - by User01 - 02-16-2015, 12:49 PM
RE: Thaler - by Neelke - 02-16-2015, 02:41 PM
RE: Thaler - by Mudbill - 02-16-2015, 04:41 PM
RE: Thaler - by FlawlessHappiness - 02-16-2015, 05:40 PM
RE: Thaler - by User01 - 02-17-2015, 10:59 AM
RE: Thaler - by FlawlessHappiness - 02-17-2015, 11:16 AM
RE: Thaler - by User01 - 02-17-2015, 11:53 AM
RE: Thaler - by FlawlessHappiness - 02-17-2015, 12:05 PM
RE: Thaler - by Neelke - 02-17-2015, 01:04 PM
RE: Thaler - by FlawlessHappiness - 02-17-2015, 02:11 PM
RE: Thaler - by Romulator - 02-17-2015, 02:16 PM
RE: Thaler - by FlawlessHappiness - 02-17-2015, 03:01 PM



Users browsing this thread: 1 Guest(s)