Iron Sight Tutorial (FAQ)

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

User avatar
DarthXeon
Banned
Posts: 84
Joined: Mon Sep 19, 2011 5:41 pm
Projects :: I move fast... Lightning fast...
Games I'm Playing :: Hmm... I wonder...
Location: In A Nearby Solar System

Re: Iron Sight Tutorial (FAQ)

Post by DarthXeon »

looks a ton like "COD" now
kinetosimpetus
Imperial Systems Expert
Imperial Systems Expert
Posts: 2381
Joined: Wed Mar 25, 2009 4:15 pm
Projects :: A secret project
Games I'm Playing :: Warframe STO

Re: Iron Sight Tutorial (FAQ)

Post by kinetosimpetus »

Fiodis wrote:I thought we couldn't replace the global ingame.lvl, since not all the files included in it are also present in the data_***/Common folder?
Yeah, it can be done, I didn't test it rigorously, since I didn't want to end up modifying my HUD that way so idk if there is anything major missing.
THEWULFMAN
Space Ranger
Posts: 5557
Joined: Tue Aug 17, 2010 3:30 pm
Projects :: Evolved 2
Location: Columbus, Ohio
Contact:

Re: Iron Sight Tutorial (FAQ)

Post by THEWULFMAN »

Fiodis wrote:I thought we couldn't replace the global ingame.lvl, since not all the files included in it are also present in the data_***/Common folder?

It can be done. Zerted did it for the patch, and Rournes did it for his TFU mod. I intend to do it for my BF3 mod as well(unless I can figure out a workaround). All the files are there, or at least the important ones.
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Iron Sight Tutorial (FAQ)

Post by DarthD.U.C.K. »

for anybody who wonders: if you take the unmodified ingame.req from your data_XXX\Common and munge it you can use it a global ingame.lvl - no extra magic required. the problem however is that you will loose this:
Hidden/Spoiler:
Listens to AddUnitClass() calls to help generate the map's unit class table
Listens to SetHeroClass() calls to help generate the map's unit class table
Added ability to disable award effects (same function call as the FC command) by using the toggle file: v1.3patch\settings\noAwards.txt
Changes FakeConsole command color depending on sucessful run of the command (exe commands always show up as errored if when they work)
Added support for custom FakeConsole commands
Added hud from UnOfficial v1.2 patch
Change mine effect to reduce lag online
Spark texture is now more towards white instead of orange
Tweaked laser textures and increased lighting radius
Dimmed background when in FakeConsole
Displays description of selected FakeConsole command
Added text area to the right of the FakeConsole List
Moved the FakeConsole list more to the right
Increased the amount of FakeConsole commands displayed in the FakeConsole list
Reads in utility_function.lua
Reads in fakeconsole_functions.lua
Loads the Popup_Prompt script
Reads in custom strings from 'v1.3patch_strings.lvl'
Added support for overriding the team selection screen's team names
Added 'Esc' shortcut key to close the FakeConsole list
Added 'a' shortcut key to select auto-assign's button in the team selection screen
Added 'b' shortcut key to select auto-assign's button in the team selection screen
Added '1' shortcut key to select team 1's button in the team selection screen
Added '2' shortcut key to select team 2's button in the team selection screen
Added '3' shortcut key to select auto-assign's button in the team selection screen
Added '4' shortcut key to select spectator's button in the team selection screen
because its built into the 1.3 patch ingame.lvl of which the sourcefiles are lost.
i tried (and managed) to load a second "ingame.lvl" through a custom script and when it didnt crash the map it was even loaded (the log complained about stuff being loaded twice) but had no visual effect.

so, if you dont want to loose all the above 1.3patch features you would have to hexedit the content of your ingame.lvl into the 1.3patches global one...

edit:youll also loose the hud-coordinates for the 1.2patch weapons...
User avatar
Cerfon Rournes
Master Bounty Hunter
Master Bounty Hunter
Posts: 1558
Joined: Thu Jul 08, 2010 5:53 pm
Projects :: WIP. I will reveal what it is later on..
Games I'm Playing :: SWBF2-SWRC
xbox live or psn: No gamertag set
Location: New York, USA
Contact:

