logo
Main

Forums

Downloads

Unreal-Netiquette

Donate for Oldunreal:
Donate

borderline

Links to our wiki:
Wiki

Walkthrough

Links

Tutorials

Unreal Reference

Usermaps

borderline

Contact us:
Submit News
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic [Snippet] Add new timers like PainTimer(). (Read 466 times)
han
Global Moderator
Unreal Rendering Guru
Developer Team
*****
Offline


Oldunreal member

Posts: 565
Location: Germany
Joined: Dec 10th, 2014
Gender: Male
[Snippet] Add new timers like PainTimer().
Nov 6th, 2015 at 2:59pm
Print Post  
Despite that you can easily implement this kind of timers in UnrealScript, you might run into the problem that depending on netrole, etc. it may not receive UnrealScript tick events. Or you simply want to be cool and add tons of native timers. Especially for effects having such timers turned out quite slim and nice unrealscript implementation.

Code
Select All
//
// AActor interface.
//
UBOOL ARevisionEffects::Tick( FLOAT DeltaTime, enum ELevelTick TickType )
{
	guard(ARevisionEffects::Tick);

	if ( Super::Tick(DeltaTime,TickType) )
	{
		if ( TickType==LEVELTICK_All )
		{
			// Additional EffectsTimer().
			if ( EffectsTime>0.0 )
			{
				EffectsTime -= DeltaTime;

				if ( EffectsTime<0.001 )
				{
					EffectsTime = 0.0;
					eventEffectsTimer();
				}
			}
		}
		return 1;
	}

	return 0;
	unguard;
}
 



UnrealScript. And you know the rules, set it to some positive time value, it gets fired when it approaches zero. Add some time to make it fire again later. You might want to set EffectsTime>0 in defaultproperties to trigger it initially.

Code
Select All
var float EffectsTime;  // Used for getting EffectsTimer() messages (for TrashGenerator, etc.)
event EffectsTimer();
 

  

HX on Mod DB. Revision on Steam.
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint
Bookmarks: del.icio.us Digg Facebook Google Google+ Linked in reddit StumbleUpon Twitter Yahoo