Jump to content
Official BF Editor Forums

amideadyet

Members
  • Posts

    117
  • Joined

  • Last visited

Profile Information

  • Gender
    Male

Recent Profile Visitors

4,339 profile views

amideadyet's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. If you've got a *nix system, you could do: find . -name *bundledmesh -exec strings "{}" \; | grep '/textures/.*.dds$' | uniq -c which will do what you described for all files/folders recursively in the current directory. Though, it would need a little tweaking to look in zips as well.
  2. Well, normally you'd have a lot of options, but for a program the size of 2142 some of them aren't really gonna be viable. I'd recommend IDA Pro, but it's several thousand dollars to buy (but uh, I'm sure you could find a download of the leaked v6.8 somewhere... just be careful where). Nothing else really comes close, but here's a link discussing alternatives (though this also lists debuggers, which you don't want -- only the disassemblers are relevant). If you've never done any reversing before, I'd recommend starting on some simple programs to learn before looking at 2142. Maybe try these or some of these.
  3. This is a proof of concept for hooking game engine events that are normally inaccessible to python. https://gist.github.com/AndrewMarumoto/22e4edfe8dfab12e8513d41fcca8b700 If anything is unclear, or if you just have questions in general, let me know.
  4. All things game related are in the server executable, the python library is just python (normal python, nothing game related, and nothing stripped out). I'm a bit busy with finals this week, but I'll see if I can get the writeup on hooking new events finished when I get a chance. EDIT: Ah, btw, you're not gonna be able to run it on a Pi. There aren't any ARM builds afaik.
  5. You *should* be able to get it working with a prebuilt DLL. I tried and failed, but that was under WINE instead of actual windows.
  6. Yeah, not much different besides the name of the server directory in that regard. I haven't tested it personally for bf2, but it's been done before.
  7. You can access literally anything the gameserver does, the only thing stopping you is the need to reverse engineer the relevant parts of the server executable and then (if you're hooking stuff) write the code to bootstrap python integration in assembly. So far, I've got a simple proof of concept working hooking comm rose events and having them call out to python code. Also have a thing that lets you change the server fps limit on the fly, but that's fairly simple in comparison. This stuff is all possible through static patching, but it's so much cleaner to do it at runtime using ctypes.
  8. It's been a while since I posted here... figured I'd share some of the things I've been working on since I started messing with 2142 again. The python interpreter included with vanilla Battlefield 2142 is lacking a fairly large amount of functionality. Much of this involves restrictions on OS interaction, as well as the removal of threading support and the ability to load C extensions. Due to this, a large chunk of the standard library is broken as it depends on functionality that was removed. The goal here is to replace 2142's python interpreter with an unrestricted one and to include the full standard library. https://gist.github.com/AndrewMarumoto/36f710b8e35dd99580ccf35a42eef713 ^ instructions for doing so
  9. Here's the code that I use to get it (slightly modified as I connect remotely rather than from within bf2/142 python): def get_ids(template): # , conn): ....# objects = conn.send_recv("exec object.listObjectsOfTemplate {0}".format(template)) ....objects = host.rcon_invoke("object.listObjectsOfTemplate %s" % (template)) ....objects = objects.split('\n') ....result = {} ....for line in objects: ........if line == '' or line == '\n': continue ........line = line.split(" with id ") ........name = line[0].replace(template, '').replace('"', '') ........# if name == "untitled": continue ........id = line[1].split(" of t")[0] ........id = "id%s" % (id) ........if not name in result: ............result[name] = [] ........result[name].append(id) ....return result This was made to get player object Ids, and might not work as expected on vehicles or other objects which do not have unique names. (It returns a dictionary of the format {<name>: <id list>,}) So you might want to modify it to create a new entry every line regardless of what the name is so you won't get all objects with the name "Untitled" grouped under the same entry. EDIT: Thanks Freeze for that "object.hasCollision" command, it led me to look through some of the old python threads here and find the "console.getActiveMethods" and "console.getArgumentTypes" commands which have opened up a whole slew of commands I never knew existed.
  10. Inspired by a comment by CCG in another thread, I've decided to try and find a way to allow .cons to be written in python, similar to the way php files are used to generate html files. This idea relies on the assumption that the map .zips are reloaded on the server when the maps change, and also that they are not cached by the server process. (I'm not able to verify this right now, as the hard drive on my computer crashed a few days ago and I don't have access to a computer with/able to run 2142 to test this) I was thinking that it would have a .py file with the same name as its accompanying .con, with a syntax like php with the '<? ...php code... >' so that python and .con syntax can be intermixed, like so: ...normal con syntax.. beginrem python ...python code... if somevariable: endrem python ...normal con syntax which will only be executed if 'somevariable' is True... beginrem python else: <tab> print "...con syntax..." endrem python ...etc, etc Although of course it would be able to do more than just simple If/Else blocks, and could be written entirely as python if wanted. It would need a custom preprocessor, which shouldn't be all too hard to write with the help of python's built in 'compiler' module, then just have some basic template code which runs the file after it's been processed and place its output into the corresponding .con file. The program would also have to manage map changes, or somehow be able to detect them before the map .zips get loaded, so that it would be able to be dynamic. The limitations would be that the cons would have to be in the map folder, although I suppose that isn't all that bad. And also that it would only work for server-side changes to the .cons. (It wouldn't have to be limited to .cons of course, it could be done for any file in the map .zip) The big question here is are the map .zips actually reloaded when the maps change? (Can someone check if this will actually work? I'd do it but I need to find a new hard drive first :/) And also, would this actually be helpful to anyone or is it just a weird idea?
  11. Sorry if this is a little off topic, but how were you able to force the players rotations? I had been trying to do almost the exact same thing you have here a few months ago, but could never get the rotations down. Actually, I wasn't able to change rotations at all. I tried using playerObject.getDefaultVehicle().setRotation(), which I expected would at least change something, and "rcon exec object.rotation" on the object itself, which I didn't really expect to do anything visibly, and of course, it didn't. I was using the same format for the args of setRotation() as of setPosition() ( which did work fine ), should I have been using a different format for the args? Or is there something obvious I'm missing?
  12. BF2 uses a modified version of Python 2.3.4, so if you're running tests on python files outside of bf2 that you are planning to put into bf2 you should use this version. Also, the python library included with bf2, as you found out, doesn't include sqlite3 and as far as I know there is no way to add modules to standard bf2 python. I'm not sure how you've got your database set up, but you could try connecting to it manually using sockets. "ImportError: Don't know how to import sqlite3._sqlite3 (type code 3)" This is because 'dbapi2.py,' one of the files in sqlite3, tries to do this: "from _sqlite3 import *." '_sqlite3' I'm assuming corresponds with either a file '_sqlite3.lib' or '_sqlite3.pyd' which are both compiled c files, not python, and as such aren't able to be imported by bf2 python. Just for clarification, your problem has nothing at all to do with sqlite3 itself.
  13. The problem with the student versions is that they are 2010/2011, which I'm fairly sure don't support the current bf2 tools. Also, Autodesk offer's their software to students literally (dictionary definition, rather than figurative) free for download from their website: http://students.autodesk.com/ so you don't have to pay for the $130 box
  14. I would suggest saving their stats to a dictionary, then pickle (python module for serialization) the dictionary and save it to a file. At the end of each round you would 'un-pickle' the file you made previously, assign it to a variable, then for every stat you're tracking append that to the existing entry in the dictionary variable. Then of course you would pickle your new dictionary and overwrite the old file. This won't save the stats if a person leaves before the round ends though, so you would want to have it check periodically throughout the round and create a temporary dictionary in memory with the stats from that round and update it every check. Then, at the end of the round, instead of retrieving the stats directly from the player object, you would get them from your temporary dictionary.
  15. You could just change their projectiles to 'blank_Projectile' or some other non-damaging one, or for the thrown ones like unl_c4 which (i think) will crash because of that, change damage, mindamage, and explosiondamage to 0. Another way to do it would be to create a material which doesn't affect soldiers/vehicles and assign it to each of the weapon's projectiles. For static_av and the commander stuff you'll need to look in its .tweak file for its projectile, then modify that. edit: Any reason this is in effect editor?
×
×
  • Create New...