project reality header
Go Back   Project Reality Forums > PR:BF2 Mod Forums > PR:BF2 Community Modding
21 Sep 2024, 00:00:00 (PRT)
Register Developer Blogs Members List Search Quick Links
PR:BF2 Community Modding Making or wanting help making your own asset? Check in here

Reply
 
Thread Tools Display Modes
Old 2021-04-27, 11:33   #1
mft004

mft004's Avatar
Question Knowing xyz coords

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
mft004 is offline Reply With Quote
Old 2021-04-27, 13:07   #2
[R-DEV]​AlonTavor
PR:BF2 Developer
Supporting Member
PR Server License Administrator
Default Re: Knowing xyz coords

Its time to learn Python.

Code:
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__
AlonTavor is offline Reply With Quote
Old 2021-04-27, 15:03   #3
mft004

mft004's Avatar
Default Re: Knowing xyz coords

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.
mft004 is offline Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 03:09.