Tripwire Interactive Forums

Go Back   Tripwire Interactive Forums > Killing Floor Forums > Killing Floor Modifications > Coding

Reply
 
Thread Tools Display Modes
  #1  
Old 05-29-2011, 03:44 AM
FluX FluX is offline
Senior Member
 
Join Date: Oct 2010
Posts: 3,728
Default [Help]Perk Colour Changing

Right basically what I want to do is change the perk colours within Marco's ServerPerks (my own version). I have found where to change them which I changed the values to:
Code:
static function byte PreDrawPerk( Canvas C, byte Level, out Material PerkIcon, out Material StarIcon )
{
 if ( Level>10 )
 {
  PerkIcon = Default.OnHUDGoldIcon;
  StarIcon = Class'HUDKillingFloor'.Default.VetStarGoldMaterial;
  Level-=10;
  C.SetDrawColor(250, 220, 0, C.DrawColor.A);
 }
 else if ( Level>5 )
 {
  PerkIcon = Default.OnHUDGoldIcon;
  StarIcon = Class'HUDKillingFloor'.Default.VetStarGoldMaterial;
  Level-=5;
  C.SetDrawColor(200, 200, 200, C.DrawColor.A);
 }
 else
 {
  PerkIcon = Default.OnHUDIcon;
  StarIcon = Class'HUDKillingFloor'.Default.VetStarMaterial;
  C.SetDrawColor(220, 130, 0, C.DrawColor.A);
 }
 return Min(Level,15);
}
I have figured out ONLY the perk picture colour changes after level 10.
Here is what is seems to do:
Levels 0 - 5 = Casual red colour (standard only but changes brightness)
Levels 6 - 10 = Whity gold standard colour (standard only but changes brightness)
Levels 11 + = Custom set colour (works customed).
Why is is the third perk colour works but the other two don't? Both second and third colour share the same picture so it's not the picture itself.

Last edited by FluX; 05-29-2011 at 03:49 AM.
Reply With Quote
  #2  
Old 05-29-2011, 12:35 PM
Excalibolg's Avatar
Excalibolg Excalibolg is offline
Senior Member
 
Join Date: May 2009
Location: KF-BioticsLab
Posts: 142
Default

I have no idea what you're asking.
__________________
Quote:
Originally Posted by KFWeaponPickup.uc
Description="I AM A DEFAULT DESCRIPTION! KILL ME NOW!"
ItemName="DULL ITEMNAME!!!! KILL KILL KILL!!!!"
AmmoItemName="SHOOT THE DEVS! LAZY SODS DESERVE TO DIE!!!!!"
Reply With Quote
  #3  
Old 05-29-2011, 12:44 PM
FluX FluX is offline
Senior Member
 
Join Date: Oct 2010
Posts: 3,728
Default

Quote:
Originally Posted by Excalibolg View Post
I have no idea what you're asking.
Basically what im trying to do is change the perk picture (the perks that go ontop of your character and bottom left of the screen) to custom colours. I have changed the perks to go bronze, silver and then gold BUT for some reason the first two perks (Red Perk - levels 0 - 5 and Gold Perk - levels 6 - 10) doesn't want to change colour but changes brightness of the colour.

The past part of the code can change colour to whatever RGB code I change it to (originally green). I have checked the code but it's exactly the same for all three parts of the perks. The texture picture is not the answer either as the code is saying they are using the same texture. How can I get the other two perk sections to work with my specific colour?
Reply With Quote
  #4  
Old 05-31-2011, 08:15 AM
FluX FluX is offline
Senior Member
 
Join Date: Oct 2010
Posts: 3,728
Default

*Bump*

Please someone help me get this working, I can't change colour of the perk but only the saturation/brightness of it.
Reply With Quote
  #5  
Old 05-31-2011, 10:00 AM
Marco Marco is offline
Senior Member
 
Join Date: May 2009
Location: Finland
Posts: 452
Default

Not sure if this is what you're asking about but... red perk icon only consists of color Red, so you can only scale the color value between black and red.
Yellow perk icon consists of colors Red and Green, thus allowing you to only use red, green, yellow and black color scales (not blue).
If you want to modify blue color of the icons you need to import new white perk icon textures.
Reply With Quote
  #6  
Old 05-31-2011, 10:59 AM
FluX FluX is offline
Senior Member
 
Join Date: Oct 2010
Posts: 3,728
Default

