In Battlefield 2 HUD when you shoot someone it tells you with what weapon you shot him with and whom you shot on the top left corner of the screen. Now in P.R. you only see when you Team Kill someone. Is there any way that It can be turned on so it shows it weather you kill a friendly or a foe? I tried looking through the pr/menu/menu_server.zip, but can't figure out "if it is located there" what the file is called, or is it something in pr/python folder that has to be changed.
I know how to edit python files, but can't find it there either, Basically don't know what the string is called, or where to look for it.
Thanks for help in advance.
[Help] Battlefield 2 HUD
-
Jordanb716
- Posts: 186
- Joined: 2008-04-10 22:58
Re: Battlefield 2 HUD
This is done on purpose so you have to visually confirm your kills and if you try to change it I'm pretty sure PB will kick you right out of any server you try to join. unless you want it just for coop in which case I cant help ya.
Colonelcool: I'd gladly pony up some tax dollars to send a JDAM over there just to kill that rooster.
OkitaMakoto: Talking squad level tactics in bed is actually a little known aphrodisiac.
Jigsaw: saying "lock please" accomplishes just about the square root of fuck all
OkitaMakoto: Talking squad level tactics in bed is actually a little known aphrodisiac.
Jigsaw: saying "lock please" accomplishes just about the square root of fuck all
-
clondicke
- Posts: 64
- Joined: 2010-06-19 09:04
Re: Battlefield 2 HUD
Yep I'm just trying to change it for coop, not for multiplayer. I have my mods/pr folder for multiplayer which stays unchanged and I have mods/pr_custom which I change around and use for coop only.Jordanb716 wrote:This is done on purpose so you have to visually confirm your kills and if you try to change it I'm pretty sure PB will kick you right out of any server you try to join. unless you want it just for coop in which case I cant help ya.
-
clondicke
- Posts: 64
- Joined: 2010-06-19 09:04
Re: Battlefield 2 HUD
Dang I tried that and added the default BF2 Localization String and got that error message. Unfourtionally I don't know how to edit .exe files, so that sux ***. Dang It.Vaiper wrote:You have to edit localization files (pr.utxt), for example if you wanna see name what kill you, need to change this line: HUD_CHAT_YOUWEREKILLEDBY.
However if you do this, you will be no able to start pr, it will tell what "unallowed modification detected, plese reinstall pr" or somethink like what, so unless you managed to hack pr.exe, there probably is no other way...
Ps: if you will found a way, tell me, i wanna to do what for "coop" only too![]()
-
clondicke
- Posts: 64
- Joined: 2010-06-19 09:04
Re: Battlefield 2 HUD
So is there a way to bypass that and still make it possible to work. I have built some small programs in the past and know how to work a bit with Visual Basic 6.
-
Hjid
- Posts: 75
- Joined: 2009-04-28 18:35
Re: Battlefield 2 HUD
You could always do it with python since it is on your local server anyway. 
Copypaste this code into notepad and save it as confirmedKills.py in your mods\customPRname\python\game\ folder.
(Make sure to change the filetype from txt to all)
Then add these two lines in the __init__.py in the same folder (notepad again)
Copypaste this code into notepad and save it as confirmedKills.py in your mods\customPRname\python\game\ folder.
(Make sure to change the filetype from txt to all)
Code: Select all
#****************************************************************#
# Auto Confirm Kill Script #
# Prints attacker/weapon/victim on the top left of the screen. #
#****************************************************************#
# If 1, the script will only print kills if a human player is the attacker/victim.
HUMANONLY = 1
# The string that will be printed, where $ATTACKER$ will be replaced by the attackers name, etc.
KILLSTRING = "\xc2\xa7c1001$ATTACKER$\xc2\xa7c1001 killed \xc2\xa7c1001$VICTIM$\xc2\xa7c1001, \xc2\xa7c1001[$WEAPON$]\xc2\xa7c1001"
import bf2
import host
def init():
host.registerGameStatusHandler(gameStatusChanged)
def gameStatusChanged(status):
if status == bf2.GameStatus.Playing:
host.registerHandler('PlayerKilled', playerKilled)
def playerKilled(victim, attacker, weapon, assists, object):
if victim.getTeam() != attacker.getTeam():
if attacker.isAIPlayer() == True and HUMANONLY == 1 and victim.isAIPlayer() == True:
return
else:
text = KILLSTRING
text = text.replace("$ATTACKER$",attacker.getName())
text = text.replace("$VICTIM$",victim.getName())
text = text.replace("$WEAPON$",weapon.templateName)
host.sgl_sendTextMessage(0, 12, 1, text, 0)Code: Select all
import confirmedKills
confirmedKills.init()-
clondicke
- Posts: 64
- Joined: 2010-06-19 09:04
Re: Battlefield 2 HUD
That worked awesome. But is there a way to make it use the hudName within the template for the weapon. Not using the template name.
-
Hjid
- Posts: 75
- Joined: 2009-04-28 18:35
Re: Battlefield 2 HUD
The easiest way would be to just remove the usrif_, mecrif_, etc in the template string. Like this:
I'm not sure if the PR weapons actually have a hudname.
Code: Select all
def playerKilled(victim, attacker, weapon, assists, object):
if victim.getTeam() != attacker.getTeam():
if attacker.isAIPlayer() == True and HUMANONLY == 1 and victim.isAIPlayer() == True:
return
else:
if weapon.templateName.find("_") == -1:
weaponTemplate = weapon.templateName
else:
weaponTemplate = weapon.templateName.replace(weapon.templateName[:weapon.templateName.find("_")+1],"")
text = KILLSTRING
text = text.replace("$ATTACKER$",attacker.getName())
text = text.replace("$VICTIM$",victim.getName())
text = text.replace("$WEAPON$",weaponTemplate)
host.sgl_sendTextMessage(0, 12, 1, text, 0)-
clondicke
- Posts: 64
- Joined: 2010-06-19 09:04
Re: Battlefield 2 HUD
Well they don't have HUD names, they all say killed, but since I am modding this for coop play only, I rename the HUD names to their appropriate weapon name.
-
Hjid
- Posts: 75
- Joined: 2009-04-28 18:35
Re: Battlefield 2 HUD
I think you are better of making a list in the python script, because I don't think it is possible for python to get the hudnames.
Just add the names in the Templatelist. (Notice the commas! No comma for the last template in the list)
Code: Select all
#****************************************************************#
# Auto Confirm Kill Script. #
# Prints [attacker-weapon-victim] on the top left of the screen. #
#****************************************************************#
# If 1, the script will only print kills if a human player is the attacker/victim.
HUMANONLY = 1
# The string that will be printed, where $ATTACKER$ will be replaced by the attackers name, etc.
KILLSTRING = "\xc2\xa7c1001$ATTACKER$\xc2\xa7c1001 killed \xc2\xa7c1001$VICTIM$\xc2\xa7c1001, \xc2\xa7c1001[$WEAPON$]\xc2\xa7c1001"
TEMPLATELIST = {
"meclmg_mg3elcandeployed": "MG3",
"insrg_svdwood_irondeployed": "SVD",
"uslmg_m249acog": "M249",
"usrif_m14acog": "M14",
"chlmg_qbb95scope": "QBB95"
}
import bf2
import host
def init():
host.registerGameStatusHandler(gameStatusChanged)
def gameStatusChanged(status):
if status == bf2.GameStatus.Playing:
host.registerHandler('PlayerKilled', playerKilled)
def playerKilled(victim, attacker, weapon, assists, object):
if victim.getTeam() != attacker.getTeam():
if attacker.isAIPlayer() == True and HUMANONLY == 1 and victim.isAIPlayer() == True:
return
else:
if TEMPLATELIST.get(weapon.templateName) == None:
if weapon.templateName.find("_") == -1:
weaponTemplate = weapon.templateName
else:
weaponTemplate = weapon.templateName.replace(weapon.templateName[:weapon.templateName.find("_")+1],"")
else:
weaponTemplate = TEMPLATELIST.get(weapon.templateName)
text = KILLSTRING
text = text.replace("$ATTACKER$",attacker.getName())
text = text.replace("$VICTIM$",victim.getName())
text = text.replace("$WEAPON$",weaponTemplate)
host.sgl_sendTextMessage(0, 12, 1, text, 0)
Last edited by Hjid on 2010-12-29 03:41, edited 1 time in total.
Reason: Further explanation
Reason: Further explanation
