project reality header
Go Back   Project Reality Forums > PR:BF2 Mod Forums > PR:BF2 Community Modding
PR Time:
Register Forum RulesDeveloper 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

Contact Support Team Frequently Asked Questions Register today!

Reply
 
LinkBack Thread Tools Display Modes
Old 02-18-2010, 07:37 AM   #1
Reel Liddy
Cool [?] How to Remove Vehicles?

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
""")
**************
Reel Liddy is offline
Last edited by Reel Liddy; 02-19-2010 at 10:47 AM.. Reason: Added code tags to conform to forum protocol.
Reply With Quote
Old 02-18-2010, 08:11 AM   #2
[R-DEV]AfterDune
PR Developer
Supporting Member
PR Server License Administrator

[R-DEV]AfterDune's Avatar
Default Re: How to Remove Vehicles?

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.
[R-DEV]AfterDune is online now Reply With Quote
Old 02-18-2010, 09:27 AM   #3
Reel Liddy
Default Re: How to Remove Vehicles?

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.
Reel Liddy is offline Reply With Quote
Old 02-18-2010, 11:08 AM   #4
[R-DEV]AfterDune
PR Developer
Supporting Member
PR Server License Administrator

[R-DEV]AfterDune's Avatar
Default Re: How to Remove Vehicles?

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.
[R-DEV]AfterDune is online now Reply With Quote
Old 02-19-2010, 08:07 AM   #5
Reel Liddy
Default Re: How to Remove Vehicles?

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
Reel Liddy is offline
Last edited by Reel Liddy; 02-19-2010 at 08:25 AM..
Reply With Quote
Old 02-19-2010, 09:38 AM   #6
[R-DEV]Amok@ndy
PR:BF2 Developer
PR Server License Moderator

[R-DEV]Amok@ndy's Avatar
Default Re: How to Remove Vehicles?

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.

[R-DEV]Amok@ndy is offline Reply With Quote
Old 02-19-2010, 10:46 AM   #7
Reel Liddy
Default Re: How to Remove Vehicles?

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


Tags
remove, vehicles
Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 05:18 PM.


Powered by: vBulletin. ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO.
All Content Copyright ©2004 - 2012, Project Reality.