Hi there, is there any way to insert a custom python script directly in a map directory, as opposed to inserting it in a mod's python directory?
I don't want to modify any modfile for custom mapping, although having custom scripts in a map would be quite useful.
what does execfile (used to call each map's mapdata.py from perMapData.py) exactly do? in other words, can mapdata.py only be used to read dicts?
PS: keep in mind I don't really know python, or programming in general :P so please use simple words to explain :D
execfile runs mapdata.py as a standalone script, so yes you can do all sorts of things in your mapdata.py like include custom python plugins which can change many things.
I must be doing something wrong then... I tried placing this simple code in the map's mapdata.py import host
def init(): host.rcon_invoke('sv.numPlayersNeededToStart 1')
But it doesn't appear to be working, at least when hosting the map as multiplayer conquest on local (no dedicated server)...
I placed the same mapdata file in the map dir, server.zip and client.zip. What am I doing wrong?
bump.... (I know, that's not very polite netiquettewise)
does anyone know how to solve this? I've made no progress since then :(
Ok I found out what the problem was, just ignore the post above :banghead:
Personally I would just like to know what file the command is in normally. Ive spent all morning looking to get a map to run with just me in my created server. I have ths on my laptop so I'm not worried about online gaming, but it would help me test some basic changes I'm doing to the python code since the tickets wont bleed unless I do it.
Thanks in advance to the person who can tell me. (or even the way you did it Rattovolante)
I'm not sure I understand what you mean. You just want to have your map start with only 1 player when you test it in local?
This is usually done by enteringsv.numPlayersNeededToStart 1 in the console (to activate the console, while in-game press the key left of "1" - IIRC, it should be "~" on standard English keyboards)
If you want to have it automatically executed every time you run a specific map just insert this code into the map's mapdata.py: import host host.rcon_invoke('sv.numPlayersNeededToStart 1')
This simply instructs python to send a 'sv.numPlayersNeededToStart 1' string to the remote console (rcon) when the map is started.
I think you only need to insert it into the mapdata.py inside the server.zip file, but I'm not 100% sure (if you test this, let me know)
Thanks I used the console command to test my change. ------- BTW it worked. Nothing important, but I found once that I had 8 kills and no deaths. At the end of the round the person with the highest K/D ratio had a 2. This means that anyone who doesn't have a death in game is excluded from the final k/d tally because you cannot divide by zero.
All I needed to do was add an Else statement where I just had it take the kills and divide by 1. Although not a true K/D ratio it allows players who do manage not to die to be recognized.