Jump to content
Official BF Editor Forums
Sign in to follow this  
Al B. Bach

Question On Objecttemplates

Recommended Posts

I have a multiple questions. I am curious as to the usage of some template lines what the effect and their application use.

First, I'm rebuilding my helos. I have borrowed code from other vehicles. In this example I am changing the Cobra by adding Sidewinders. The code came from the F15. I have changed it to meet my needs and polished some of the workings to fit my mod. Nothing special.

Here is my first question:

In the weapon hud. I am using the sidewinders as a secondary missile, so it is set up on its own merit. This is the code for the hud. My questions relate to the lines in bold.

rem ---BeginComp:WeaponHud ---
ObjectTemplate.createComponent WeaponHud
ObjectTemplate.weaponHud.weaponIcon Ingame\Weapons\Icons\Hud\bomb.tga
ObjectTemplate.weaponHud.selectIcon Ingame\Weapons\Icons\Hud\Selection\sidewinder_missile.tga
ObjectTemplate.weaponHud.hudName "AIM-9M SIDEWINDER"
[b]ObjectTemplate.weaponHud.guiIndex 3[/b]
ObjectTemplate.weaponHud.hasFireRate 0
ObjectTemplate.weaponHud.showClips 1
ObjectTemplate.weaponHud.addShowOnCamMode 2
[b]ObjectTemplate.weaponHud.displaySelectOnActivation 1[/b]
ObjectTemplate.weaponHud.firstLockSound HUD_Air_to_Air_Heatseeker_Track
ObjectTemplate.weaponHud.secondLockSound HUD_Air_to_Air_Heatseeker_Lock
rem ---EndComp ---

The first is really just which hud is displayed in camera. In this case the '3' is the F15 hud. Since I am utilizing the Cobras I changed this to '24' in order avoid a conflict and keep the hud matched to the pilots normal hud when the pilot shoots his main missile. Now this leads to the real question. In the next bold line, you will note that the displaySelect is ON. What is the purpose of this line and what would be the proper application of its use. I am going to assume that it has to do with the 'F' key select or weapons select. In the F15, as you know, that will toggle the weapon hud between huds for air to air and bombs. Is this it's use and application? To futher the question, since the missiles are secondary and setup with PIAltFire, is this line even needed? I would think no, but left it in. Also leaving it in, would that cause a conflict down the road?

This leads me to the next dual fold question:

rem ---BeginComp:MultiFireComp ---
ObjectTemplate.createComponent MultiFireComp
[b]ObjectTemplate.fire.roundsPerMinute 80[/b]
ObjectTemplate.fire.fireInput PIAltFire
[b]ObjectTemplate.fire.addFireRate 0[/b]
[b]ObjectTemplate.fire.useDummyProjectiles 1[/b]
ObjectTemplate.fire.addBarrelName aim9m_sidewinderdummy
rem ---EndComp ---

In this grouping most is pretty obvious.... but I was wondering.

Why would there be a line that specifies a fire rate and then another one that either includes or turns it off. Specifically these lines:

ObjectTemplate.fire.roundsPerMinute 80

ObjectTemplate.fire.addFireRate 0

Of course the first says this is the rate of fire '80' RPM

The next turns it off or on. Now in the case I assume that being 'off' turns off the 80 RPM and it goes to the default setting of a 120 RPM of the Sidewinder missile tweak. Is that correct, or am I thinking backward? If I turn it on by placing a 1 does it use the selected rate of 80? Why have both?

The line ObjectTemplate.fire.fireInput PIAltFire is to show the Sidewinder as the secondary missile in the Pilots hud and to control with the second mouse button... this leads/points to the next questions later on Projectiles and possible relation with indexing.

Lastly in this code is the use of dummyprojectiles. Why When and Where would you use them? For what purpose do they serve?

In this code:

rem -------------------------------------
ObjectTemplate.projectileTemplate aim9m_sidewinder
[b]ObjectTemplate.keepProjectiles 5[/b]
ObjectTemplate.velocity 100
[b]ObjectTemplate.itemIndex 2[/b]