Right i've made my own picture perks to replace them. I can get this working but I can't get the stars to work at all. Anyone know how to edit the stars in-game (next to the perk symbol) that represents perk level?
I've seen that there is a SRHUDKillingFloor.uc file but don't want to touch (plus I can't find the picture names there).

----------------------Got above working---------------------

Found and changed the perk stars but im having a problem with a custom picture set im doing. I can change the "OnHUDIcon" and "OnHUDGoldIcon" to my custom pictures but I can't get my other custom pictures to work at the same time. (Located at bottom of every perk in defaultproperties:
Code:
OnHUDIcon=Texture'FluXiPerksTex.BBerserker'
OnHUDGoldIcon=Texture'FluXiPerksTex.GBerserker'
I would like another one added but dunno how to implement this called "OnHUDSilverIcon").

How could I make a "OnHUDSilverIcon" so I can edit all perks and add my silver version to it?

I've tried to do what I found in the ServerPerksV3 HUD addon had but I can only get stars to work and not the perks itself. They still show up as a gold perk (original).

Last edited by FluX; 06-01-2011 at 04:54 AM.
Reply With Quote
  #7  
Old 06-01-2011, 09:59 AM
Marco Marco is offline
Senior Member
 
Join Date: May 2009
Location: Finland
Posts: 452
Default

Code:
static function byte PreDrawPerk( Canvas C, byte Level, out Material PerkIcon, out Material StarIcon )
{
    PerkIcon = Material'YourNewPerkIconNameHere';
    StarIcon = Material'YourNewStarIconNameHere';
    if ( Level>10 )
    {
        Level-=10;
        C.SetDrawColor(250, 220, 0, C.DrawColor.A);
    }
    else if ( Level>5 )
    {
        Level-=5;
        C.SetDrawColor(200, 200, 200, C.DrawColor.A);
    }
    else C.SetDrawColor(220, 130, 0, C.DrawColor.A);
    return Min(Level,15);
}
This is not rocket science.
Reply With Quote
  #8  
Old 06-01-2011, 10:12 AM
FluX FluX is offline
Senior Member
 
Join Date: Oct 2010
Posts: 3,728
Default

That makes my perks and stars not show at all.

Right I think im getting somewhere with this. I have got a compiling error though:

Code:
SRHUDKillingFloor.uc<58> : Error, Unknown Property 'OnHUDSilverIcon' in 'Class KFMod.KFVeterancyTypes'
Here is the code:
Code:
  else if ( KFPlayerReplicationInfo(P.PlayerReplicationInfo).ClientVeteranSkillLevel > 5 )
  {
   TempMaterial = KFPlayerReplicationInfo(P.PlayerReplicationInfo).ClientVeteranSkill.default.OnHUDSilverIcon;
   TempStarMaterial = VetStarSilverMaterial;
   TempLevel = KFPlayerReplicationInfo(P.PlayerReplicationInfo).ClientVeteranSkillLevel - 5;
  }
In "SRVeterancyTypes.uc" I have added at the top:
Code:
var() texture OnHUDSilverIcon;
How can I get this code to work with the new variable I have created from this file instead of the original?

This should answer the whole perk changing as it will give me the setting inside the perk.uc to say what perk texture is OnHUDSilverIcon instead of just OnHUDIcon and OnHUDGold.

Last edited by FluX; 06-01-2011 at 05:52 PM.
Reply With Quote
  #9  
Old 06-04-2011, 02:04 AM
FluX FluX is offline
Senior Member
 
Join Date: Oct 2010
Posts: 3,728
Default

*Bump*

Really need help as whatever I do it comes up with an error. I thought the error above would be the best to stay on but when I try other code in, it says "bad member" etc.
Reply With Quote
  #10  
Old 06-04-2011, 04:41 AM
jeremweb's Avatar
jeremweb jeremweb is offline
Member
 
Join Date: Jan 2011
Posts: 31
Default

hum, try to see the code of Advenced Per Server Perk: http://forums.tripwireinteractive.co...ad.php?t=47547

you can see that:

