Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] Per map setting?

#1
Game admins,

I wonder whether it's possible to have a per-map balance setting. Many maps are ported from other games, and some of them requires a bit of modification to make sense. For example, I would like to turn off fall damages for maps with high surfaces.

Is this possible? For example, perhaps there's a way to get the name of the next map, and use that to trigger some alias to set a bunch of variables.

Thanks a lot.
Reply

#2
Need to put it into the mapinfo:
Code:
settemp_for_type all <cvar>
Reply

#3
Thanks, @Mirio. I'll test it out and mark this as solved after I figure it out.
Reply

#4
Thanks, @Mirio. Worked like a charm.

For anybody who wants to do the same thing, here's a small script to batch add necessary settings to a bunch of pk3 files.

Code:
#!/usr/bin/perl

# this script extracts mapinfo files from the given pk3,
# then add custom settings to the end of the mapinfo file,
# and then repack it back to the pk3 and delete the temp file

my $custom_settings = <<'END';
// prevent any kind of motion damage (bump into a wall, falling, etc.)
settemp_for_type all g_balance_falldamage_maxdamage 0
END

my %filename;
$filename{'pk3'} = $ARGV[0];
if (!$filename{'pk3'}) {
    die "$0 mapfile.pk3\n";
} elsif (!-e $filename{'pk3'}) {
    die("file not found\n");
}
my $cmd = "/usr/bin/7z x -y \"$filename{'pk3'}\" maps/\\*.mapinfo";
my @cmd_output = split("\n", `$cmd`);
foreach my $fname (@cmd_output) {
    if ($fname =~ s|^Extracting\s+||) {
        open(my $fh, ">>$fname");
        print $fh $custom_settings;
        close($fh);
        `/usr/bin/7za a -y \"$filename{'pk3'}\" "$fname"`;
        unlink("$fname");
    }
}

Here's an example of how I used it to add no-fall-damage setting to all World of Padman maps.

Code:
$ mkdir temp
$ cd temp
$ for i in ~/.xonotic/custom_maps/wop/*wop*.pk3; do ~/bin/nofalldamage.pl "$i"; done
$ cd ..
$ rm -rf temp
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  [NEED HELP] How to do newlines within a setting? Antares* 6 3,949 07-05-2017, 02:37 PM
Last Post: BuddyFriendGuy
  Setting up infinite ammo in instagib? DECtape 4 7,065 11-03-2015, 09:44 PM
Last Post: lister
  [SOLVED] Question about Treasure Island setting BuddyFriendGuy 9 8,279 07-08-2015, 08:50 AM
Last Post: sev
  Reasonable # of players per server end user 2 4,292 08-06-2013, 12:30 PM
Last Post: end user
Brick Disable Map Preview Map On Votescreen -maniac|Su- 1 2,539 12-17-2012, 08:10 AM
Last Post: PinkRobot
Wink Server Admins - Please add at least 1 bot per public server evit 16 14,608 04-09-2012, 12:49 PM
Last Post: nonenone
  Server setting => g_antilag ? evit 6 8,083 02-06-2012, 03:58 PM
Last Post: evit

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB original theme © iAndrew 2016, remixed by -z-