⏲️Timers

From Cosmoteer Wiki
< Modding‎ | ComponentsModding/Components/Timers
Jump to navigation Jump to search

(source ref)

(quote)

(alias)

Timers are components that count up or down from a given float-type number when triggered.
You use them when you want to keep track of time for any reason, such as causing a delayed effect or scaling something based on time for example.

Timers act both as a toggle and a trigger. While it counts, the toggle is off, and when it finishes counting, the trigger fires.

(inheritance)

(use)

Parameters (Complete list)
Name Type Required? Buffable? Default value Description
Duration float Yes Yes
Autostart bool - - If the timer starts without needing to be triggered.
Repeats bool - -
StartTrigger (Trigger) - - Any trigger referenced here starts the timer when it becomes true (unless inverted). Calling it while the timer is running does nothing.
StopTrigger (Trigger) - - The opposite of StartTrigger.
ResetTrigger (Trigger) - - A referenced trigger will reset the timer to whatever Duration it was set to.
DurationAfterResetTrigger float - Yes When reset, what number the timer's value should be.
TriggerWhenStarted bool - - If this is set to True, in addition to triggering when it ends, the timer will trigger the same components when it starts.
StartExpired bool - - If this is set to True, when started, the timer's value will be 0.
InvertToggle bool - - If this is set to True, the toggle part of the timer is inverted.

Notes

Nothing yet.

Examples

Chaingun

	GunIsFiringTimer     //Is on if we have fired a shot
	{
		Type = Timer
		Duration = &../ShellChangingValueTween/OffTweenDuration
		StartTrigger = BulletEmitter
		ResetTrigger = BulletEmitter
		StartExpired = true
		InvertToggle = true
	}
	GunIsFiring
	{
		Type = MultiToggle
		Toggles = [GunIsFiringTimer, CombinedBulletSplitters]
		Mode = All
	}
	RateOfFireRampUpBuff
	{
		Type = SelfBuffProvider
		BuffType = RateOfFire      //used as divide by the fixed weapon fire rate
		BuffAmount = 1
		BuffMultiplier = RateOfFireTween
	}
	RateOfFireTween
	{
		Type = ValueTween
		OffValue = 1
		OnValue = 10.5     //30 shots per second if base value 0.35
		OnTweenDuration = 10
		OffTweenDuration = (&OnTweenDuration) / 2     //cooldown is half the ramp up
		IsOnToggle = GunIsFiring
	}


For reference, this is how it ends up in-game :

Expand
Chaingun alt-details.png

See also