Re: Iron Sight Tutorial (FAQ)

Post by Cerfon Rournes »

Bump:
Just a fair warning for all the people working with Iron Sights..
The size of the weapon's Iron Sight will increase/decrease if you pick bigger/smaller screen sizes.
For example, I made my sight using the 1152x720 screen size in BF2. The result:
Hidden/Spoiler:
Image
However, look at it when I change to a different BF2 size, namely 1600x800:
Hidden/Spoiler:
Image
What does this all mean? Well, if the player gets your mod and doesn't use the screen size you used,(they might not even have the size because of different monitors) the Sights will be slightly out of place and size.
kinetosimpetus
Imperial Systems Expert
Imperial Systems Expert
Posts: 2381
Joined: Wed Mar 25, 2009 4:15 pm
Projects :: A secret project
Games I'm Playing :: Warframe STO

Re: Iron Sight Tutorial (FAQ)

Post by kinetosimpetus »

@Cerfon: Can you post your hud, or at least the relevant parts? Not sure how to fix that. Are those screen sizes the same aspect ratio? If they only look different in different ratios, perhaps a different hud could be used for each ratio.

---------------------------------------------------------

I finally got it to fix floating icons at the same time as adding ironsights, which was the biggest issue I personally have had with it, so here's my current 1playerhud.
Hidden/Spoiler:
[code]FileInfo("1playerhud")
{
Viewports(1)
}

ViewPort("Transforms")

{
// First Weapons Section

TransformNameMesh("player1weapon1")

// add msh names of first weapons here and remove unused lines

{
NameMesh("rep_weap_inf_pistol_mini_r", "com_inv_mesh")
NameMesh("delta_weap_helm_pistol", "com_inv_mesh")
NameMesh("cis_weap_inf_assault_cannon", "com_inv_mesh")

EventInput("player1.weapon1.change")
EventOutput("player1.weapon1.mesh")
}
}

Group("extraWeaponDisplay")
{
PropagateAlpha(1)

Viewport(1)

ZOrder(255)

EventEnable("player1.weapon1.mesh")
EventDisable("player1.weapon1.disable")

Group("extraWeaponIcon")
{
Viewport(1)

EventEnable("initialize")

Model3D("player1.weapon1mesh")
{
EventMesh("player1.weapon1.change")

Viewport(1)
ZOrder(5)

EventEnable("player1.weapon1.mesh")
EventDisable("player1.weapon1.disable")

//Position(500.000000, 500.000000, 500.000000, "Viewport")
//Rotation(0.804269, 359.994110, 359.999695)
Scale(1.000000, 1.000000, 1.000000)

//change position, rotation and scale of first weapon here, remove unused lines

MeshInfo("rep_weap_inf_pistol_mini_r")
{
Position(0.100000, 0.900000, 0.000000, "Viewport")
Rotation(0.000000, 90.000000, 0.000000)
}
MeshInfo("rep_weap_inf_rifle")
{ //remove extra icon that appears as if this script hasn't fixed the icon while leaving the fixed one from the global ingame.lvl
Position(-0.500000, 0.000000, 0.000000, "Viewport")
}
MeshInfo("delta_weap_helm_pistol")
{
Position(-0.260316, 0.356366, -0.002834, "Viewport")
Rotation(0.804269, 90.747269, 359.999695)
Scale(0.800000, 0.800000, 0.800000)
}
MeshInfo("cis_weap_inf_assault_cannon")
{
Position(-0.222832, 0.361293, 0.014590, "Viewport")
Rotation(0.804269, 90.747269, 359.999695)
}
}

// Second Weapons Section

TransformNameMesh("player1weapon2")

// add names of second weapons here

{
NameMesh("com_weap_inf_grenadethermal", "com_inv_mesh")

EventInput("player1.weapon2.change")
EventOutput("player1.weapon2.mesh")
}

Group("extraWeaponDisplay")
{
PropagateAlpha(1)
Viewport(1)
Position(0.0000000, 1.000000, 0.000000, "Viewport")
ZOrder(255)

EventEnable("player1.weaponsEnable")
EventDisable("player1.weaponsDisable")

Group("extraWeaponIcon")
{
Viewport(1)

Position(0.346161, -0.450412, 0.000000, "Viewport")

EventEnable("initialize")

Model3D("player1.weapon2mesh")
{
EventMesh("player1.weapon2.change")
Viewport(1)
ZOrder(5)

EventEnable("player1.weapon2.mesh")
EventDisable("player1.weapon2.disable")

Position(500.000000, 500.000000, 500.000000, "Viewport")
Rotation(0.804269, 359.994110, 359.999695)
Scale(0.000000, 0.000000, 0.000000)

// adjust position, rotation and scale of second weapon here

MeshInfo("com_weap_inf_grenadethermal")
{
Rotation(0.804269, 90.747269, 359.999695)
}
}
}
}
}
}

