|
PR Time:
|
||||||
| Register | Forum Rules | Developer Blogs | Project Reality | Members List | Search | Today's Posts | Mark Forums Read |
| PR:BF2 Community Modding Making or wanting help making your own asset? Check in here |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 |
![]() Join Date: Feb 2010
Posts: 4
|
I'm sure this will be an easy question for you Python heads to answer... I want to play PR Single, in Coop mode, or run server, and remove ALL JETS from ALL MAPS. A kind fellow helped me do this in BF2, with a little script he wrote called vehicle.py (I will paste the whole thing below after this question.
Basically all I want to do is prevent all Jets from spawning when I start up PR. I vaguely understand how the script vehicle.py works when I run it for BF2, but I can't see how it would work in PR, which seems to initialize the vehicles differently. Here is how Jets (and also Arty in this case) can be removed from BF2, from the original fellow who sent me the material: "Move both of these files, __init__.py and vehicle.py, to Battlefield 2\mods\bf2\python\game\gamemodes (overwrite the init.py, it's empty anyway)....To remove the changes (just in case), delete the two lines inside the __init__.py and restart the server." The new __init__.py now contains these two lines (but no asterisks): *************** Code:
import vehicle vehicle.init() And the script, vehicle.py, contains the following: **************** Code:
import host
import bf2
APCS=("usapc_lav25","apc_btr90","apc_wz551")
TANKS=("ustnk_m1a2","rutnk_t90","tnk_type98")
MOBILEAA=("usaav_m6","aav_tunguska","aav_type95")
JEEPS=("jeep_faav","usjep_hmmwv","jep_paratrooper","jep_mec_paratrooper","jep_vodnik","jep_nanjing")
BOATS=("at_rib")
STATAA=("usaas_stinger","igla_djigit")
STATAT=("ats_tow","ats_hj8")
BIPODS=("mec_bipod","us_bipod","ch_bipod")
WASP=("wasp_defence_front","wasp_defence_back")
JETS=("usair_f18","ruair_mig29","air_j10","usair_f15","ruair_su34","air_su30mkk","air_f35")
HELICOPTERS=("usthe_uh60","the_mi17","chthe_z8","ahe_ah1z","ahe_havoc","ahe_z10")
ARTY=("usart_lw155","ars_d30")
def init():
host.registerGameStatusHandler(onGameStatusChanged)
def onGameStatusChanged(status):
print status
if status == 1:
remover(JETS+ARTY)
####### to remove APCs instead of jets, use remover(APCS) instead of remover(JETS) above
####### to remove both APCs and jets, use remover(JETS+APCS)
####### to remove APCS, jets and arty, blahblahblah
def remover(vehicletype):
cp = bf2.objectManager.getObjectsOfType('dice.hfe.world.ObjectTemplate.ObjectSpawner')
for spawner in cp:
spawnerName = spawner.templateName
vehicle = host.rcon_invoke("""
objecttemplate.active %s
objecttemplate.objecttemplate
""" % spawnerName)
for obj in vehicletype:
if vehicle.lower().find(obj)!=-1:
print spawnerName
print vehicle
host.rcon_invoke("""
objecttemplate.nrofobjecttospawn 0
""")
|
|
|
Last edited by Reel Liddy; 02-19-2010 at 10:47 AM..
Reason: Added code tags to conform to forum protocol.
|
|
|
#2 |
|
PR Developer
![]() |
Put it in code tags, son. If people copy/paste this, they will crash hardzorz.
And you're not using the PR vehicle names in your script. |
|
To view links or images in signatures your post count must be 1 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 1 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 1 or greater. You currently have 0 posts. |
|
|
|
|
|
|
#3 |
![]() Join Date: Feb 2010
Posts: 4
|
What are code tags? Tell me how to paste this sort of thing safely and I'll edit my original post to remove the hazard.
Otherwise, the PR vehicle names do not appear because, as I explained, this is a script to be used in BF2, not PR. I gave it as an example of how it is done in BF2 in the hopes that a Python-able person would immediately see what I was talking about. |
|
|
|
|
|
#4 |
|
PR Developer
![]() |
Code tags:
[ code] paste your code here [/ code] (remove the spaces in code-tags) |
|
To view links or images in signatures your post count must be 1 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 1 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 1 or greater. You currently have 0 posts. |
|
|
|
|
|
|
#5 |
![]() Join Date: Feb 2010
Posts: 4
|
There, I've put proper code tags in my original post. No replies yet -- is removing vehicles with scripts more difficult in PR than in BF2? Perhaps I'm in the wrong subforum? I'm going to ask this question again in the PRSP subforum, if it's answered there I'll delete this thread
|
|
|
Last edited by Reel Liddy; 02-19-2010 at 08:25 AM..
|
|
|
|
|
|
|
|
|
#6 |
|
PR:BF2 Developer
![]() |
did you even tried putting in all the pr vehicles ?
|
|
To view links or images in signatures your post count must be 1 or greater. You currently have 0 posts. |
|
|
|
|
|
|
#7 |
![]() Join Date: Feb 2010
Posts: 4
|
I have found the answer! I have discovered the modding tutorials and it turns out to be very easy to remove assets; all you have to do is comment out the relevant lines in the GamePlayObjects.con file.
Admins, please feel free to delete this thread if you like. |
|
|
|
|
|
|
|
|
|
![]() |
| Tags |
| remove, vehicles |
| Thread Tools | |
| Display Modes | |
|
|