• Announcements

    • Detrux

      Site Relaunched   10/13/2016

      Welcome back to BFEditor.org! We've upgraded the forum software, removed the spammers, and improved security. Apologies for the downtime! Det
Sign in to follow this  
Followers 0
Uranium

Hind gunner crash!

15 posts in this topic

I'm trying to get the Hind from Special Forces to work with bots, but getting into the gunner seat, either by swapping from the pilot's seat or by getting into a Hind that a bot is flying results in a CTD. I've attempted to paste the Cobra's AI folder into the Hind's folder, as well as changing the ai.template lines in the Hind's tweak file to reference everything from the Cobra to the Apache to the Z10, all to no avail :cry:

What should I do?

PS: Is there any word on how to get the Euroforces vehicles into regular BF2 maps?

Share this post


Link to post
Share on other sites

That is most probably related to a missing AITemplate for a PCO inside the Hind. Browse the PCO code and look for 'ObjectTemplate.aiTemplate blabla'. Each PCO must have an aiTemplate. Each FireArm needs one, too. The PCO aiTemplate are found in the Objects.ai file, while the FireArm AI is located in the Weapons.ai.

Btw, its no problem to use another similar (already defined) AI Template, if the basic function is the same. So you could use the AITemplate for the AHE gunner for the Hind, too without coding a new one.

Share this post


Link to post
Share on other sites

Well see, that's the weird bit...the Hind has no AI files to speak of. I searched my entire hard drive and there are none. So it either has to do with the .tweak file or the .con file. Is there any way I can assign say, the Cobra AI to the Hind?

Share this post


Link to post
Share on other sites

It has no AI folder. The tweak folder has the following lines though relating to AI...

rem ---EndComp ---

ObjectTemplate.geometry xpak_hind

ObjectTemplate.setCollisionMesh xpak_hind

ObjectTemplate.mapMaterial 0 armor_body 31

ObjectTemplate.mapMaterial 1 armor_light 27

ObjectTemplate.mapMaterial 2 glass1 1006

ObjectTemplate.mapMaterial 3 wreck_col 60

ObjectTemplate.mapMaterial 4 cockpit 102

ObjectTemplate.mapMaterial 5 hind_envmap 22

ObjectTemplate.drag 2

ObjectTemplate.mass 10000

ObjectTemplate.floaterMod 0.8

ObjectTemplate.hasMobilePhysics 1

ObjectTemplate.hasCollisionPhysics 1

ObjectTemplate.physicsType Mesh

ObjectTemplate.aiTemplate Ahe_Ah1z

rem ---EndComp ---

ObjectTemplate.floaterMod 0

ObjectTemplate.hasMobilePhysics 1

ObjectTemplate.hasCollisionPhysics 1

ObjectTemplate.physicsType Mesh

ObjectTemplate.aiTemplate AHE_AH1Z_Gun

rem ---EndComp ---

ObjectTemplate.floaterMod 0

ObjectTemplate.hasMobilePhysics 1

ObjectTemplate.hasCollisionPhysics 1

ObjectTemplate.physicsType Mesh

ObjectTemplate.aiTemplate AHE_AH1Z_Rockets

Those are the only references. What do I do next?

Share this post


Link to post
Share on other sites

As i thought: It re-uses the AITemplates from the Apache... thats no problem if the AITemplates have the same function. Now make sure that every weapon and PCO inside the Hind really _have_ an AITemplate.

In contrary to most other properties , AI related files and names are CaSe SenSitIve. Extract the AI folder from the AHE and see what templates they provide. Re-use them on the Hind...

Start up a SP game with very few bots and enter the Hind. Switch through the PCO's. If you encounter the message 'You have entered a vehicle which is not prepared for AI' , you found the PCO lacking the AITemplate.

Share this post


Link to post
Share on other sites

Allright, I'm really unsure what to do now. I'm still getting crashes.

1) I don't mean to challenge your authority mschoeldgen, but I think the AHE refers to the Cobra from BF2, because the game refers to the Apache as xpak_apache.

2) I found it odd that the Hind had only 3 aitemplate entries, whereas the Apache had 4, so I added an extra to the Hind. Its .tweak file now looks like this

rem ---BeginComp:HelpHud ---

ObjectTemplate.createComponent HelpHud

ObjectTemplate.HelpHud.helpStringKey "HUD_HELP_VEHICLE_HELO_PASSENGER_CONTROLS_switchToGuidedMissiles"

ObjectTemplate.HelpHud.helpSoundKey "switchToGuidedMissiles"

rem ---EndComp ---

ObjectTemplate.floaterMod 0

ObjectTemplate.hasMobilePhysics 1

ObjectTemplate.aiTemplate Ahe_Ah1z_Gunner

The red line was previously missing. Should this line stay?

3) I'm not sure how to work with PCOs. All I know about them is that it stands for Play Controlled Object, how do I edit these, and what do they look like inside a file? Note: I'm not using the editor, I just edit the .tweak files for the vehicles using Notepad, is this sufficient?

4) I would just copy the AI folder over mschoeldgen, but the Hind nor the Apache have one...so should I just copy the AI folder in anyways, despite the fact that the entire thing references the Cobra?

