Fandom

Hammerwatch Wiki

Variable

111pages on
this wiki
Add New Page
Comments0 Share

DescriptionEdit

A variable is a storage location of an integer, it  can never be a decimal due to how ChangeVariable Work.

You can use CheckVariable to do comparisons to the variable.

UsageEdit

By using the ChangeVariable in combination with the Variable you can store a value. 

This screenshot is illustrating the use of ChangeVariable in combination with Variable

ChangeVariableEdit

2014-01-11 15 31 13-HammerEditor (testmap)

ChangeVariable settings









Variables: The 'Variables ' button will set the target Variable(s) which are going to be changed.

Change: Choose the type of modification you want to do to the linked Variable .

Change Description
Set Sets the variable to an exact value
Add Adds a value to the variable
Subtract Subtracts a value to the variable
Multiply Multiplies a value to the variable
Divide Divides a value to the variable

Exponent


Rounding: You can choose from Nearest, Down and Up.

Value: Enter the value that you want to change the Variable with.

Example

When setting the value to '25' and putting Change on 'Add', you will add 25 to the selected Variable . If you then use the CheckVariable script you can make it activate a sequence once the variable reached the value '100'.

Here's a screenshot illustrating how a text message will be shown when the player has entered the designated area 4 times.

Example variable
Area trigger sett

AreaTrigger settings

 
Changevariable sett

ChangeVariable settings

Checkvariable setting

Checkvariable settings

Text not 100

AnnounceText settings when variable is not 100

Text 100

AnnounceText settings when value is 100

TipsEdit

If you just want a simple counter use an actual Counter object.














































Inspectors and VariablesEdit

It is possible to link and Inspector script to a Variable. The Inspector script will display the variable value in the chat box whenver the variable is changed. This is very helpful when you need extra currencies, which can easily be scripted in using VariablesChangeVariableCheckVariable, and the aforementioned Inspector.

Inspector Variable

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki