[CSM] Custom Crosshairs/HUDs without using meshes on PCOs...

If you know something thats not in here please share it

Custom Crosshairs/HUDs without using meshes on PCOs...

Postby Apache Thunder » Sat Mar 30, 2013 4:14 am

I just today finally figured it out. There is an unused command in BF1942 that can define a custom crosshair on handweapons:

Code: Select all
ObjectTemplate.crossHairIcon "Example.tga"


This command is set up to work with FireArms, Handweapons, and PlayerControlObjects.

While it functions correctly for soldier handweapons, it does not work on PlayerControlObjects or FireArms, thus vehicles can't seem to use it. That is until I did this tweak to the meme file for the ingame HUD. :D

Image
(note the use of the CullNode, what I put in there tells the game whether or not the player is in a vehicle. If you fail to include this, the crosshair will be visible all the time no matter where you are or in. So don't forget that! :D)

When used in that combination it enables the command to work on vehicles. (add the command to the main PCO, NOT the the firearm object(s) used on the PCO, or else it won't work)

The the new transform node I created could also be altered to instead allow full screen HUDs for vehicles instead of a crosshair. Just change the size of the transform node to 800x600 and use a TGA file matching that size. (then if you still want to use a custom crosshair on some vehicles while keeping a fullscreen HUD on others, then you can create a crosshair texture with the small crosshair in the center of the image. But the tga resolution must remain at 800x600. Resizing it will only alter the detail of the texture that fills the screen since the transform node is what defines how much screenspace a image takes up)

The only drawbacks to using this is that once enabled in the hud, you have to add this to any vehicle that you decide not to use a custom crosshair on (that includes passenger positions):

Code: Select all
ObjectTemplate.crossHairIcon "Empty.tga"


Thus this command must be added to ALL enter-able PCOs used in the mod or else vehicles that are supposed to have no crosshair will end up using the default crosshair since that's the default behavior of the command.

Also, the custom crosshair added via this method (or HUD depending on how you want to use it), will not vanish if you change camera views on the vehicle. For example, you use C key to switch to nose cam or flyby. The custom crosshair will remain on the screen. I may perhaps find away to use a CullNode to fix this, but I would have to determin how the game knows when a soldier is using a external camera view. (since on soldiers when switching camera views, the crosshair vanishes properly)

If I manage to refine this further, I will post updates on it. :D

EDIT:

Ok small revision. The new transform node should be created in the very first split node you see in the ingame meme file and not placing it as the very last node in the file. Since I discovered that having it on the bottom would mean having the image (if you had chosen to use it as a fullscreen HUD image) obscure all other hud elements like minimap, health, ammo, and so on. So instead, put it on the very first splitNode. (that node is also where the other crosshairs are stored anyway, so it's the best place to have it anyway)

Also if you decide not to use this for a fullscreen hud and just want to enable custom crosshairs on vehicles, then this will work better:

Image
(as mentioned above, place transform node on first splitNode in file, and not at the bottom like in this image)

This fixes the crosshair so that it will disappear correctly when changing camera mode to an external view (except nose cam, since crosshair will remain in place in that view). But as a result it will ignore the size/position settings of the transform node it's on and instead inherit the position/size of the first instance of the crosshair CullNode which is the version used on soldiers. This means it can't be used as a fullscreen hud with this method. I think in vanilla BF1942 the crosshair's original size/position is smaller, thus you'll need to make it larger and recenter it if you wish to use a more detailed crosshair image that is larger then the original vanilla crosshair. This second method also means that you won't have to define an empty crosshair for all the vehicles in your mod that don't use the CHTIcon type or is set to CHTNone. Since with that extra cullNode info it can now determine whether or not to display the cross hair icon by reading the crossHairType command used on all the vehicles. I removed the picture node since it seems to also be inheriting the original picture node from the soldier version of the crosshair (since after I added that new CullNode, I noticed there being two crosshairs on screen instead of one, so I removed the picture node and fixed that. :P )

In my BFH'42 mod, the crossHairIcon is set to 64x64 size and positioned at 368x268 which is exact center of screen for a 64x64 size element. Thus you can use that size and position to alter the soldier's version so that your vehicle crosshair also has the matching size.

The original transform node that the game uses to govern the crosshair size/psoition is the very first transform node in the very first splitNode in the file. It should not be hard to miss. Adjust that to increase size/detail of the crosshairs for both soldiers and vehicles that use the CHTIcon crosshair type.

Now that I think about, all it took to fix custom crosshairs for vehicles was two cullNodes under a second transformnode (or splitNode as that node type will work for this too). Guess EA got real lazy with the HUD coding and never properly fixed the crosshair command for PCOs. :P
ImageImageImage

I have cameras in your head!
User avatar
Apache Thunder
 
Posts: 1195
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA

Re: Custom Crosshairs/HUDs without using meshes on PCOs...

Postby Swaffy » Tue Apr 16, 2013 5:37 pm

This would be perfect for a refined version of HomeFront, because Halo is known for having different crosshairs for each weapon.
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
Image
User avatar
Swaffy
 
Posts: 1666
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Re: Custom Crosshairs/HUDs without using meshes on PCOs...

Postby BotHunter » Thu Apr 25, 2013 6:43 pm

Very nice!! But would you mind posting the updated .meme file with instructions for us noobs? :)
Walk quietly and carry a sniper rifle
User avatar
BotHunter
 
Posts: 480
Joined: Thu Jan 10, 2013 11:22 pm

Re: Custom Crosshairs/HUDs without using meshes on PCOs...

Postby Apache Thunder » Fri Apr 26, 2013 7:39 pm

Many mods have different ingame meme file setups. Thus this is something I can't really post a meme file with this pre added. Though I could do one for vanilla BF1942.
ImageImageImage

I have cameras in your head!
User avatar
Apache Thunder
 
Posts: 1195
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA

Postby freddy » Sat Apr 27, 2013 1:05 am

Do you think this meme files can contain the settings that control how the chase camera behaves?

I have no clue what this Float values mean, maybe its something else entirely.

Image
User avatar
freddy
 
Posts: 1195
Joined: Sun Oct 18, 2009 4:58 pm

Re: Custom Crosshairs/HUDs without using meshes on PCOs...

Postby Apache Thunder » Mon May 06, 2013 4:45 pm

That is a boolData property on a cull node. It only serves to tell the attached nodes on the host transform node when they should become visible onscreen. The "ShowVehicleIcon" cull node property is what allowed me to enable the custom crosshair system on PCOs since they had code that would pass the texture to the node for it to display. That node booldata settings acts to tell the game when someone has entered a vehicle and to display HUD elements like the vehicle icon. It was just a matter of expanding the criteria for when to display things from that code line and having the attached variable picture node to facilitate that.

Don't think the meme system can have a direct impact on object behaviors though. The menu can do most things relating to the HUD. It can be modified to allow more then 6 weapon slots on a kit and extend other the range of other things. But I don't think it can directly impact the behavior of an object or object class like a Camera. :(

The per-vehicle crosshair system works because the game already had code that enabled it. Dice just never implemented the correct node settings in the MEME files so that they would be visible.
ImageImageImage

I have cameras in your head!
User avatar
Apache Thunder
 
Posts: 1195
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA

Re: Custom Crosshairs/HUDs without using meshes on PCOs...

Postby BotHunter » Mon May 06, 2013 5:06 pm

Apache Thunder wrote:Many mods have different ingame meme file setups. Thus this is something I can't really post a meme file with this pre added. Though I could do one for vanilla BF1942.


Sweet! Could you please do that?
Walk quietly and carry a sniper rifle
User avatar
BotHunter
 
Posts: 480
Joined: Thu Jan 10, 2013 11:22 pm

Re: Custom Crosshairs/HUDs without using meshes on PCOs...

Postby BotHunter » Fri Aug 16, 2013 4:26 pm

pLEASe!?
Walk quietly and carry a sniper rifle
User avatar
BotHunter
 
Posts: 480
Joined: Thu Jan 10, 2013 11:22 pm

Re: Custom Crosshairs/HUDs without using meshes on PCOs...

Postby Apache Thunder » Fri Dec 20, 2013 6:25 pm

Sorry for the delay on doing this. I completely forgot about doing the vanilla meme file edit to enable vehicle HUD crosshairs in vanilla BF1942:

NewCrossHairHud.rar
(I was half awake since I just woke up when I did this, so let me know if there's a unexpected bug somewhere. But I'm pretty sure it's all set up correctly)


I set this up to enable full screen HUDs for vehicles (and handweapons if you so desire since the crosshairIcon command also works with handweapons).

Note the edited version of the hk.dds texture. I included the DDS file since the game can't load a DDS file with the resolution I needed (was a non power by 2 resolution) so the game can be forced into loading the TGA file. If you had only included the TGA, the game would still use the DDS file from vanilla BF1942 in your custom mod. So be sure to include both! Because if you don't you'd see the vanilla crosshair icon take up the whole screen and that would certainly look odd. :P

I included a example edit of the willy to add a crosshair to the driver seat. Also note how the crosshair in the hk.tga file is positioned. If you want non fullscreen crosshairs you can use this as a reference point for how you should center the crosshair. The resolution of your custom crosshair icon must be 800x600 with your small crosshairs centered in the middle. Fullscreen huds you have more leeway with. Those can be any resolution you want so long as the aspect ratio (4:3 in this case) is the same. ;)
ImageImageImage

I have cameras in your head!
User avatar
Apache Thunder
 
Posts: 1195
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA

Re: Custom Crosshairs/HUDs without using meshes on PCOs...

Postby BotHunter » Sat Dec 21, 2013 2:39 am

Thank you so much :D
Walk quietly and carry a sniper rifle
User avatar
BotHunter
 
Posts: 480
Joined: Thu Jan 10, 2013 11:22 pm

Next

Return to Modding/Mapping Tutorials

Who is online

Users browsing this forum: No registered users and 2 guests

cron