Page 6 of 8 FirstFirst ... 45678 LastLast
Results 101 to 120 of 144
  1. #101
    Administrator HigH_HawK's Avatar
    Join Date
    2006-03-15
    Location
    UK / GER
    Posts
    1,384

    Re: BF4Stats.com Graphics coding

    Quote Originally Posted by Napalm View Post
    can you tell me whats wrong with this?
    i can't get it to show the ribbon count. i've tried rCount and curr, neither have worked.

    Code:
      //Counts Ribbons by ID
    function countRibbons(rc){
      var i,r,cRC=0;
      for(i=0; i<pd.awards.length; i++) {
        r=pd.awards[i];
        if(r.id==rc){
          cRC = cRC + r.rCount;
        };
      }
      return cRC;
    }
    
    // Output Image
    image({file:"bf4/ribbons/r20.png", x:155, y:105, w:70, h:70});
    
    // Output Count
      text({x:215, y:162, color:'00ff0c', 
            text: countRibbons('r20'),angle:'5',align:'center'});

    fixed it:
    Code:
    function countRibbons(rc){
      var i,r,cRC=0;
      for(i=0; i<pd.awards.length; i++) {
        r=pd.awards[i];
        if(r.id==rc){
          cRC = cRC + r.rCount;
        };
      }
      return cRC;
    }
    
    // Output Image
    image({file:"bf4/ribbons/r20.png", x:155, y:105, w:70, h:70});
    
    // Output Count
      text({x:215, y:162, color:'00ff0c', 
            text: countRibbons('m20'),angle:'5',align:'center'});
    for some reason it only shows when m20 is set as the ribbon, is this a bug?
    I think I found the error in the function, I however only tested it with some players:

    Code:
    //Counts Ribbons by ID
    function countRibbons(rc){
      var i,r,cRC=0;
      for(i=0; i<pd.awards.length; i++) {
        r=pd.awards[i];
        if(r.ribbon.id==rc){
          cRC = cRC + r.rCount;
        };
      }
      return cRC;
    }

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

    Re: BF4Stats.com Graphics coding

    Quote Originally Posted by PHANTOM_Zyk View Post
    Hi again. I tried to used this function with each knive but it did not work, replacing 'Weapon' by Bowie for example. Why ?

    function findWeapon(id) {
    if (!pd || !pd.weapons) return null;
    var i,w;
    for (i=0; i<playerRankings.length; i++) {
    w=pd.weapons[i] ;
    if(w.stat.id==id) return w;
    }
    return null;
    }

    shadowText({x:0,y:0,text:'Weapon'});
    shadowText({x:0,y:0,font:bigF,text:nf(findWeapon(' Weapon').stat.kills),size:0});
    Please try this:

    Code:
    function findWeapon(id) {
    if (!pd || !pd.weapons) return null;
    var i,w;
    for (i=0; i<pd.weapons.length; i++) {
    w=pd.weapons[i] ;
    if(w.stat.id==id) return w;
    }
    return null;
    }
    
    var weapon;
    if(weapon=findWeapon('bowie')) {
    shadowText({x:0,y:0,text:'Weapon'});
    shadowText({x:0,y:0,font:bigF,text:(weapon.stat.kills),size:0});
    }

  3. #103
    New User
    Join Date
    2014-03-26
    Posts
    2

    Re: BF4Stats.com Graphics coding

    hi,
    i m having a big problem to create the code for C4 kills.
    i know that i' am noob in this, can someone create the code, or tell me what do to make one?

  4. #104
    New User
    Join Date
    2014-03-26
    Posts
    2

    Re: BF4Stats.com Graphics coding

    this code is one from Bf3... i can't "translate " it to Bf4

    Code:
    ///Images
    
    //Background picture
    
    image({file:'0oDiclSEo0XI85BIGo/468px-C4.png', x:-0, y:-18});
    
    ///Text
    
    //Player name
    
    text({font:'0oB1t8WQX0mC4sTAP1/Paint-hand_limited-set.ttf', color:'E41B17', size:15, x:137, y:135, text:p.name});
    
    //taunt text
    
    text({text:'WTF!', size:23, color:'E41B17', angle:16, x:133, y:89});
    
    //Boom text
    
    text({text:'Boom!!!', angle:10, size: 25, color:'E41B17', x:156, y:110});
    
    //kill count text
    
    text({font:'0oB1t8WQX0mC4sTAP1/eXO2 Stencil.ttf', color:'FFFFFF', size:19, x:67, y:105, text:p.stats.equipment.waeC4.kills});
    
    // Platform
    var pl_x=0;
    var pl_y=0;
    
    if(p.plat == 'pc')
    {
    pl_x=0;
    pl_y=40;
    }
    else if(p.plat == 'ps4')
    {
    pl_x=40;
    pl_y=0;
    }
    else if(p.plat == '360')
    {
    pl_x=0;
    pl_y=0;
    }
    image({file:'0oAsQTXzK0NkDOrlLi/PlatformLogos.png', x:280, y:120, w:20, h:20, sx:pl_x, sy:pl_y, sw:40, sh:40});

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

    Re: BF4Stats.com Graphics coding

    Hi xliga,

    could you please show me a link to the original BF3 signature, so that I can see how it should look at the end?

    Thanks in advance

  6. #106
    New User
    Join Date
    2014-02-22
    Location
    GERMANY
    Posts
    7

    AW: BF4Stats.com Graphics coding

    You have to use the data set pd.weapons[118].stat.kills
    This is for the number of C4 kills!

    Exmple:
    text({x:50,y:50,text:'C4 Kills: ' + pd.weapons[118].stat.kills,size:10});

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

    Re: AW: BF4Stats.com Graphics coding

    Quote Originally Posted by killercorny View Post
    You have to use the data set pd.weapons[118].stat.kills
    This is for the number of C4 kills!

    Exmple:
    You should never access the weapon data like

    Code:
    pd.weapons[118].stat.kills
    as the number could change at any time and would show wrong information afterwards. Best example is, that 118 for instance currently belongs to the sidearm "FN57" and C4 currently is 106.

    Please always use a function as the following one:

    Code:
    function findWeapon(id) {
    if (!pd || !pd.weapons) return null;
    var i,w;
    for (i=0; i<pd.weapons.length; i++) {
    w=pd.weapons[i] ;
    if(w.stat.id==id) return w;
    }
    return null;
    }
    
    //Output Example
    var weapon;
    if(weapon=findWeapon('c4-explosive')) {
    shadowText({x:0,y:0,text:'Weapon'});
    shadowText({x:0,y:0,font:bigF,text:(weapon.stat.kills),size:0});
    }

  8. #108

    Re: BF4Stats.com Graphics coding

    Hello, I have two questions about server graphics.

    1. I have noticed others have "alternate" pictures for the current map they are playing, these differ from the loading screen pictures which seem to be the most popular used. What code is used for these alternate pictures?

    2. What is the code to display the "next map" in the server rotation?


    Thanks!!
    killswitch805

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

    Re: BF4Stats.com Graphics coding

    As I see all server graphics use the same map graphics from our library.
    You can download that image library there: http://bf4stats.com/bf4stats.com_images.zip

    To find the next map, you can do that:

    Code:
    var nextMap = sd.maps[sd.nextMapIndex];
    if(nextMap) {
        text({text:nextMap.mapName, x:10, y:20});
    }
    Admin of bfhstats.com / bf4stats.com / bf3stats.com | Twitter

  10. #110

    Re: BF4Stats.com Graphics coding

    When I insert this code it just gives me the code index, which is the number of the map in the rotation
    Last edited by killswitch805; 2014-05-16 at 01:06.

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

    Re: BF4Stats.com Graphics coding

    Quote Originally Posted by killswitch805 View Post
    When I insert this code it just gives me the code index, which is the number of the map in the rotation
    I tried the function 1ApRiL provided and I get the name of the next map. Please could you check if your code matches the one from him?

    If you should still encounter problems with it, you can also send me the edit link to your graphic and I'll have a look.

  12. #112

    Re: BF4Stats.com Graphics coding

    It works now but seems like the next map lags behind the current map, so it will show the same map for the current and next at the same time.

    Here is my edit link:http://bf4stats.com/graphics/edit_LOIJOIJ
    Last edited by killswitch805; 2014-05-20 at 09:53.

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

    Re: BF4Stats.com Graphics coding

    The current map might be shown as next map if the next round is on the same map. Because you play two rounds on the same map.

    Try this, it steps to the next map if nextMap is the same as currentMap:
    Code:
    var currentMap = sd.maps[sd.currentMapIndex];
    var nextMap = sd.maps[sd.nextMapIndex];
    if(sd.currentMapIndex == sd.nextMapIndex && sd.maps.length>1) {
        nextMap = sd.maps[(sd.nextMapIndex+1)%sd.maps.length];
    }
    if(nextMap) {
        shadowText({text:nextMap.mapName,font:bigF, x:75, y:28});
    }
    Admin of bfhstats.com / bf4stats.com / bf3stats.com | Twitter

  14. #114

    Re: BF4Stats.com Graphics coding

    Hello again. I recently created a new graphic, and for some reason, the Player History graph no longer shows. Do you know what could cause this? Edit Link: http://bf4stats.com/graphics/edit_8451

    thank you for your time!

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

    Re: BF4Stats.com Graphics coding

    Quote Originally Posted by killswitch805 View Post
    Hello again. I recently created a new graphic, and for some reason, the Player History graph no longer shows. Do you know what could cause this? Edit Link: http://bf4stats.com/graphics/edit_8451

    thank you for your time!
    You need to tick the box "Player count history" at the top right hand corner.

  16. #116

    Re: BF4Stats.com Graphics coding

    Gotcha, thanks! Is there a code for Arial Font? And Bold Arial Font?

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

    Re: BF4Stats.com Graphics coding

    By default, you can only use the standard fonts which you can find under "Manage files -> Fonts". At the moment there is only Vera***.ttf stuff.

    You can however upload your own font file (*.ttf) and then use that one in your graphic.

    Example:

    Code:
    /* Default Font */
    defaults.text.font='{ID}/Arial.ttf'; ({ID} is the ID, which all you uploads have)
    
    /* Only want to use Arial for some text */
    var Arial='{ID}/arial.ttf'; ({ID} is the ID, which all you uploads have)

  18. #118

    Re: BF4Stats.com Graphics coding

    Im not sure if I understand where the {ID} comes from, where do I find the upload location ID? Is that the file path on my computer? I cannot upload the .tiff file to a second party. Thanks.

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

    Re: BF4Stats.com Graphics coding

    No, the {ID} has been generated by bf4stats.com for you upon your registration. It consists of lower case and capital letters as well as digits.

    Example:

    0orkNp8D80j4W9C9tT

    Click image for larger version

Name:	bf4stats_upload_example.PNG
Views:	164
Size:	174.7 KB
ID:	13738

    As for uploading new fonts, you can do that very easily via the "Manage files" section on bf4stats.com. Just do a search on your computer for "arial*.ttf" and it should come up with something like:

    Click image for larger version

Name:	font_search_win.PNG
Views:	155
Size:	116.0 KB
ID:	13739

  20. #120

    Re: BF4Stats.com Graphics coding

    Awesome! I'm finally done with it! Thank you so much, youve been so helpful!!

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