Group("player1weaponinformationforironsights")
{
PropagateAlpha(1)

Viewport(1)

ZOrder(255)

EventEnable("player1.spawn")
EventDisable("player1.die")

Group("player1weapon1groupforironsights")
{
Viewport(1)
EventEnable("initialize")

Model3D("player1weapon1mesh")
{
EventMesh("player1.weapon1.change")

Viewport(1)

ZOrder(5)

EventEnable("player1.weapon1.disable")
EventDisable("player1.weapon1.mesh")

MeshInfo("rep_weap_inf_dc15carbine")
{
Position(0.500000, 0.950000, 0.000000, "Viewport")
Rotation(0.000000, 180.000000, 0.000000)
Scale(20.000000, 20.00000, 20.000000)
}
MeshInfo("rep_weap_inf_pistol_dc18")
{
Position(0.500000, 0.950000, 0.000000, "Viewport")
Rotation(0.000000, 180.000000, 0.000000)
Scale(20.000000, 20.00000, 20.000000)
}
MeshInfo("rep_weap_inf_rifle")
{
Position(0.500000, 1.200000, 0.000000, "Viewport")
Rotation(-5.000000, 180.000000, 0.000000)
Scale(20.000000, 20.00000, 20.000000)
}
MeshInfo("rep_weap_inf_pistol_mini_r")
{
Position(0.500000, 1.050000, 0.000000, "Viewport")
Rotation(0.000000, 180.000000, 0.000000)
Scale(20.000000, 20.00000, 20.000000)
}
}
}
}[/code]
I should point out that in one place "mesh" is changed to "change" in the Group("player1weapon1groupforironsights") section, and this was the last change I made that got it working. So don't miss it. Or just copy this and insert the values from yours.

This was using the Floating Weapon Icon tutorial made by Mike Z, Majin Revan, and Fragme! I think.

Edit: looks like icons that didn't need the icon fix before now place an extra icon in the top left corner. probably can fix by... OK, I'm not sure. I'll work on that one another time...

Edit2: got it. added an example to the code above. this will probably have to be done to every stock weapon, or weapons used in the 1.3 patch.
Last edited by kinetosimpetus on Wed Feb 08, 2012 9:56 pm, edited 2 times in total.
User avatar
Cerfon Rournes
Master Bounty Hunter
Master Bounty Hunter
Posts: 1558
Joined: Thu Jul 08, 2010 5:53 pm
Projects :: WIP. I will reveal what it is later on..
Games I'm Playing :: SWBF2-SWRC
xbox live or psn: No gamertag set
Location: New York, USA
Contact:

Re: Iron Sight Tutorial (FAQ)

Post by Cerfon Rournes »

