Something functional - not the ruined DistanceLightning

Discussions about Coding and Scripting
Post Reply
User avatar
sektor2111
Godlike
Posts: 4624
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Something functional - not the ruined DistanceLightning

Post by sektor2111 » Fri Jul 31, 2020 2:59 pm

Available as mapping stuff and coding in the same time... these are somehow... friends.
In order to do something here (DistanceLightning type) using only stock, you have to know events and tags links and you can work with following classes:
- RoundRobin or StochasticTrigger;
- Dispatcher;
- TriggeredLight;
- Optional SoundEvents.
Chained triggering description:
Those random triggers are hitting Dispatcher delegated with more other serial linked events:
- turn on TriggeredLights;
- optional turn them off or making them to operate a self turn-off;
- adding a thunder sound in play area somehow in lightning direction - hit: sounds are not audible in UE1 at more than 2200 UU - which is good for other various effects...

Variant Less actors, less Level charge
it's a custom DistanceLightning in MyLevel (default properties are for a package added/imported later - used as common importing package):

Code: Select all

class ADistanceLightning expands Light;

simulated function BeginPlay()
{
	if (Level.NetMode != NM_DedicatedServer)
	{
		SetTimer(5+FRand()*10,False);
		log (Self.Name@"Timer set > This is NetMode"@Level.NetMode);
	}
	LightType = LT_None;
	log (Self.Name@"Initializing finished in NetMode"@Level.NetMode);
}

simulated function Timer()
{
	log (Self.Name@"Timer works.",'NetDistanceLightning');
	if (LightType == LT_Flicker)
	{
		LightType = LT_None;
		SetTimer(9+FRand()*20,False);
	}
	else 
	{
		LightType = LT_Flicker;
		SetTimer(0.4+FRand()*0.05,False);
	}
}

defaultproperties
{
	bStatic=False
	LightType=LT_Flicker
	LightBrightness=255
	LightRadius=56
	LightPeriod=128
	LightPhase=32
	RemoteRole=ROLE_SimulatedProxy
	NetUpdateFrequency=10.000000
	NetPriority=3.500000
}
Code has debug logs which can be removed or placed as remarks "//" in front of them for preventing to spam log files.
And then if some very clever/smart/intelligent dude has doubts here, claiming that I'm talking crap, I'll happily introduce logs for detonating his FAKE intelligence:
Server said:

Code: Select all

ScriptLog: UdpServerQuery(crt): Port 7778 successfully bound.
ScriptLog: ADistanceLightning0 Initializing finished in NetMode 1
ScriptLog: ADistanceLightning1 Initializing finished in NetMode 1
ScriptLog: ADistanceLightning2 Initializing finished in NetMode 1
ScriptLog: ADistanceLightning3 Initializing finished in NetMode 1
ScriptLog: ADistanceLightning4 Initializing finished in NetMode 1
Init: Initialized moving brush tracker for Level DM-TimeCrash_R2020_1.MyLevel
XC_Engine: Browse() End
Init: Game engine initialized
Log: Startup time: 3.120763 seconds
And... Client interested about a good "distancelightning" stuff saying:

Code: Select all

XC_Engine: Bringing Level DM-TimeCrash_R2020_1.MyLevel up for play (100)...
ScriptLog: ADistanceLightning0 Timer set > This is NetMode 3
ScriptLog: ADistanceLightning0 Initializing finished in NetMode 3
ScriptLog: ADistanceLightning1 Timer set > This is NetMode 3
ScriptLog: ADistanceLightning1 Initializing finished in NetMode 3
ScriptLog: ADistanceLightning2 Timer set > This is NetMode 3
ScriptLog: ADistanceLightning2 Initializing finished in NetMode 3
ScriptLog: ADistanceLightning3 Timer set > This is NetMode 3
ScriptLog: ADistanceLightning3 Initializing finished in NetMode 3
ScriptLog: ADistanceLightning4 Timer set > This is NetMode 3
ScriptLog: ADistanceLightning4 Initializing finished in NetMode 3
Init: Initialized moving brush tracker for Level DM-TimeCrash_R2020_1.MyLevel
Log: Spawning new actor for Viewport WindowsViewport0
...
...
NetDistanceLightning: ADistanceLightning2 Timer works.
NetDistanceLightning: ADistanceLightning0 Timer works.
...
NetDistanceLightning: ADistanceLightning0 Timer works.
NetDistanceLightning: ADistanceLightning1 Timer works.
NetDistanceLightning: ADistanceLightning3 Timer works.
XC_Engine: === Last 2 lines repeat 2 times.
...
NetDistanceLightning: ADistanceLightning4 Timer works.
XC_Engine: === Last line repeats 2 times.
NetDistanceLightning: ADistanceLightning2 Timer works.
XC_Engine: === Last line repeats 2 times.
NetDistanceLightning: ADistanceLightning3 Timer works.
XC_Engine: === Last line repeats 2 times.
NetDistanceLightning: ADistanceLightning2 Timer works.
XC_Engine: === Last line repeats 2 times.
NetDistanceLightning: ADistanceLightning0 Timer works.
XC_Engine: === Last line repeats 2 times.
NetDistanceLightning: ADistanceLightning4 Timer works.
XC_Engine: === Last line repeats 2 times.
Feel free to check yourself if these are working indeed as intended. And yes, this light is miss-behaving. It will flicker properly only in client as long as in server there is not any human eye for figuring decorations and light and USELESS junks. All effects are based on clients and standalone games and nothing like a dedicated server which has other things to do in a game instead of mooing at walls.

As conclusion:
If mapper is capable to do more than cubes and colors, everything goes into a higher quality direction, with good net stuff for all friends.

Post Reply