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
Question with .lang and global variables
theabcs Offline
Junior Member

Posts: 5
Threads: 2
Joined: Apr 2012
Reputation: 0
#1
Question with .lang and global variables

Hey, I know a little about scripting but i need some help. I have a global variable set and i would like it to display when the player looks at a custom item in the inventory. Is there any way I can display the value of the variable in the .lang file during an entry script? So for example:

<CATEGORY Name="Inventory">
<Entry Name="ItemName_item">blah blah blah</Entry>
<Entry Name="ItemDesc_item"> XXXXXXXXXXXXX </Entry>
</CATEGORY>

I would like to somehow insert the value of the global variable in the "XXXXXXXXXXXXX" so when the player moves their mouse over, they see the set amount. Is this possible?
(This post was last modified: 04-04-2012, 10:30 PM by theabcs.)
04-01-2012, 12:19 AM
Find
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#2
RE: Question with .lang and global variables

This is not possible without a bit of a "hack" unfortunately.

Solution 1 - Lots of values in the lang files
The only way you can achieve this effect is to create entries for the values which the variable may hold. For example: If you wanted to track "money" you could reasonably get away with 0-9999 without taking up too much space. You will probably want to write a program (or use my lang tool) to generate the numbers though.

Assuming you then name the entries like "m<value>" in a category called money you would be able to access the vars by getting the entry of "m"+GetLocalVarInt("money").

This is just a crude example and will need to tweaking for your scenario. If you are using floats, convert it into fixed-point integer & scale. If you are using strings then the solution is much more context dependant. This solution isn't unreasonable though, i used it for "time" and a death counter in a currently unreleased map.

Solution 2 - Billboarding / Light display
The other solution is to display the value in a specific location. You can then use box-lights with a numeric/alphabetic gobo to display digits. You could do the same billboards or entities, activating the appropriate thing for each digit/letter.

This limits the display to specific locations though, which may not be what you are looking for - but you will be able to display much greater ranges of information using this approach without any space tradeoffs. Be wary of having too many (>1k) box lights though - if you are going to need a large display think about using something else.
04-02-2012, 02:26 AM
Find
Xanthos Offline
Senior Member

Posts: 318
Threads: 9
Joined: Mar 2012
Reputation: 8
#3
RE: Question with .lang and global variables

Can't you have like 10 Money Items and
For every Onpickup script have it do a check if player has item if not don't give the third money value and instead give the second value?

04-02-2012, 03:16 AM
Find




Users browsing this thread: 1 Guest(s)