Battlefield Modding Tutorials BFMODS

Battlefield Modding Tutorials
It is currently Thu Nov 23, 2017 7:10 am

All times are UTC




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
PostPosted: Sun May 14, 2006 6:44 am 
Offline

Joined: Fri Aug 20, 2004 12:00 am
Posts: 23
I am sure this question has already been asked in this forum however I just can't find an answer that works.

How do you find locations X/Y/Z in game so you can position new vehicles?

A previous post suggested a console command aiDebug.Draw 1 This does not work.

I would prefer not to have to use the editor to do it. Is there a console command like in BF1942 that simply puts your current location on the screen?


Top
 Profile Send private message E-mail  
 
 Post subject:
PostPosted: Sun May 14, 2006 9:44 am 
Offline

Joined: Fri Sep 17, 2004 12:00 am
Posts: 986
Location: 1.80m above the ground
I believe only debugger allows this:
renderer.drawFps 1
itll show the location besides fps (normal game only shows fps)

regular game only supports a few commands, so its pretty hard to find it there w/o use of python (if you do use python, find the location of the palyerobjects' vehicle and use game.sayAll via host.rcon_invoke to print position)

_________________
Time to use the debugger


Top
 Profile Send private message E-mail  
 
 Post subject:
PostPosted: Sun May 14, 2006 5:58 pm 
Offline

Joined: Mon Aug 16, 2004 12:00 am
Posts: 2120
You could go through the hassle of downloading the BF2 Editor, then copying the maps to get them to copy in it. Then find the numbers that way, but that might be a bit of work. Although the Editor does include a (outdated) debugger, but I believe it still works.


Top
 Profile  
 
PostPosted: Thu Feb 21, 2008 2:53 pm 
Offline

Joined: Thu Feb 21, 2008 2:25 pm
Posts: 2
I've used this method for accuracy, and to keep from walking around in levels or using the ****ing POS editor. Once you've got an image of a map area done it's pretty easy to get a whole load of coordinates from it.

  • Note down coord locations of flags/vehicles around where you want to make changes from GamePlayObjects.con
  • Fly up to over 500ft and eject directly over the area you're going to be working on.
  • Hit chute, look down, take some screen shots (preferably while facing north).
  • Open photoshop + make a new image 10,000x10,000 pixels (greyscale to keep the size down).
  • Maximum map space is 2048 wide/high going from -1023 to 1023 (with 3 decimal points for precision), so you're going to be working on 1/4 of the map. Ignore the -ve signs from the .con file, and shift the decimal points to the right to get more accuracy on your image. Put markers (something like boxes with the same corner on the coord. is best for accuracy/visibility) in the image for existing flags/vehicle spawns (at least 3 widely spaced ones needed).
  • Flip the image horizontally/vertically to make up for ignoring -ve signs from .con coords.
  • Label your markers
  • Paste your best screenshot into a new layer and set it's opacity to around 75%
  • Use free transform to move/scale the screenshot image so the flags/vehicles line up with the markers in the other layer (try not to skew the image, just use rotate and proportional scale). Use the most widely spaced ones for accuracy.
  • Read off the coordinates from photoshop's info tab where you want to put things (make sure measurements are in pixels not inches or cms), shift the decimal point along to the left, add -ve to the x or y if you flipped the image, and note them down.
  • Change the coords. in the .con

If you want to expand the area covered you'll need to take more screenshots.


Top
 Profile Send private message E-mail  
 
PostPosted: Fri May 09, 2008 4:33 am 
Offline

Joined: Thu Feb 21, 2008 2:25 pm
Posts: 2
Install modmanager, put this in your '[bf2server]/admin/modules' folder, enable it in [bf2server]/mods/bf2/settings/modmanager.con, then run the server and join it with a client game. It'll display your position and rotation about the z (up) axis, exactly as used by the game (with 3 decimal points, and rotation based on -180 to 180 degrees from north).

Remember to turn it off when you've finished, as it isn't designed to run in a normal game, and will probably cause some errors if left running.

Code:

"""mm_ppos.py

Print Position module.

===== About =====
This ModManager script displays your current player object's position, and the direction you're facing.
 
Run it in a solo testing server to find map positions that may be used for server side modding.

You will have to subtract 0.9 from the height axis to have objects touch the ground.

Running it on a public populated server will display the positions for all players.

===== History =====

 v1.0 - 20080503:
 Initial public version

By polarity.
Available from flightschool.polar-lights.org.uk
You're free to use and modify this script
"""

import bf2
import host
import mm_utils
from bf2.stats.constants import *

# Set the version of your module here
__version__ = 1.0

# Set the required module versions here
__required_modules__ = {
   'modmanager': 1.0
}

# Does this module support reload ( are all its reference closed on shutdown? )
__supports_reload__ = True

# Set the description of your module here
__description__ = "VehicleClassOnly v%s" % __version__

updateTimer = None
 
class PlayerPos( object ):

   def __init__( self, modManager ):

      self.mm = modManager
      self.__state = 0
      
   def onPlayerSpawn(self, player, body ):
      if 1 != self.__state:
         return 0
      if (not player.isAIPlayer()):
         updateTimer = bf2.Timer( self.onUpdate, 1, 1 )
         updateTimer.setRecurring(2)

   def StopTimer( self ):
      if 1 != self.__state:
         return 0
      if updateTimer:
         updateTimer.destroy()
         updateTimer = None

   def onUpdate( self, data ):
      if 1 != self.__state:
         return 0
      #mm_utils.msg_server( "timer event called" )
      for player in bf2.playerManager.getPlayers():
         if not player.isAIPlayer():
            vehicle = player.getVehicle()
            try:
               playerPos = vehicle.getPosition()
               playerRot = vehicle.getRotation()
               mm_utils.msg_player( player.index, "You are at: %.3f / %.3f / %.3f.  Looking %.1f degrees from North." % (playerPos[0], playerPos[1], playerPos[2], playerRot[0] ) )
               #mm_utils.msg_player( player.index, "--------------------------" )
            except:
               mm_utils.msg_player( player.index, "failed to find soldier object's position" )

   def init( self ):
      if 0 == self.__state:
         host.registerHandler( 'PlayerSpawn', self.onPlayerSpawn, 1 )
      # Update to the running state
      self.__state = 1
      updateTimer = None

   def shutdown( self ):
      """Shutdown and stop processing."""

      # Unregister game handlers and do any other
      # other actions to ensure your module no longer affects
      # the game in anyway
      
      #stop the timer
      self.StopTimer()
      # Flag as shutdown as there is currently way to:
      # host.unregisterHandler
      self.__state = 2

   def update( self ):
      """Process and update.
      Note: This is called VERY often processing in here should
      be kept to an absolute minimum.
      """
      pass


def mm_load( modManager ):
   """Creates and returns your object."""
   return PlayerPos( modManager )




Top
 Profile Send private message E-mail  
 
PostPosted: Thu Oct 08, 2009 5:01 am 
Offline

Joined: Thu Sep 03, 2009 1:04 am
Posts: 2
isn't there a command like the one from bf1942demo:

console.showstats 1

?


Top
 Profile Send private message E-mail  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
Powered by phpBB® Forum Software © phpBB Group