Announcement

Collapse
No announcement yet.

Controller Class --> is Player ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    ok. well, it works now.

    my first code were indeed working, but the error i made was that in the other .uc file that extends the mutator class, i put a reference to my older Mutator ( eg MutFragSoundClass) instead of MutTeamGameFragsoundClass. now this being fixed it works wonderfull.

    thanks to everyone contributing to this thread / problem.

    Leave a comment:


  • replied
    [edit]
    -- i think i spottet the error now..
    [/edit]

    Leave a comment:


  • replied
    Originally posted by the Adster
    Err, no, it works for all Controller types; how do you think CTF flags are attached to non-human players?.  Why not spend the rest of the afternoon having a good look round all the standard classes you have on your machine?  You may be surprised by what you find out.
    ok thanks. i will try that then lateron. but with my afternoon i have other plans than crawling to tons of code

    Leave a comment:


  • replied
    Originally posted by GuntiNDDS
    doesnt playerreplicationinfo only work with human players ?
    Err, no, it works for all Controller types; how do you think CTF flags are attached to non-human players?.  Why not spend the rest of the afternoon having a good look round all the standard classes you have on your machine?  You may be surprised by what you find out.

    Leave a comment:


  • replied
    Originally posted by the Adster
    This code come from one of my projects (modified to your needs):
    Code:
    if( ( killed != killer )
    	&& ( killer.PlayerReplicationInfo != None )
    	&& ( killed.PlayerReplicationInfo != None )
    	&& ( killed.PlayerReplicationInfo.Team != killed.PlayerReplicationInfo.Team )
    	&& ( killed != None ) )
    Try that.
    doesnt playerreplicationinfo only work with human players ?

    Leave a comment:


  • replied
    This code come from one of my projects (modified to your needs):
    Code:
    if( ( killed != killer )
    	&& ( killer.PlayerReplicationInfo != None )
    	&& ( killed.PlayerReplicationInfo != None )
    	&& ( killed.PlayerReplicationInfo.Team != killed.PlayerReplicationInfo.Team )
    	&& ( killed != None ) )
    Try that.

    Leave a comment:


  • replied
    Originally posted by Grzech
    surely it isn't. what do you cast that poor killer to playercontroller for?
    get rid of that and it will work.
    hi. right that was unnesscary, but still it dont work. even if i only write:

    Code:
    class TeamGameFragsoundClass extends GameRules;
    
    function ScoreKill(Controller Killer, Controller Killed)
    {
    
         if ( !Killer.SameTeamAs(Killed) ) 
         {
    log("someone killed someone else");
         }
    
    
         if ( NextGameRules != None )
              NextGameRules.ScoreKill(Killer,Killed);
    }
    even that raises the error and wont work... :bulb: ??

    Leave a comment:


  • replied
    surely it isn't. what do you cast that poor killer to playercontroller for?
    get rid of that and it will work.

    Leave a comment:


  • replied
    umm kay. i want to do something slighty different now.
    what i want is that if your team scores a frag ( being it a bot from your team or a human player from your team), everyone from that team should hear a sound.

    i tried like this:

    Code:
    class TeamGameFragsoundClass extends GameRules;
    
    function ScoreKill(Controller Killer, Controller Killed)
    {
         local Controller p;
    
         if ( !Killer.SameTeamAs(Killed) ) 
         {
    
                for( p = Level.ControllerList; p != None; p = p.nextController )
                {
    	         if( p.IsA( 'PlayerController' ) )
    	         {
    	          if ( PlayerController(p).sameteamas(PlayerController(Killer)))
                      {
                           PlayerController(p).ClientReliablePlaySound(Sound'scorefrag');
                      }
                     }
                }
          }
    
    
         if ( NextGameRules != None )
              NextGameRules.ScoreKill(Killer,Killed);
    }
    using this and using showlog reveals something like:
    "MutTeamGameFragsound accessed 'None' Killer" ?
    ( being playing with bots when this occours + it works and not display that when i make a frag myself. so maybe the code above is not realy compatible with bots ? )

    thx

    Leave a comment:


  • replied
    Originally posted by the Adster
    To play a sound to just one player try this:
    Code:
    PlayerController( killer ).ClientReliablePlaySound( Sound'MyCustomSound' );
    !ATTENTION!  You'll need to sort out the sound yourself, as if you try and use the code as it's posted you'll get an error.

    Importing a custom sound can be done in this way:
    Code:
    #exec AUDIO IMPORT FILE="Sounds\Whatever.wav" NAME="MyCustomSound"
    Hope that helps.
    thanks i wil try that. i know how to import sounds, so i think it gonna work. thanks.

    Leave a comment:


  • replied
    To play a sound to just one player try this:
    Code:
    PlayerController( killer ).ClientReliablePlaySound( Sound'MyCustomSound' );
    !ATTENTION!  You'll need to sort out the sound yourself, as if you try and use the code as it's posted you'll get an error.

    Importing a custom sound can be done in this way:
    Code:
    #exec AUDIO IMPORT FILE="Sounds\Whatever.wav" NAME="MyCustomSound"
    Hope that helps.

    Leave a comment:


  • replied
    from that thread:
    "I want to play sound from my mutator. I want it to be heard by every player (not localized sound)"
    that is not what i want. i want the sound only be heard by the player not every player. i allready know how to play a sound, what i dont know is the condition to make it only trigger if the player killed an emeny and not if the enemy killed the player. ( the same problem as i had before ).

    --
    for that hud thing, i tried:

    Code:
    class DeathRatioHUD extends ChallengeHUD;
    
    function PostRender(canvas C)
    {
    	Super.PostRender(C);
    
    	C.SetPos( 0, Canvas.ClipY/2 );
    	C.DrawColor.R = 255;
    	C.DrawColor.G = 0;
    	C.DrawColor.B = 0;
    	C.Font = MyFonts.GetBigFont( C.ClipX );
    	C.DrawText( PlayerOwner.PlayerReplicationInfo.GetSpree(), False );
    }
    which gave me:

    Code:
    Analyzing...
    Superclass ChallengeHUD of class DeathRatioHUD not found
    
    History: UMakeCommandlet::Main
    
    Exiting due to error
    ? thx

    Leave a comment:


  • replied
    http://www.ataricommunity.com/forums...hreadid=386389

    Leave a comment:


  • replied
    Originally posted by Grzech
    your english seems to be terrible I don't know what you want to achieve :weird: ,lol :sulk:
    Right now code above you increase a variable everytime some player does a good "kill" and reset it anytime some player does "bad" kill; (player here is either bot or human)

    if you want to remember "FragsSinceLastDeath" for every player u need to make a table or list for all players and count it for every player independently.

    it is already done:
    search code for killing sprees is realized. Killer.pawn.GetSpree() gives you kills from last death of that pawn (if thats what you want... )
    thanks, what GetSree returns is what i want. now i just have to make it display that in the hud. but i also want to play a sound, when the player kills an enemy and offcourse only that player should hear it, and not the enemy player. how would i do that ? thanks.

    Leave a comment:


  • replied
    Originally posted by GuntiNDDS
    ok. so this will only trigger if the player makes a kill, and not trigger if the (human) enemey of the player makes a kill, right ?

    so could i extend it like this to archive my goal:

    Code:
    if ( Killer.GetTeamNum()!=Killed.GetTeamNum() || (Killer!=Killed && Killer.GetTeamNum()==255) )
         {
            FragsSinceLastDeath+=1;
         }
         else {
            FragsSinceLastDeath=0;
         }
    your english seems to be terrible I don't know what you want to achieve :weird: ,lol :sulk:
    Right now code above you increase a variable everytime some player does a good "kill" and reset it anytime some player does "bad" kill; (player here is either bot or human)

    if you want to remember "FragsSinceLastDeath" for every player u need to make a table or list for all players and count it for every player independently.

    it is already done:
    search code for killing sprees is realized. Killer.pawn.GetSpree() gives you kills from last death of that pawn (if thats what you want... )

    Leave a comment:

Working...
X