Quote:
.
.
.
.
.
if( KFPRI.ClientVeteranSkillLevel <= 5)
Canvas.DrawTile(KFPRI.ClientVeteranSkill.default.O nHUDIcon, IconSize, IconSize, 0, 0, 256, 256);
else if( KFPRI.ClientVeteranSkillLevel <= 10)
Canvas.DrawTile(KFPRI.ClientVeteranSkill.default.O nHUDGoldIcon, IconSize, IconSize, 0, 0, 256, 256);
else if( KFPRI.ClientVeteranSkillLevel <= 15){
switch(KFPRI.ClientVeteranSkill.default.PerkIndex) {
case 0:
Canvas.DrawTile(Texture'KillingFloor3HUD.HUD.Perk_ Medic_Green', IconSize, IconSize, 0, 0, 256, 256);
break;
case 1:
Canvas.DrawTile(Texture'KillingFloor3HUD.HUD.Perk_ Support_Green', IconSize, IconSize, 0, 0, 256, 256);
break;
case 2:
Canvas.DrawTile(Texture'KillingFloor3HUD.HUD.Perk_ SharpShooter_Green', IconSize, IconSize, 0, 0, 256, 256);
.......
....
.....
Don't know if that can help you ^^!
Good luck
Reply With Quote
  #11  
Old 06-04-2011, 09:28 AM
FluX FluX is offline
Senior Member
 
Join Date: Oct 2010
Posts: 3,728
Default

I actually originally was looking at this BUT because Marco changed the way the perks were read (sorta), this wasn't needed at all. All I want to do is add an extra section to each of the perks OnHUDSilver="perk texture here" exactly the same as the red and gold perk is set-up. This will make my life so much easier as I only have to edit the perks itself instead of 2-3 different files.

Cheers for trying though.

Anyone else can help me? I don't want to let this down as this is the main part of the next update of my version and I need this part done before I can continue.

What I really was asking if anyone can try get the coloured line to read a different file instead of the default file it extends:

Code:
  else if ( KFPlayerReplicationInfo(P.PlayerReplicationInfo).ClientVeteranSkillLevel > 5 )
  {
   TempMaterial = KFPlayerReplicationInfo(P.PlayerReplicationInfo).ClientVeteranSkill.default.OnHUDSilverIcon;
   TempStarMaterial = VetStarSilverMaterial;
   TempLevel = KFPlayerReplicationInfo(P.PlayerReplicationInfo).ClientVeteranSkillLevel - 5;
  }

Last edited by FluX; 06-04-2011 at 09:29 AM.
Reply With Quote
  #12  
Old 06-04-2011, 04:26 PM
Excalibolg's Avatar
Excalibolg Excalibolg is offline
Senior Member
 
Join Date: May 2009
Location: KF-BioticsLab
Posts: 142
Default

How about instead of

Code:
TempMaterial = KFPlayerReplicationInfo(P.PlayerReplicationInfo).ClientVeteranSkill.default.OnHUDSilverIcon;
you try

Code:
TempMaterial = class<SRVeterancyTypes>(KFPlayerReplicationInfo(P.PlayerReplicationInfo).ClientVeteranSkill).default.OnHUDSilverIcon;
It's called Typecasting and it's not rocket science (That's funny though, Marco. That's what I keep telling people asking me for coding advice !)
__________________
Quote:
Originally Posted by KFWeaponPickup.uc
Description="I AM A DEFAULT DESCRIPTION! KILL ME NOW!"
ItemName="DULL ITEMNAME!!!! KILL KILL KILL!!!!"
AmmoItemName="SHOOT THE DEVS! LAZY SODS DESERVE TO DIE!!!!!"

Last edited by Excalibolg; 06-06-2011 at 11:30 PM.
Reply With Quote
  #13  
Old 06-04-2011, 05:01 PM
FluX FluX is offline
Senior Member
 
Join Date: Oct 2010
Posts: 3,728
Default

Quote:
Originally Posted by Excalibolg View Post
How about instead of

PHP Code:
TempMaterial KFPlayerReplicationInfo(P.PlayerReplicationInfo).ClientVeteranSkill.default.OnHUDSilverIcon
you try

PHP Code:
TempMaterial = class<SRVeterancyTypes>(KFPlayerReplicationInfo(P.PlayerReplicationInfo).ClientVeteranSkill).default.OnHUDSilverIcon
It's called Typecasting and it's not rocket science (That's funny though, Marco. That's what I keep telling people asking me for coding advice !)
Worked perfectly BUT you know im brand new to coding so shush
Reply With Quote
  #14  
Old 06-05-2011, 11:15 AM
Benjamin Benjamin is offline
Senior Member
 
Join Date: May 2009
Location: France
Posts: 3,419
Default

@Excalibolg: Use the code tag, it's much easier to read.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:35 AM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright ©2005 - 2013, Tripwire Interactive, LLC