Results 1 to 7 of 7
Thread: L4D Diff Change
-
12-15-08, 03:06 AM #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)
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...
-
12-15-08, 12:28 PM #2
Re: L4D Diff Change
Originally Posted by Bunni
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
-
12-15-08, 07:27 PM #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?:
Originally Posted by menu.py
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
-
12-16-08, 02:55 PM #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.
-
12-16-08, 03:00 PM #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).
-
12-16-08, 03:17 PM #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!
-
12-16-08, 03:58 PM #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)
Bookmarks