They Are Billions

They Are Billions

Custom Levels for They Are Billions
Add custom levels to They Are Billions by subscribing to these workshop items!
Learn More
How do I use a custom user variable?
The Custom User Variable option currently lets me create a new variable, add a title to it, set a numerical value to it and add in a comment.

I understand some of the scripting options, but I wanted to understand how I can use a variable. Where do I set in some purpose or function for my variable? At first I thought that maybe I had to create a variable and highlight the "systems variable" and "Other Symbols" options . I later realised after reading the TAB guide what those were for. This was my 1h experience of using the editor. I know know most things about events, but im very curios to understand how I can actually set a function for my variable?

In the Conditions and Execute tab in the Block drop down, I can set my assigned variable in the execute section, for example -

Condtion : Colonists >=8
Execute : Myvariable = 1

But what does Myvariable do? Where do I set an option for what Myvariable does? If i create a variable , I dont see where I can set an option for this. I see a comment box, but I think thats not to set said description.

if I wanted to make it so that Myvariable would give me 20 colonists. How do I do this?

For example - I want to reward the player with 25 rangers if he has killed 10 infected chubby's and I want this to be a loopable reward.

Instead of rewriting this condition everytime, I want to assign Myvariable to check to see if the player has killed 10 infected chubby's, and in the execute window reward a player with 25 rangers. How can I use variables to do such things? How do I set a function to my variables?
< >
Showing 1-5 of 5 comments
chabz Nov 27 @ 9:55am 
A variable provides us with named storage that our ZXCode can manipulate and apply to events in game. I don't believe they have provided us with the necessary options to write the exact ZXCode to do what you have in mind but we can use ZXCode to get the same result you are looking for.

If you're interested, I could do a short twitch stream and we can go over several methods of using variables, including how to write ZXCode to make your example work?
Numantian Games  [developer] 1 Nov 28 @ 1:32am 
Hi!
If you wish to give a reward every time that 10 chubbies have been killed you can do this:

- Create a variable to save the number of chubbies to get the reward: NChubbiesForReward = 10.
- Create an event with this condition:
CountDeads(ZombieStrongA)>= NChubbiesForReward
- And in the script execute the code:
NChubbiesForReward += 10;

So every time that a reward is given, it increments the number of chubbies needed for the reward by 10.


nikpanda Nov 28 @ 6:02am 
@numantian games - Thank you for the method. I dont understand why my variable needs to have 10 in the name. What happens if you do this -

Variable - NChubbiesForReward = 6
CountDeads(ZombieStrongA)>= NChubbiesForReward
NChubbiesForReward += 10;

What I want to understand is the importance of the number 10 in NChubbiesForReward = 10.
But thanks for letting me know how to do this :D Ill definitely give this a shot with some quests in mind!
nikpanda Nov 28 @ 6:03am 
Originally posted by chabz:
A variable provides us with named storage that our ZXCode can manipulate and apply to events in game. I don't believe they have provided us with the necessary options to write the exact ZXCode to do what you have in mind but we can use ZXCode to get the same result you are looking for.

If you're interested, I could do a short twitch stream and we can go over several methods of using variables, including how to write ZXCode to make your example work?

I would love to understand how to use ZXCode. I tried searching online for this, but what I found was Xcode and im not sure if thats the same or has the same syntax. Any pointers on where I can study the code syntax?
Numantian Games  [developer] 1 Nov 28 @ 8:58am 
Originally posted by nikpanda:
@numantian games - Thank you for the method. I dont understand why my variable needs to have 10 in the name. What happens if you do this -

Variable - NChubbiesForReward = 6
CountDeads(ZombieStrongA)>= NChubbiesForReward
NChubbiesForReward += 10;

What I want to understand is the importance of the number 10 in NChubbiesForReward = 10.
But thanks for letting me know how to do this :D Ill definitely give this a shot with some quests in mind!

This is the initial value of NChubbiesForReward.
If you set 6 instead of 10, then the reward will be triggered as soon as the player kills 6 chubbies, and the next ones (with NChubbiesForReward += 10) when another 10 are killed.

ZXCode is something specific for They Are Billions, but it uses a similar syntax as c#.
Last edited by Numantian Games; Nov 28 @ 9:32am
< >
Showing 1-5 of 5 comments
Per page: 15 30 50