Results 1 to 10 of 10
  1. #1
    Administrator HigH_HawK's Avatar
    Join Date
    2006-03-15
    Location
    UK / GER
    Posts
    1,381

    Ausrufezeichen BFHStats.com Graphics coding

    If you're having trouble creating your own graphic at http://bfhstats.com/graphics/player or http://bfhstats.com/graphics/server - This is the place to post your questions.

  2. #2
    Administrator HigH_HawK's Avatar
    Join Date
    2006-03-15
    Location
    UK / GER
    Posts
    1,381

    Re: BFHStats.com Graphics coding

    I've come across some graphics which are not being shown anymore after a soldier reached the max. level. After doing some random checks on these graphics I noticed that about 99% of them are showing errors in the debugger, related to the progress bar. I therefore wanted to share my progress bar function:

    Code:
    // Progress Bar Function 
    function drawProgressBar(opt) {
      var w=opt.w;
      
      opt.fill=opt.bgColor;
      rectangle(opt);
      
      opt.fill=opt.barColor;
      
      if(!pd.player || !pd.player.rank || !pd.player.rank.next) return;
      
      opt.w=Math.round(pd.player.rank.next.relProg/100*opt.w);
      rectangle(opt);
      
      opt.color=opt.fontColor;
      opt.x=Math.round(w/2.5+opt.x);
      opt.y+=opt.h*1.2;
      opt.text=nf(pd.player.rank.next.relProg)+'%';
      text(opt);
      
    }
    Code:
    // Draw Progress bar
    if (!pd.player.rank.next) {
      drawProgressBar({x:40, y:79, w:55, h:6, bgColor:'505050-100',barColor:'505050-100',size:'7'});
    } else {
      drawProgressBar({x:40, y:79, w:55, h:6, bgColor:'505050-100',barColor:'908F8F',size:'7'});
    }
    This function will show the progress bar until the max. level has been reached. When the max. level is up, the progress bar will disappear and not generate any errors anymore.
    Last edited by HigH_HawK; 2015-03-30 at 14:51.

  3. #3
    New User
    Join Date
    2012-03-09
    Posts
    2

    Melee kills stats

    Hi,
    is there a code for melee weapons like Battlelog?
    As example:

    10 kills with Knife
    10 kills with Police Baton
    5 kills with Breaching Hammer
    should show me 25 melee kills.

    I have tried pd.weaponCategory[0].stat.kills, but it shows me not the same melee stats as i have in BL.
    In my case: 64 kills in BL, 41 in bfhstats.
    Thx!
    Rucki

  4. #4
    Administrator 1ApRiL's Avatar
    Join Date
    2011-02-12
    Location
    Waiblingen, Germany
    Posts
    1,525
    BFBC2 PC
    1ApRiL
    NFS World
    1APRIL
    BF2
    1ApRiL
    BF3 PC
    1ApRiL

    Re: Melee kills stats

    There are different take down methods with melee weapons.

    The weaponCategory just sums up the kills from the weapons which are in that category.
    You would need to sum up the blunt and sharp categories to get all melee kills.

    There is also pd.stats.dogtagsTaken, which counts only the take downs from behind.
    Admin of bfhstats.com / bf4stats.com / bf3stats.com | Twitter

  5. #5
    New User
    Join Date
    2012-03-09
    Posts
    2

    AW: Re: Melee kills stats

    Hi,
    thanks a lot!
    Quote Originally Posted by 1ApRiL View Post
    You would need to sum up the blunt and sharp categories to get all melee kills.
    Sum up is the solution! But i have no idea how to do that. :/
    Also i cant find any template where "sum up" is used.
    Could you give me an example?
    Thanks!
    Rucki

    pd.weaponCategory[0].stat.kills
    pd.weaponCategory[2].stat.kills

  6. #6
    Administrator 1ApRiL's Avatar
    Join Date
    2011-02-12
    Location
    Waiblingen, Germany
    Posts
    1,525
    BFBC2 PC
    1ApRiL
    NFS World
    1APRIL
    BF2
    1ApRiL
    BF3 PC
    1ApRiL

    Re: Melee kills stats

    Never access specific items by their index.
    http://forum.p-stats.com/threads/390...l=1#post125202

    You could just sum up the weapons directly.
    Code:
    var meleeKills = 0;
    pd.weapons.forEach(function(w){
    	if(w.detail && ['BLUNT','SHARP'].indexOf(w.detail.category)!=-1) {
    		meleeKills++;
    	}
    });
    Last edited by HigH_HawK; 2015-03-30 at 17:19. Reason: Edited the Typo at detail
    Admin of bfhstats.com / bf4stats.com / bf3stats.com | Twitter

  7. #7
    New User
    Join Date
    2014-01-01
    Posts
    19
    BFBC2 PC
    CQB-Vapulabis
    BF3 PC
    CQB-Vapulabis

    Failing Graphic

    Hello

    I noticed today whilst looking at other peoples graphics that a lot of them did not show the graphic for a certain player, mine was one of them so I went rooting to find out why, the graphic was failing because the player did not have any patches set and when requested by the graphic it was failing because it could not find the image of "null", if you have found this in your graphic for players with no patches set, I have used this code to get round this problem
    Code:
    //SHOW THE IMAGE OF THE LEFT HAND PATCH IMAGE IF AVAILABLE
    if(pd.dogtags){
    image({ x:140, y:57, file:pd.dogtags.basic.img, w:40, h:40 })
    };
    Just thought it might be useful.

  8. #8
    Administrator HigH_HawK's Avatar
    Join Date
    2006-03-15
    Location
    UK / GER
    Posts
    1,381

    Re: Failing Graphic

    Quote Originally Posted by CQB-Vapulabis View Post
    Hello

    I noticed today whilst looking at other peoples graphics that a lot of them did not show the graphic for a certain player, mine was one of them so I went rooting to find out why, the graphic was failing because the player did not have any patches set and when requested by the graphic it was failing because it could not find the image of "null", if you have found this in your graphic for players with no patches set, I have used this code to get round this problem
    Code:
    //SHOW THE IMAGE OF THE LEFT HAND PATCH IMAGE IF AVAILABLE
    if(pd.dogtags){
    image({ x:140, y:57, file:pd.dogtags.basic.img, w:40, h:40 })
    };
    Just thought it might be useful.
    Thanks for that! I just moved your post to the "BFHStats.com Graphics coding" thread, so we can collect the useful information for the graphics coding in one place.

  9. #9
    New User
    Join Date
    2014-01-01
    Posts
    19
    BFBC2 PC
    CQB-Vapulabis
    BF3 PC
    CQB-Vapulabis

    Re: BFHStats.com Graphics coding

    Gents

    this may be a step too far, but is it possible to have a single graphic for a player, but have the rank image, kills and KD ratio for Bf3, BF4 and BFH? as long as that players name remains constant through the games obviously.

    Best Regards

    Vapulabis

  10. #10
    Administrator HigH_HawK's Avatar
    Join Date
    2006-03-15
    Location
    UK / GER
    Posts
    1,381

    Re: BFHStats.com Graphics coding

    No, this is not possible as the sites are all using a different api to fetch the data for that player. Combining these would mean quite a lot of work for the developer as he has to rename quite a few variables to prevent duplicates.

    The only thing you could do is to create a static graphic where you put he K/D and W/L manually, this however means that the data is never been updated dynamicly.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
P-STATS NETWORK FORUM LOGIN CREATE ACCOUNT