Jump to content
Official BF Editor Forums
Sign in to follow this  
SERPIKO

Switching Kit Geometry When Selecting A Secondary Weapon

Recommended Posts

Hi all,

I am trying to figure out how to make kit geometry changes as soon as the player selects a different weapon/item available in his kit. In short, my mod features 4 kits for each team, each kit model (skinnedmesh) consists of 3 different geometries:

Geometry 0 is composed by bags, pouches, gear, etc.;

Geometry 1 is just the same as Geometry 0, but also includes the main weapon model (ar or smg);

Geometry 2 is just a dropkit.

The basic idea is to reproduce in bf2 the effect of other fps (example Counter Strike), where if you switch from the main weapon to the pistol or any other secondary item, the rifle model shows up on the soldier back.

In bf2, kits geometries switching sometimes happens with PCOs; when entering some vehicles/seats a particular kit geometry is assigned to the player by the “CrewKitIndex” code in the vehicle tweak file. I suppose this is not useable when selecting a weapon, as weapons are not PCOs afaik.

It seems that the only possible way is to force the "geometry" switching by some Python script. So I found that BF2OldSchool mod devs created a Python script which basically works when selecting a weapon; (between other things) the script checks if the selected weapon is allowed and is not included in a list of “banned” weapons. I tried to modify the BF2OldSchool script so to create the geometry switching but I am a little bit lost with the code to be used.

The below part of the script generates a text message when you select a banned weapon; I guess I need to replace the "message" related code (in bold) with some code to force to switch from kit geometry 1 to kit geometry 2:

CODE:

*******************************************************************************************************************

def changedWeapon(WeaponList, player, weapon):

if str(weapon.templateName) in WeaponList:

host.sgl_sendTextMessage( 0, 12, 1, str(WARNING_LVL0) % (player.getName()), 0)

# this is where I should tell the game to change from geom 1 to geom 2

else

player.getDefaultVehicle().setDamage(0)

# this is where I should tell the game to change from geom 2 to geom 1

*******************************************************************************************************************

END OF CODE

Based on some forum posts I exclude "rcon" commands as they would affect all instances (of the kit) and not a specific player's kit. Can anybody suggest any alternative code to get my target?

Of course any help (with or without Python scripts) would be appreciated!

Share this post


Link to post
Share on other sites

Hi BadSanta,

you still show up as a senior modder here ;-)

The video is really interesting and makes me wonder how and which changes you made to the exe.

I always thought there should be something related to the geometries and lod switching in the game code.

The DEVS already thought to include the possibility of changing the kits aspect, as since the release the bf2 xpack we know that activating the gasmask or the NVG actually adds an additional model (the mask/googles) to the already "worn" kit.

Such additional models are defined (in the related .con) as "MaskObject", and I bet there is a game command which enables them to show up.

I already investigated about the possibility to "play" with the gasmask thing to modify the kit aspect, but it creates some issues (more details here: http://www.battlefieldsingleplayer.com/forum/lofiversion/index.php?t17212.html).

I would be glad if you could put me in the right direction, though I don't know how to recompile the exe in case of any change (I never did it before).

Thanks in all cases.

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...