Talk:Math counter

From Valve Developer Community
Revision as of 10:43, 16 June 2018 by Max30335 (talk | contribs) (Parameter: "grammar")
Jump to: navigation, search

I noticed some strange behaviour of math_counter. When you set it's value to 0 by setvaluenofire and then add X (don't use more than one add output) to reach max value, onhitmax event won't fire. This doesn't happed using setvalue or composed add output (like add Y; add Z; Y+Z=X). Can someone confirm this?

Is it possible to transfer the value of a math_counter across multiple maps, i.e. to keep track of the number of cameras the player has knocked down in Portal? Or is there a better way of doing that than a math_counter? —Yar Kramer 15:39, 26 Jun 2008 (PDT)

Math Counter

Try using an env_global. It has a setting for keeping track of math variables across maps.

Um ... no it doesn't. Are you sure you're thinking of the right thing? —Yar Kramer 16:07, 8 Aug 2008 (PDT)
Yeah an env_global doesn't at all. You could perhaps use other logic entities, like cases, or branches to monitor changes in the counter though.--Gear 08:04, 18 August 2009 (UTC)

Float numbers

Math_counter can accept, store, process and output float values. Tested with OB (Source 2009) version of CS:S. I connected a math_counter's OutValue Output to the width input of a env_beam (accepts floats). Then I inputted several commands to the math_counter via ent_fire, setting float numbers, dividing and so on. The beam's width always represented the accurate float result, which I tested by inputting the correct float results directly to the env_beam's width. I'll leave the edit to someone who can confirm which engine version introduced this funcionality.--MBit 10:18, 19 September 2011 (PDT)

How do you connect values like that? I've been looking for quite a long time and have found no help :( --Megabobster 02:12, 10 January 2012 (PST)

OnGetValue <integer>?

how does OnGetValue work? According to the page, you are supposed to give it an integer somehow. How would you do this? I tried typing under "my outputs" OnGetValue 1 - but it gives an error in hammer, and wont send any outputs in-game. How do I assign an integer to something under "my outputs"? --Pandaboy 17:54, 28 November 2011 (PST)

As is explained under the entry for OnGetValue, it will output an integer when you send a GetValue input to the math_counter. You can't send anything to an output, outputs, by definition, OUTPUT data, they can't take any INPUT. Solokiller 23:57, 29 November 2011 (PST)

Parameter

How to make OutValue fire in parameter something else with math_counter's value? I mean I want to:

  My Output Target Entity Target Input Parameter Delay Only Once
Io12.png OutValue an_entity SetLocalAngles X 0 0 0.00 No

Where X - math_counter's value
Help --FATAL_ERROR (talk) 18:41, 16 June 2018 (UTC)