
I thought if i made a trigger that when triggered it triggers a special event that adds +1 to score in replicationinfo or there might be some other way to do it but i need help, anyone got an idea?

Moderator: Forum Guards
//====================================================
// Cozmo's Score trigger, :)
// Wow cozmo codes! :D
//====================================================
Class ScoreTrigger extends Trigger;
Var() int ScoreAdd
{
local actor A;
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( ScoreAdd != "" )
// Give kills :)
instigatedBy.Instigator.PlayerReplicationInfo.Score += ScoreAdd;
if( bTriggerOnceOnly )
// Ignore future touches.
SetCollision(False);
}
}
defaultproperties
{
ScoreAdd=1
bTriggerOnceOnly=False
}
~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.
//====================================================
// 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
}
//====================================================
// 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
}
We all were once =) It's just hard to get started, then you can move up to better things =)~Cozmo~ wrote:Ah thanks, ive had some sleep now and i feel like an idiot looking at that, i just copied a chunk of the trigger.uc and i thought i should remove that trigger once stuff but i wasnt sure.![]()
Ah well im a nooby coder.