Knowing xyz coords

Making or wanting help making your own asset? Check in here
Post Reply
mft004
Posts: 33
Joined: 2017-12-14 17:37

Knowing xyz coords

Post by mft004 »

Hi,

I'm on the last stage of my SP arcade mod for FH2, that stage is going through all of the mod maps and repositioning / rotating vehicles so that the bots are more likely to use all of them (and use them effectively). It's gonna take ages if I plot an excel graph to guess the coordinates for new positions of vehicles, so is there a way to see the player's coordinates ingame? Then I could jot the perfect xyz down on a notepad and the whole job should be done in half the time. I don't know the python language but other similar topics on the internet suggested it was possible by adding lines of normal text to .py files; there wasn't a mention though as to the specific file to use or where in the file to put the text. I'd asked the regular guys on the FH2 forums but nobody was familiar with that part of the game. I think the guys who would know are all retired.

Any help is much appreciated!

Thanks,
Mark
AlonTavor
PR:BF2 Developer
Posts: 2991
Joined: 2009-08-10 18:58

Re: Knowing xyz coords

Post by AlonTavor »

Its time to learn Python.

Code: Select all

import host
import bf2

def onchat(playerId, text, channel, flags):
    if "getpos" in text:
        try:
            player = bf2.playerManager.getPlayerByIndex(playerId)
            msg = "pos: %s,%s,%s" % player.getVehicle().getPosition()
            host.rcon_invoke('echo "%s"' % msg)
        except:
            pass
host.registerHandler( 'ChatMessage', onchat, 1 )
put in __init__
mft004
Posts: 33
Joined: 2017-12-14 17:37

Re: Knowing xyz coords

Post by mft004 »

You've just saved me about a month of evenings. Many, many thanks AT.
Yep it may be that time, although I am a slow learner.
Post Reply

Return to “PR:BF2 Community Modding”