Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: [COD2] Random string hud

  1. #1
    Private
    Join Date
    Aug 2012
    Posts
    78
    Thanks
    20
    Thanked 10 Times in 5 Posts

    [COD2] Random string hud

    Hi all,
    Does anyone know how to show the screen random hud?
    The point is that I would like to create a hud but the string would be selected from the string array.

    Look this:
    PHP Code:
    inithudtext()
    {
        
    level.vote_maptext1 newHudElem();
        
    level.vote_maptext1.archived false;
        
    level.vote_maptext1.434// 434
        
    level.vote_maptext1.level.mapvotehudoffset 253;
        
    level.vote_maptext1.sort 1;
        
    level.vote_maptext1 setText(level.mapcandidate[0]["mapname"]);
        
        
    iprintln(level.mapcandidate[0]["mapname"]);

    It work only this
    Code:
    iprintln(level.mapcandidate[0]["mapname"]);
    but hud is invisible..
    Please help me someone.

  2. #2
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    You're probably forgetting to developer 1.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  3. #3
    Private
    Join Date
    Aug 2012
    Posts
    78
    Thanks
    20
    Thanked 10 Times in 5 Posts
    How to add precacheString, which came from the array?

    PS. Thanks for developer 1

  4. #4
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    You have to rewrite it. Precache the mapnames like they are showed

  5. #5
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    And with what error does the thing crash when you run it with developer 1?
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  6. #6
    Corporal voron00's Avatar
    Join Date
    Nov 2014
    Posts
    248
    Thanks
    64
    Thanked 216 Times in 116 Posts
    Alright, if you use libcod you can use use new makelocalizedstring function:
    PHP Code:
    // Find free localized string index
    index findFreeConfigStringIndex(1310256);

    // Set configstring
    setConfigString(indexlevel.mapcandidate[0]["mapname"]);

    // Your Hud Stuff
    level.votemap0 setText(makeLocalizedString(level.mapcandidate[0]["mapname"]));

    findFreeConfigStringIndex(startend)
    {
        for (
    start 1start endi++)
        {
            
    configstring getConfigString(i);
            if (!
    isDefined(configstring))
                return 
    i;
        }

        return 
    undefined;

    Just tested it, works quite nicely.

    Or you can use the old fashioned way and replace strings on a client (iznogod's settext wrapper)
    Last edited by voron00; 27th March 2017 at 16:14.
    sudo apt-get rekt

  7. The Following User Says Thank You to voron00 For This Useful Post:

    kung foo man (27th March 2017)

  8. #7
    Private
    Join Date
    Aug 2012
    Posts
    78
    Thanks
    20
    Thanked 10 Times in 5 Posts
    Thank you for your involvement

    But i have this error:

    Code:
    ******* script compile error *******
    unknown function: (file 'maps/mp/gametypes/_mapvote.gsc', line 328)
    configstring = getConfigString(i);
    *
    ************************************
    Sys_Error: Error during initialization:
    script compile error
    (see console for details)

  9. #8
    Private
    Join Date
    Aug 2012
    Posts
    78
    Thanks
    20
    Thanked 10 Times in 5 Posts
    IzNoGOD the error message is that you can not precachestring (level.mapcandidate [0] ["mapname"]); To use in a script only, but only when the map loads, and i mean that the script that draws the map is only at the end of it draws, so i would like to add precachestring (level.mapcandidate [0] ["mapname"]); Only when will download map compilation.

  10. #9
    Corporal voron00's Avatar
    Join Date
    Nov 2014
    Posts
    248
    Thanks
    64
    Thanked 216 Times in 116 Posts
    Quote Originally Posted by Moczulak View Post
    Thank you for your involvement
    But i have this error:
    Quote Originally Posted by voron00 View Post
    Alright, if you use libcod you can use use new makelocalizedstring function:
    10 char. bla-bla
    sudo apt-get rekt

  11. #10
    Private
    Join Date
    Aug 2012
    Posts
    78
    Thanks
    20
    Thanked 10 Times in 5 Posts
    I'm using function precacheString(); to defined strings.

    what is this 10 char?
    Last edited by Moczulak; 27th March 2017 at 20:30.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •