I'm making a CTF level for a university project, or rather two different versions of the same CTF level. One version of the level has a load of movers activated by triggers (both players touching them and players shooting them), and I need some way of monitoring when the movers are triggered.
Is there some way of rigging a trigger to output a message including a timestamp to the console or system log? Is there a specific actor which could be used to do this?
A way of finding out which player activated the trigger would help even more, but that seems pretty unlikely. A solution involving little unrealscripting would be preferable, as I have next to no knowledge about how to write it. Any help would be appreciated!
Trigger sending message to Console/Log
Trigger sending message to Console/Log
Last edited by Icedude on Mon Feb 28, 2011 2:49 pm, edited 1 time in total.
-
- Godlike
- Posts: 3774
- Joined: Fri Jan 14, 2011 1:53 pm
- Personal rank: -Retired-
Re: Trigger sending message to Console/Log
Make a subclass of trigger and add this, replacing the relevant section:
You can add timestamps and any other information in the log lines and it will show on your server log. If you have a lot of triggers this will make a lot of logging though. Make sure you don't have the logging suppressed too.
Code: Select all
// Open the mover.
function DoOpen()
{
local mover M;
bOpening = true;
bDelaying = false;
InterpolateTo( 1, MoveTime );
PlaySound( OpeningSound, SLOT_None );
AmbientSound = MoveAmbientSound;
log("## ADMIN- Mover opened:"@M@" by player:"@Instigator.PlayerReplicationInfo.PlayerName);
}
// Close the mover.
function DoClose()
{
local actor A;
bOpening = false;
bDelaying = false;
InterpolateTo( Max(0,KeyNum-1), MoveTime );
PlaySound( ClosingSound, SLOT_None );
if( Event != '' )
foreach AllActors( class 'Actor', A, Event )
A.UnTrigger( Self, Instigator );
AmbientSound = MoveAmbientSound;
log("## ADMIN- Mover closed:"@M@" by player:"@Instigator.PlayerReplicationInfo.PlayerName);
}
So long, and thanks for all the fish
Re: Trigger sending message to Console/Log
This is basically the same but it's way less code and also fixes possible nones in the other log line:
Code: Select all
MyLogMover extends Mover;
// Open the mover.
function DoOpen()
{
Super.DoOpen();
log("## ADMIN- Mover opened:"@self" by player:"@Instigator.PlayerReplicationInfo.PlayerName);
}
// Close the mover.
function DoClose()
{
Super.DoClose();
log("## ADMIN- Mover closed:"@self" by player:"@Instigator.PlayerReplicationInfo.PlayerName);
}
Website, Forum & UTStats
******************************************************************************
Nexgen Server Controller || My plugins & mods on GitHub
******************************************************************************
******************************************************************************
Nexgen Server Controller || My plugins & mods on GitHub
******************************************************************************
Re: Trigger sending message to Console/Log
Thanks for the help! So in theory I just subclass mover, copy the code into the new subclass, make a new mover in this subclass in the level (a small cube off in another area somewhere), then set it to the same tag and other settings as the appropriate mover already in place?
Edit: or would there be a way to change the already existing movers over to this subclass without rebuilding and re-keying them entirely?
Edit: or would there be a way to change the already existing movers over to this subclass without rebuilding and re-keying them entirely?
-
- Godlike
- Posts: 3774
- Joined: Fri Jan 14, 2011 1:53 pm
- Personal rank: -Retired-
Re: Trigger sending message to Console/Log
Don't alter the mover, alter the trigger. If you have movers that cycle or do more than a<->b you are going to end up with errors because the instigator could possibly be none. The OP wants to know who triggered the mover and your way will log every leg the mover makes.
So long, and thanks for all the fish
Re: Trigger sending message to Console/Log
Ok, thanks to the code you provided, I've made a Keypoint subclass that outputs to the log when triggered:
It works pretty much the way I wanted it to, simply by setting the tag to the same as the mover. If I knew how to add timestamps it would be perfect. Just wanted to say thanks again!
Code: Select all
//=============================================================================
// LogWriteKeypoint.
// by Robert 'Icedude' Astley
// Thanks to JackGriffin and Sp0ngeb0b on ut99.org
//=============================================================================
class LogWriteKeypoint expands Keypoint;
function Trigger(actor Other, pawn EventInstigator)
{
Log("## ADMIN- Trigger Activated:"@self.Tag @"by player:"@EventInstigator.PlayerReplicationInfo.PlayerName);
}
-
- Godlike
- Posts: 3774
- Joined: Fri Jan 14, 2011 1:53 pm
- Personal rank: -Retired-
Re: Trigger sending message to Console/Log
Try that out. You might have to tweak a bit to get it just the way you want.Icedude wrote:Code: Select all
class LogWriteKeypoint expands Keypoint; function Trigger(actor Other, pawn EventInstigator) { MyTimeStamp = TimeStamp; Log("## ADMIN- Trigger Activated:"@self.Tag @"by player:"@EventInstigator.PlayerReplicationInfo.PlayerName@"Timestamp:"@MyTimeStamp); }
So long, and thanks for all the fish