This is some what a mystery to me in the use of how it plays in this application. In the first, what is the purpose of the 'keepProjectiles' I ask because when I was test the helo I noticed the as I fired the missile they would not lift off the mounting rack. They would fire and seek target, but not launch. They remained mounted to the helo. I 'rem'ed the line and then they worked normal like they do on the F15. I put the line back in thinking "AHH-HAH" let's double check, but then they still worked normal in the launch routine. It was a puzzled moment. Now I have no idea as to why they did not shoot of the rack and now they do (which is what I wanted), no matter how I set that line up. Crux is... what is the use of that line?

The next line has to do with the indexing. I can see how it works in the weapons, as far as which key that item is indexed, such as knife to '1' and pistol to '2' and rifle to '3'3 and so forth, but here.... I assume it has to do with the weapon placement per vehicle and passenger placement. Normally it would be '1', but in this case I followed how it was set up for the copilot/gunner. If you look at the Cobras gunners templates you will note that the main gun is indexed to '1' and the TV missiles are set to '2'. I felt that I should do this since the main missile for the pilot are set to '1', therefore the sidewinder secondary missile should be set to '2' especially since the setting for them is ObjectTemplate.fire.fireInput PIAltFire. Is this flawed thinking or am I correct in this thought?

I realize that this is a lot of questions and a lot of ground to cover. I appreciate any help in giving me insight and understanding on this. I wish to thank advance for your help and patience and time in explaining what I ask, I know it can be time consuming.

Edited by Al B. Bach

Share this post


Link to post
Share on other sites

guiIndex is an integer you choose which links into the hud layer. for vanilla bf2, see GUIIndex.txt in the menu code for documentation as to what numbers maps to what hud. the hud code changes based on the hud variable 'GuiIndex'.

displaySelectOnActivation pops up the weapon selection menu (in the bottom left) even if you select the weapon directly with the numeral keys.

addFireRate allows a firearm to have switchable fire rates. i believe 0 is full auto, 1 is burst, 2 is semi-auto. not sure if this works on non-handweapons.

dummy projectiles are models which are attached to the firearm, and who are deleted as you fire the weapon. they reappear when you reload. they are purely for aesthetics.

i believe keepProjectiles is how long in seconds the projectiles last in the world (irrespective of the projectile's timetolive!) after the firer dies. maxProjectilesInWorld is a related setting, this is the absolute maximum number of projectiles that one player can produce at a time (even if they're continually reloading).

itemIndex serves the same purpose in vehicles as it does for handweapons: it is what numeral key you must press to switch to the weapon. it must be unique for each PCO, and if you want to mix selected and non-selected firearms in a single PCO the non-selected ones must have isselectable set to zero (we do this in fh2 to have selectable rounds on the main guns of tanks, but a non-selectable coaxial mg).

for firearm inputs, they also must be unique for any PCO's weapon. I believe clashes cause both weapons to never fire. there is a way of getting around this (see bf2's m2 ammobox), but it has bugs (the secondary firearm fires at about 75% of the rate of the primary). this behaviour in the whole is awful, BF42 was must more useful (clashes caused both weapons to fire together).

Edited by [FH]ctz

Share this post


Link to post
Share on other sites
displaySelectOnActivation pops up the weapon selection menu (in the bottom left) even if you select the weapon directly with the numeral keys.

dummy projectiles are models which are attached to the firearm, and who are deleted as you fire the weapon. they reappear when you reload. they are purely for aesthetics.

itemIndex serves the same purpose in vehicles as it does for handweapons: it is what numeral key you must press to switch to the weapon. it must be unique for each PCO, and if you want to mix selected and non-selected firearms in a single PCO the non-selected ones must have isselectable set to zero (we do this in fh2 to have selectable rounds on the main guns of tanks, but a non-selectable coaxial mg).

