Results 1 to 7 of 7

Thread: L4D Diff Change

  1. Administrator Bunni's Avatar
    Join Date
    08-29-07
    Posts
    14,279
    Post Thanks / Like
    Blog Entries
    7
    Stat Links

    L4D Diff Change L4D Diff Change L4D Diff Change L4D Diff Change L4D Diff Change
    Gamer IDs

    Steam ID: bunni Bunni's Originid: Dr_Bunni
    #1

    L4D Diff Change

    cant get mm to like me... any chance you could post your l4d setup ewok?


    -_-



    for later (not all changes, will add the rest (and actually body of code tomorrow, for now... sleep)):
    addition to server.py
    Code:
    def changeDifficulty(difficulty):
      serverCommand("z_difficulty " + difficulty)

    addition to actions.py
    Code:
    def changeDifficulty(invoker, difficulty):
      logAction(invoker, "Set the difficulty to:" % difficulty)
      server.changeDifficulty("z_difficulty " + difficulty)
    change to menus.py
    Code:
     def _createServerManagementMenu(self, account):
        title = "Server Management"
        menu = self._createSubmenuTemplate(title)
        
        if account.testForPower((client.POWER_SERVER_SETTINGS,)):
          menu.setItem(1, ActionMenuItem("Server Settings", RconSettingAction(self)))
          menu.setItem(2, ActionMenuItem("Change Difficulty", ChangeDifficultyAction(self)))
        
        return (title, menu)

    almost done with the forceful change of difficulty -_- still got a bug or two to tweak, mostly seperating vs and coop, but for the most part it should work... just need to test it...

  2. Registered TeamPlayer
    Join Date
    10-29-07
    Posts
    4,953
    Post Thanks / Like
    Stat Links

    L4D Diff Change
    #2

    Re: L4D Diff Change

    Quote Originally Posted by Bunni
    cant get mm to like me... any chance you could post your l4d setup ewok?
    What exactly do you mean by setup? Server setup? Lonestar build setup?

    If you're referring to build. You need to have metamod 1.7, and since they changed how things are organized, it needs to look like

    Code:
    development-dir/
      hl2sdk
      hl2sdk-ob
      hl2sdk-l4d
      metamod1.7
      lonestar

  3. Administrator Bunni's Avatar
    Join Date
    08-29-07
    Posts
    14,279
    Post Thanks / Like
    Blog Entries
    7
    Stat Links

    L4D Diff Change L4D Diff Change L4D Diff Change L4D Diff Change L4D Diff Change
    Gamer IDs

    Steam ID: bunni Bunni's Originid: Dr_Bunni
    #3

    Re: L4D Diff Change

    woops missed the post in the other forum,


    Ahh ya i had mm1.7 but didnt notice the changes and had an old version of the modinfo.py file (made a change to it eariler so it didnt update when i grabbed updated files from repos >_< )

    Anychance you could explain this line to me?:
    Quote Originally Posted by menu.py
    class ChangeMapAction(ChooserAction):
    def __init__(self, parentDialog):
    ChooserAction.__init__(self, parentDialog, "Change to which map?", self._mapSelected)

    def getChoices(self):
    return [(m, m) for m in mapManager.mapList]

    def _mapSelected(self, invoker, mapName):
    actions.changeMap(invoker, mapName)
    Additionally im having trouble trying to find how to format items to be displayed in the ui menu.

    Btw ewok this is worth a look and definitly great to keep on hand, full cvar list including the hidden http://www.left4dead411.com/l4d_cvar_list.pdf

  4. Registered TeamPlayer
    Join Date
    10-29-07
    Posts
    4,953
    Post Thanks / Like
    Stat Links

    L4D Diff Change
    #4

    Re: L4D Diff Change

    [ x for x in list] is called a list comprehension, and it's a one-liner way to transmute a list into another list

    So if mapManager.mapList is the following list:
    [ "de_dust", "de_aztec", "cp_italy" ]

    Then that line will create a return this new list:
    [ ("de_dust", "de_dust"), ("de_aztec", "de_aztec"), ("cp_italy", "cp_italy") ]

    It reads: for each element in the following list, make a 2-element tuple of the same thing for both elements

    The reasoning is that the map list is a simple list of strings, yet ChooserDialog needs a list of options, where each option is 2 elements (0=the display string, 1=a unique identifier). In the case of choosing maps, we make the unique identifier and the display string both the name of the map.

  5. Registered TeamPlayer
    Join Date
    10-29-07
    Posts
    4,953
    Post Thanks / Like
    Stat Links

    L4D Diff Change
    #5

    Re: L4D Diff Change

    Regarding formatting for the menu, what are you trying to do exactly?

    It only accepts strings and you can't color code anything beyond yellow or white. Historical usage tries to reserve yellow for selectable items, while white is "other stuff"

    To get something to be yellow, the first characers of that line have to be something like "->" (i.e. a selectable menu item), and it will color the rest of that line yellow. Check out ui.py as that should have that logic in there. If the line doesn't start with those characters, it will be white.

    You can insert blank lines, but only if there is a space following the blank line, otherwise the game engine collapses the blank lines. See ui.NEWLINE to see what I mean (it's called something like that anyway).

  6. Administrator Bunni's Avatar
    Join Date
    08-29-07
    Posts
    14,279
    Post Thanks / Like
    Blog Entries
    7
    Stat Links

    L4D Diff Change L4D Diff Change L4D Diff Change L4D Diff Change L4D Diff Change
    Gamer IDs

    Steam ID: bunni Bunni's Originid: Dr_Bunni
    #6

    Re: L4D Diff Change

    for the select a diff menu, i am debating on how to have the difficulties added in, be them hard coded or perhaps have the addon get the cvar description for z_difficulty and token out the different difficulties, that way should any more ever be added, or any be altered, the code would have no issues. Though as always, the 2nd is more complicated.

    Long story short i was trying to figure out how to format the items i returned to the chooserdialog, but you answered that question and thank you!

  7. Registered TeamPlayer
    Join Date
    10-29-07
    Posts
    4,953
    Post Thanks / Like
    Stat Links

    L4D Diff Change
    #7

    Re: L4D Diff Change

    Considering how unlikely it is that they are going to add/remove difficulties from what they already have, I'd just hardcode them. Changing them would be easy enough in the blue-moon chance it would need to be done.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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
  •  
Title