Nice fix.
@My Sights: No, they were not the same aspect ratio.
I took those shots on 1152x720 and 1600x900.
Here is my HUD file.
Hidden/Spoiler:
[code]Group("player1weaponinformationforironsights")
{
PropagateAlpha(1)

Viewport(1)

ZOrder(255)

EventEnable("player1.spawn")
EventDisable("player1.die")

Group("player1weapon1groupforironsights")
{
Viewport(1)
EventEnable("initialize")

Model3D("player1weapon1mesh")
{
EventMesh("player1.weapon1.mesh")

Viewport(1)

ZOrder(5)

EventEnable("player1.weapon1.disable")
EventDisable("player1.weapon1.mesh")


MeshInfo("imp_weap_inf_carbine")
{
Position(0.500000, 1.020000, 0.000000, "Viewport")
Rotation(-5.000000, 180.000000, 0.000000)
Scale(20.000000, 20.00000, 20.000000)
}
}
}
}[/code]
kinetosimpetus
Imperial Systems Expert
Imperial Systems Expert
Posts: 2381
Joined: Wed Mar 25, 2009 4:15 pm
Projects :: A secret project
Games I'm Playing :: Warframe STO

Re: Iron Sight Tutorial (FAQ)

Post by kinetosimpetus »

Can you try it in a smaller screen size with a 16:9 ratio and compare it to the 1600 x 900 screen? And the same for whatever the other ratio works out to be?

Fixed the double weapon icon with stock weapons. Same way as I already mentioned to remove the iron-sights for scoped weapons. just set a mesh info block with a position that sets it off screen. but put it in the floating icon fix section instead of the ironsights group. but not in the transform mesh section, or the original correct icon will also disappear.

I'll add a section as an example to my post before this.
User avatar
Havoc 526
Rebel Warrant Officer
Rebel Warrant Officer
Posts: 317
Joined: Sat Apr 04, 2009 6:24 pm
Projects :: Something
Games I'm Playing :: Xenoblade Splatoon
Location: Howling at the Moon

Re: Iron Sight Tutorial (FAQ)

Post by Havoc 526 »

Um, not to sound n00bish, but where do we put the HUD file to munge it? Do we put it in a SIDE folder, or do we leave it where it is?
kinetosimpetus
Imperial Systems Expert
Imperial Systems Expert
Posts: 2381
Joined: Wed Mar 25, 2009 4:15 pm
Projects :: A secret project
Games I'm Playing :: Warframe STO

Re: Iron Sight Tutorial (FAQ)

Post by kinetosimpetus »

Leave it where it is. I tried munging it as a side and couldn't get it to work.
User avatar
Havoc 526
Rebel Warrant Officer
Rebel Warrant Officer
Posts: 317
Joined: Sat Apr 04, 2009 6:24 pm
Projects :: Something
Games I'm Playing :: Xenoblade Splatoon
Location: Howling at the Moon

Re: Iron Sight Tutorial (FAQ)

Post by Havoc 526 »

Okay, thanks. I wasn't sure.
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: Iron Sight Tutorial (FAQ)

Post by Anakin »

thank you for this great tutorial. I just tried it, but everytime i zoom i got a white screen.

my ingame.req

Code: Select all

ucft
{
    REQN
    {
        "config"
        "1playerhud"
    }
}
my 1playerhud.hud
Hidden/Spoiler:
[code]
FileInfo("1playerhud")
{
Viewports(1)

}

Group("player1weaponinformationforironsights")
{
PropagateAlpha(1)

Viewport(1)

ZOrder(255)

EventEnable("player1.spawn")
EventDisable("player1.die")

Group("player1weapon1groupforironsights")
{
Viewport(1)
EventEnable("initialize")

Model3D("player1weapon1mesh")
{
EventMesh("player1.weapon1.mesh")

Viewport(1)

ZOrder(5)

EventEnable("player1.weapon1.disable")
EventDisable("player1.weapon1.mesh")

MeshInfo("rep_weap_dc15st")
{
Position(0.500000, 0.950000, 0.000000, "Viewport")
Rotation(0.000000, 180.000000, 0.000000)
Scale(20.000000, 20.00000, 20.000000)
}
MeshInfo("ande_dc17_rifle")
{
Position(0.500000, 0.950000, 0.000000, "Viewport")
Rotation(0.000000, 180.000000, 0.000000)
Scale(20.000000, 20.00000, 20.000000)
}
}
}
}
[/code]
also i added this line:

Code: Select all