5) What do you mean "switch between the PCOs?" The moment I hit F2 to go to the gunner's seat, the game crashes with a "You have tried to enter a vehicle that is not prepared for use with AI: xpak_hind_gunner" error. Everywhere I look however, there is no such folder in the vehicles folder, just an "xpak_hind" folder, with no mention of the gunner component.

Share this post


Link to post
Share on other sites

Never mind me exchanging a Cobra for an Apache, i'm not much of a heli specialist. (Except for the Flettner :D )

Found a solution to your problem on BFSP:

http://battlefieldsingleplayer.planetbattl...?showtopic=3333

It deals with your exact problem. They have a typo in one of the Gunners and the rocket is missing an AITemplate.

Edit: Ahh, i saw you were the last one to post over there.

Yes, by switching PCO's , i meant pressing F1,F2 and so forth to occupy the different positions in the heli. Obviously the F2 position (Copilot) didn't have a valid AITemplate. You can either add the (red) line you mentioned above or simply create a new Objects.ai file for the hind by copying the relevant parts from a heli that works. The Weapons.ai file carries the AITemplate for weapons, if necessary, create your own to, it isn't hard.

Share this post


Link to post
Share on other sites

Still not working :cry:

I kept the line that I put in red, and I copied the entire AI folder from the Cobra into the xpak_hind folder, and the game still crashes when I get into the gunner's seat.

Any ideas? When you said "relevant parts from a heli that works," should I have been more descriminating? I just copied both the weapons.ai and objects.ai files in their entirety, is there some part in there that is Cobra-specific that I should be deleting?

Share this post


Link to post
Share on other sites

Well , i read over there _both_ helis have this problem. Maybe its best to reuse the heligunner AI from a working one , like 'Ahe_Havoc_Gunner' and the Rocket AI from it : 'AHE_Havoc_Rockets'

The AHE_10Z seems to have some usable ones, too. Fire up your winrar and look for a good Template inside the 'Objects_Server.zip' of vanilla BF2 and type that into the Hind. I guess you know more about the heli characteristics than me :D (gee, we're a WW2 mod) Remember case-sensitivity of AI files . GL

Share this post


Link to post
Share on other sites

I'm really at a loss on this one. The Apache is actually quite fine, I can enter the gunner seat without a crash. As for the Hind however, I searched for "playercontrolobjects" within its .tweak file, and found two results: One for the pilot, one for the gunner. Both have AI templates, like the Apache. Thus, I see no reason why the Hind should crash the game. It's very hard to directly compare the two because there are a lot of places where the two choppers aren't the same. Same goes for the BF2 choppers.

Does the Hind NOT crash the game for anyone out there? If so, please post your code! Thanks!

Share this post


Link to post
Share on other sites

I am using a Hind, that I have had no problems with. I have flown with bots in the gunner seat with no crashes. I looked in my files and there is no AI file.

I didn't tweak this one, but simply borrowed the code for it.

The length of the code prohibits it from being posted.

Share this post


Link to post
Share on other sites

O.k., Uranium as a last resort, use the debugger EXE to finally get a meaningful error message. You have to use Harry's shader fixes (basically porting the old shaders from 1.12) like done in this thread :

http://bfeditor.org/forums/index.php?showtopic=4185

You're then able to run the bf2_r.exe without fatal crashes due to shader errors.

The debugger creates a detailed log file in <YOURMOD>/logs. Run the game, invoke the crash. Examine the logfile. What's it saying ?

Share this post


Link to post
Share on other sites

I had this exact problem and here is how I resolved it:

rem ---BeginComp:HelpHud ---

ObjectTemplate.createComponent HelpHud

ObjectTemplate.HelpHud.helpStringKey "HUD_HELP_VEHICLE_HELO_PASSENGER_CONTROLS_switchToGuidedMissiles"

ObjectTemplate.HelpHud.helpSoundKey "switchToGuidedMissiles"

rem ---EndComp ---

ObjectTemplate.floaterMod 0

ObjectTemplate.hasMobilePhysics 1

ObjectTemplate.aiTemplate Ahe_Z10_Gunner

rem -------------------------------------

ObjectTemplate.addTemplate S_xpak_hind_gunner_Ambient

ObjectTemplate.addTemplate S_xpak_hind_gunner_AmbientDamaged

ObjectTemplate.setPosition -0.00478927/-0.655937/5.07668

ObjectTemplate.setRotation -0.77777/0.533683/-3.56347e-008

ObjectTemplate.addTemplate xpak_hind_gunner_EP

ObjectTemplate.setPosition 0/-1.80148/3.73188

ObjectTemplate.addTemplate xpak_hind_RotCamera

ObjectTemplate.setPosition 0/-0.660806/4.93588

ObjectTemplate.addTemplate xpak_hind_missiles_tv

ObjectTemplate.setPosition 3.16629/-1.23041/-2e-005

ObjectTemplate.setRotation 0/15/0

ObjectTemplate.addTemplate xpak_hind_TVfireCam

ObjectTemplate.setPosition 3.1442/-1.23983/-0.01264

ObjectTemplate.setRotation 0/15/0

ObjectTemplate.addTemplate xpak_hind_RotationalBundle

ObjectTemplate.setPosition 0/-1.22373/5.24719

rem -------------------------------------

The line in red is what I added to the xpak_hind.tweak file located in Objects_server.zip

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0