[FH]ctz,

Thank you for your response. It was most helpful.

I have excluded a portion of your quote response to stay focused on further questions for more clarification.

displaySelectOnActivation pops up the weapon selection menu (in the bottom left) even if you select the weapon directly with the numeral keys.

I'm still not following what you mean. In the application of this line that I am using, it is within the weapon hud. Since I took the sidewinders from the F-15 I had assumed that this brought/activated up the change for the GUI hud display between the bombs or the air to air missiles. In my case, I placed the sidewinders on a helo so that the Hydras are 1 and Sidewinders are 2. I see in the F-15 by pressing 1 or 2 this cycles the weapon as well as the hud... so does the 'F' key, but this is not the case with the helo (remember I changed the gui from 3 to 24). If what I think you are saying this only affects the weapon only and not the hud. I'm further confused by the reference (in the bottom left). I have nothing in the bottom left other than passenger placement and vehicle health. My weapon load out is on the right and since I utilized PIAlt, both are displayed simultaniously in the main hud with the amount of missiles left in reserve because the 'show clips' is active. At no time does a weapon select show in the helo (probably because there is no dds file referenced), which is normaly on the right side for me. With this being case and both weapon load outs showing respectivly, would it be better to set the display to '0' in relation to what you say about itemindex or even just simply remove the line? Also, since I press the numeric key that the weapon is assigned (IE: Hydro 70 = 1 and aim9 = 2), it has no effect in this case, is this due to the use of the PIAlt?

dummy projectiles are models which are attached to the firearm, and who are deleted as you fire the weapon. they reappear when you reload. they are purely for aesthetics.

Just a clarification please.... If I understand correctly you are saying that as long as this line is added to the multifire, then I should see the weapon fire in camera view, leave the rail and the respawn.... provided it is turned on (1). If it is off or "rem'ed" out, then I would still see the weapon fire, NOT leave the rail and never give the visual of ever left the rail, even though it has. Respawn effect would be null because it is always there.

itemIndex serves the same purpose in vehicles as it does for handweapons: it is what numeral key you must press to switch to the weapon. it must be unique for each PCO, and if you want to mix selected and non-selected firearms in a single PCOis selectable the non-selected ones must have is selectable set to zero (we do this in fh2 to have selectable rounds on the main guns of tanks, but a non-selectable coaxial mg).

Ok, this is very interesting. Please forgive my ignorance. I understand what you mean as far as the selection of weapons. I've utilized the indexitem in most of my handheld weapons. I can see the importance of maintaining seperate index's for weapons, especially in my case with the display of two missile systems on the main hud. I assume then I was correct in having them as 1 and 2 with the PIAlt line added. What would be the case if both were indexed to 1? When I did it originally, it only showed one weapon (although I never tried the 'F' key to see if they would switch. I sorta doubt they would being nonindexed). Now I plead my ignorance.... please explain PCO. You have lost me there.

Again I thank you for your time and effort, you help not only me... but I'm sure others that read this thread.

Tip o' the hat!

Share this post


Link to post
Share on other sites

Some basic rules

Left click/input fire

Right click/input alt fire

For alt fire weapon huds to show,left click weapons need have -1 as gui

To enable weapon icons working with scroll

Look for this line at the top of a weapon/vehicle tweak file

ObjectTemplate.vehicleHud.useSelectionIcons 0

Change 0 to 1 or delete line of code as found in all jets and transport choppers

Thankyou to Clivewil for ^^

If more than 1 weapon share the same item index #,only the last one loaded in the tweak file will show with scroll,but all icons will show via f key,but still only 1 weapon will fire

i believe 0 is full auto, 1 is burst, 2 is semi-auto. not sure if this works on non-handweapons.

fire rate 0/ 1 round

fire rate 1/ 3 rounds

fire rate 2/full auto with mouse button pressed

Burst size/1 click = amount after burst size

burst size 15/1 click 15 rounds

Edited by DEVILMAN

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...