ScopeTexture				= "trans_scope"
to all the weapons i want the iron sight.
the trans_scope.tga (512x512 transparent) i put in the
C:\BF2_ModTools\data_XXX\Sides\rep\msh folder and the
C:\BF2_ModTools\data_XXX\Common\mshs folder because i thought i may have the scope texture in the wrong folder.

Than i added the line
ReadDataFile("dc:ingame.lvl") to the maps lua and munged.

But ingame i now have a complete white screen. What's wrong??

==EDIT==

i need to correct me. Photoshop elements made the trasnparent white. so i toke paint.net and now it's transpetent. but no weapon is shown.
Do i need to put the weapon.msh into the data_XXX\Common\mshs folder, too??

==Edit2==

I got the dc15 working with the extraweappn.hud for fixing floating icons. I simply added the hud thing from the tutorial to the floating icon hud file. But the dc17 isn't showm. And i don't know why. The only differences to the dc15 is, that the dc17 msh is also used for fixing floating icon. The dc15 not. But i cannot belive that's the reason.

Has someone an idea??

EDIT
Ok please forget this stupid post above. i simply haven't read the whole tread

This is a realy great tutorial. kinetosimpetus you are a god.

the problem from Cerfon Rournes i had, too. i first fixed all position using the mod tool BFII.exe. and this has a lower resolution than my Full HD monitor. so on this i had the same problem. i fixed that by using the 3rd position value. about -750.00000. this moves the waepon away from me into the screen. but i don't know what this will cause on lower resolutions.

@kinetosimpetus: you may can link the fixed icon + ironsight tutorial to the first page.

Double posting is against the RULES; please EDIT your post instead -Staff
kinetosimpetus
Imperial Systems Expert
Imperial Systems Expert
Posts: 2381
Joined: Wed Mar 25, 2009 4:15 pm
Projects :: A secret project
Games I'm Playing :: Warframe STO

Re: Iron Sight Tutorial (FAQ)

Post by kinetosimpetus »

I think I already did, either that or I didn't and an admin just did, if that's the case, thanks, admin!
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: Iron Sight Tutorial (FAQ)

Post by Anakin »

I found a small problem with the iron sight. I added it to 2 weapons. but all the others now have floating icons at the zoom.
Hidden/Spoiler:
Image
someone an idea??
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: Iron Sight Tutorial (FAQ)

Post by Marth8880 »

kinetosimpetus wrote:If you don't add a meshinfo block for a weapon, an icon will 'float' in the upper left corner of the screen, so add a meshinfo to move it offscreen. Moving the weapon to the left should work:

Code: Select all

Position(-0.500000, 0.000000, 0.000000, "Viewport")
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: Iron Sight Tutorial (FAQ)

Post by Anakin »

:oops:

Thank you

where do you get all these avaters?? Is there somewhere an website http://www.marth'sgtavaters.com??
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: Iron Sight Tutorial (FAQ)

Post by Marth8880 »

Anakin wrote:where do you get all these avaters?? Is there somewhere an website http://www.marth'sgtavaters.com??
Off-topic: I have a very large set of random avatars via randimg.net. ;) I have a bunch more "your life sucks so buy our product" commercial GIFs that I need to scale down to size and add to my set. :o
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: Iron Sight Tutorial (FAQ)

Post by Anakin »

OK and i wonder why you always have a new image :D


So i really hope i haven't overread it again. I searched with the search function, and used Ctr+F on this thread.

I think the problem is self-explanatory
Hidden/Spoiler:
Image
every time i press m i got this screen. No matter if i used zoom before or not.
kinetosimpetus
Imperial Systems Expert
Imperial Systems Expert
Posts: 2381
Joined: Wed Mar 25, 2009 4:15 pm
Projects :: A secret project
Games I'm Playing :: Warframe STO

Re: Iron Sight Tutorial (FAQ)

Post by kinetosimpetus »

There's a chunk of code in there you may have missed that should take care of that, I'll see if I can find it.

EDIT: Ooops, there isn't. :oops:
Now attempting to fix.
Post Reply