Hmm little help here plz?

The best and quickest support by a group of top-notch editing specialists, guaranteed!

Moderator: Forum Guards

Hmm little help here plz?

Postby Cozmo » Sun Jul 23, 06 12:13 am

Ive been trying to make a trigger that when you shoot it you get kills (Via replicationInfo) but ive been having problems, one being im not sure what to do.. :?

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? :?
Cozmo_RPG (v1 & v2)
MPConversations - A tool for creating multiplayer RPG stuff
Cozmo
Master
 
Posts: 1266
Joined: Tue Jun 28, 05 10:53 am
Location: UK

Postby Cozmo » Mon Jul 24, 06 9:44 pm

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. :(

Code: Select all
//====================================================
// 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_RPG (v1 & v2)
MPConversations - A tool for creating multiplayer RPG stuff
Cozmo
Master
 
Posts: 1266
Joined: Tue Jun 28, 05 10:53 am
Location: UK

Postby Allan » Mon Jul 24, 06 10:30 pm

~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
}
User avatar
Allan
Alpha
 
Posts: 4545
Joined: Wed Dec 21, 05 1:41 pm
Location: Northamptonshire, England.

Postby Cozmo » Tue Jul 25, 06 11:48 am

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. :oops:
Ah well im a nooby coder. :D
Cozmo_RPG (v1 & v2)
MPConversations - A tool for creating multiplayer RPG stuff
Cozmo
Master
 
Posts: 1266
Joined: Tue Jun 28, 05 10:53 am
Location: UK

Postby Allan » Tue Jul 25, 06 11:57 am

~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. :oops:
Ah well im a nooby coder. :D
We all were once =) It's just hard to get started, then you can move up to better things =)
User avatar
Allan
Alpha
 
Posts: 4545
Joined: Wed Dec 21, 05 1:41 pm
Location: Northamptonshire, England.

Postby Cozmo » Tue Jul 25, 06 2:16 pm

:) Ok, anyway im gonna try make this proximity detonated, im gonna have a go at it myself before failing and asking for help. :lol:
Cozmo_RPG (v1 & v2)
MPConversations - A tool for creating multiplayer RPG stuff
Cozmo
Master
 
Posts: 1266
Joined: Tue Jun 28, 05 10:53 am
Location: UK


Return to Editing issues

Who is online

Users browsing this forum: No registered users and 1 guest