~Cozmo~ wrote:Well i had another go and ripped a chunk out of the trigger class and tried to edit it, i dont know if im even close so dont laugh if i made some stupid mistake or did the completely wrong thing.
// Cozmo's code went here.
Ok, It's a good try =) It took me ages to figure out how to add score to a players total, so you've got one up on me there.
Ok, so far as I know, the scriptwide variable at the start (var() int ScoreAdd) doesn't need to have any code assigned to it. It seems you've tried to use it as a function, or you missed something out by accident. It looks like it was taken from the Touch function, from what i've seen of it.
So, let's have a butchers at fixing it =)
- Code: Select all
//====================================================
// Cozmo's Score trigger, :)
// Wow cozmo codes! :D
//====================================================
Class ScoreTrigger extends Trigger;
Var() int ScoreAdd; // Variables aren't functions, so no need for any {Code code code...} in them =)
var DeusExPlayer Toucher;
Function Touch(Actor Other)
{
// local actor A; //The "Actor Other" bit is already in the function, at the start in the brackets.
/* if ( bInitiallyActive && (TriggerType == TT_Shoot) && (Damage >= DamageThreshold) && (instigatedBy != None) )
{
if ( ReTriggerDelay > 0 )
{
if ( Level.TimeSeconds - TriggerTime < ReTriggerDelay )
return;
TriggerTime = Level.TimeSeconds;
}
if( Event != '' )
foreach AllActors( class 'Actor', A, Event )
A.Trigger( instigatedBy, instigatedBy );
if( bTriggerOnceOnly )
// Ignore future touches.
SetCollision(False);
}
*/ //You can use a Super.Touch(Other) to do all this for you =)
Super.Touch(Other); // Loads up the code from the parent class' version of Touch.
Toucher=DeusExPlayer(Other);
if(ScoreAdd>=1) // If the amount of score we want to add is 1 or more...
{
Toucher.PlayerReplicationInfo.Score+=ScoreAdd; //Add the score...
Toucher.ClientMessage("|P3You've gained "$ScoreAdd$" points! =)"); // And give us a message telling us how much score we've had added =)
}
defaultproperties
{
ScoreAdd=1
bTriggerOnceOnly=False
}
That should be safe to copy and paste into a .uc file =) (Most of it is comments, that just get ignored by the compiler)
Or without the comments:
- Code: Select all
//====================================================
// Cozmo's Score trigger, :)
// Wow cozmo codes! :D
//====================================================
Class ScoreTrigger extends Trigger;
Var() int ScoreAdd;
var DeusExPlayer Toucher;
Function Touch(Actor Other)
{
Super.Touch(Other);
Toucher=DeusExPlayer(Other);
if(ScoreAdd>=1)
{
Toucher.PlayerReplicationInfo.Score+=ScoreAdd;
Toucher.ClientMessage("|P3You've gained "$ScoreAdd$" points! =)");
}
defaultproperties
{
ScoreAdd=1
bTriggerOnceOnly=False
}