This article's documentation is for anything that uses the Source engine. Click here for more information.

Logic compare: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
m (Updated old entity format to {{this is a}}. This action was perfomed by a bot.)
Line 1: Line 1:
{{lang|title=logic_compare}}
<!-- When this page is updated to {{langsp}} or {{language subpage}} instead of {{lang}}, please move {{this is a}} to the base page, as it is automatically translated. -->{{lang}}[[File:logic_compare.png|left]]
[[File:logic_compare.png|left]]
{{CD|CLogicCompare|file1=logicentities.cpp}}
{{CD|CLogicCompare|file1=logicentities.cpp}}
{{entity|logic_compare|type=e0}} It examines the relationship between two numbers ("value" and "compare value"), and fires appropriate [[#Outputs|output]](s).
{{this is a|e0|name=logic_compare}} It examines the relationship between two numbers ("value" and "compare value"), and fires appropriate [[#Outputs|output]](s).


The equation is (''value'' - ''compare value'').
The equation is (''value'' - ''compare value'').

Revision as of 11:44, 4 January 2024

English (en)中文 (zh)Translate (Translate)
Logic compare.png
C++ Class hierarchy
CLogicCompare
CLogicalEntity
CServerOnlyEntity
CBaseEntity
C++ logicentities.cpp

logic_compare is an e0 available in all Source Source games. It examines the relationship between two numbers ("value" and "compare value"), and fires appropriate output(s).

The equation is (value - compare value).

Keyvalues

Initial value (InitialValue) <integer>
Initial value for the input value.
Compare value (CompareValue) <integer>
The value to compare against.
Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Inputs

SetValue <floatRedirectInput/float>
Set the value that will be compared against the compare value.
SetValueCompare <floatRedirectInput/float>
Set the value that will be compared against the compare value and performs the comparison.
Note.pngNote:Some Health based entities like func_physbox. will base its percentage fromm_iMaxHealth when using OnHealthChanged so any change in health will not be accounted for.
SetCompareValue <floatRedirectInput/float>
Set the compare value.
Compare
Force a compare of the input value with the compare value.

Outputs

OnLessThan <floatRedirectInput/float>
Fired when the input value is less than the compare value. Sends the input value as data.
OnEqualTo <floatRedirectInput/float>
Fired when the input value is equal to the compare value. Sends the input value as data.
OnNotEqualTo <floatRedirectInput/float>
Fired when the input value is different from the compare value. Sends the input value as data.
OnGreaterThan <floatRedirectInput/float>
Fired when the input value is greater than the compare value. Sends the input value as data.