Assigning a material to a PCO problem

Ask questions, discuss ideas, get answers
User avatar
285mods
Posts: 22
Joined: Tue Dec 03, 2013 12:58 am
Location: US
Contact:

Assigning a material to a PCO problem

Post by 285mods »

So I have been working on a CSM for my "VooDoo Clan's Legendary Team" Server. My goal is to have a few cool mods that don't require the CSM to play.. Modded Clients get the new stuff while non-modded clients can still connect and play as well.

After seeing Swaffy's Exploding Barrels Mod I decided I wanted something like that in my mod.. I am using all existing 1942 templates to create this.
I have had some success so far with spawning the Wespe_Gunner_PCO1. I want an invisible PCO so non-modded clients won't be seeing weird stuff all over the map.

Main Invisible PCO

Code: Select all

rem *** Wespe_Gunner_PCO1 ***
ObjectTemplate.create PlayerControlObject Wespe_Gunner_PCO1
ObjectTemplate.NameTagOffset 0/-0.1/0
ObjectTemplate.setNetworkableInfo WespeBodyInfo
ObjectTemplate.aiTemplate WespeCannon
rem -------------------------------------
ObjectTemplate.addTemplate WespeEntry
ObjectTemplate.setPosition 0.4/0/0.5
ObjectTemplate.addTemplate WespeTower
ObjectTemplate.setPosition 0/0.585/-0.202
Visible Template WespeTower

Code: Select all

ObjectTemplate.create RotationalBundle WespeTower
ObjectTemplate.geometry Wespe_Tower_M1
rem -------------------------------------
ObjectTemplate.addTemplate WespeGunBase
rem -------------------------------------
WespeGunBase

Code: Select all

ObjectTemplate.create RotationalBundle WespeGunBase
rem -------------------------------------
ObjectTemplate.addTemplate WespeCannon
rem -------------------------------------
Visible WespeCannon

Code: Select all

ObjectTemplate.create FireArms WespeCannon
ObjectTemplate.geometry Wespe_Cannon_M1
This spawns 2 visible templates which are the WespeTower, and the WespeCannon. I copied the stebarrel1_m1 StandardMesh File and renamed it to Wespe_Tower_M1.
This spawned a barrel with the WespeCannon sticking out of it, so I made a tiny custom mesh file in gmax and named it Wespe_Cannon_M1.

Now when I spawn the Wespe_Gunner_PCO1, it shows up as a normal looking barrel.

Everything seems good, except when I shoot the barrel (Wespe_Gunner_PCO1) the projectile goes thru the barrel (PCO) with no interaction at all.
This would indicate to me that there is no material assigned to the PCO, but what I can't understand is that ExPacs, Grenades, and Bombs will destroy the barrel (PCO) just fine.. but bullets have no effect at all. At first I added the standard Light Armor Material ID 45. When this had no effect I made a new, custom material ID 283 and added that.. same results as before, explosives will destroy the barrel, while guns have no effect on it.. So I thought maybe it's the splash damage from explosives, but the main cannon from a tank doesn't damage the barrel at all even when I shoot the ground around the PCO.. it doesn't damage the PCO at all.. I thought maybe the Material needs to be assigned to the actual mesh object (WespeTower) so I tried that and still no interaction. Bullets go right thru the mesh, the knife doesn't interact with it either. I also noticed that I can ram a jeep into the barrel PCO at full speed and it will not damage the jeep at all, but if i try that on a nearby stecrate it will damage the jeep.

Somehow, the PCO must have a Material that the explosives can interact with, but projectiles cannot.. Explosives have 2 Material IDs, I assume one for the object (Grenade) and one for the Damage..

But I am at a loss on how to solve this.. if the explosives can damage the barrel, then it seems like there must be a way to make projectiles also damage it.

Below is my mod so far: (at the moment it won't work SSM because I have been trying different things to get the bullets to damage the PCO) but it works to create a local game to test it

Code: Select all

ObjectTemplate.Active Wespe_Gunner_PCO1
ObjectTemplate.cullRadiusScale 4.0
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.hasResponsePhysics 1
ObjectTemplate.hasDynamicShadow 1
ObjectTemplate.explosionRadius 15
ObjectTemplate.explosionMaterial 284
objectTemplate.criticalDamage 0.5
ObjectTemplate.hpLostWhileCriticalDamage 0.1
ObjectTemplate.HasArmor 1
ObjectTemplate.HitPoints 1
ObjectTemplate.MaxHitPoints 1
ObjectTemplate.Material 283
rem ObjectTemplate.Material2 283
ObjectTemplate.timetoliveafterdeath 0.1
rem ObjectTemplate.addArmorEffect 0 e_ExplGranade 0/0/0
ObjectTemplate.setVehicleCategory VCLand
ObjectTemplate.setVehicleIcon "Empty.dds"
ObjectTemplate.setMinimapIcon "Empty.dds"
ObjectTemplate.setPcoId 0
ObjectTemplate.GUIIndex 30

ObjectTemplate.Active WespeEntry
ObjectTemplate.setEntryRadius 0

ObjectTemplate.Active WespeTower
ObjectTemplate.Material 283
rem ObjectTemplate.Material2 283
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.hasResponsePhysics 1
ObjectTemplate.hasDynamicShadow 1
ObjectTemplate.explosionRadius 15
ObjectTemplate.explosionMaterial 284
objectTemplate.criticalDamage 0.5
ObjectTemplate.hpLostWhileCriticalDamage 0.1
ObjectTemplate.HasArmor 1
ObjectTemplate.HitPoints 1
ObjectTemplate.MaxHitPoints 1

Here is my complete Mod with all custom projectile materials etc..
http://www.mediafire.com/download/wph65 ... %20Mod.rar

Any help with this is greatly appreciated..
He is no fool to lose that which he cannot keep, To gain that which he cannot lose.

285mods
User avatar
Swaffy
Posts: 1715
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Re: Assigning a material to a PCO problem

Post by Swaffy »

I'd like to begin my post by saying the explosive barrel is from ApacheThunder's mod called "DC_UNAUTHORIZED" but I use it in my mod and changed a lot of it. I believe he converted the barrel from Battlefield 2.

I need to look at your post closer to really understand the issue here, but the first thing I noticed is how you said the PCO can take damage from explosives but projectiles go through. The reason this happens is because you don't necessarily need a collision mesh for the object to recieve splash damage. But you do need one for colliding objects (projectiles for this matter).

My guess is that you didn't add a collision mesh to the object you created in GMax. You also want to add a material ID to the collision mesh. I can't remember what ID I used for the barrel (I changed it from what ApacheThunder's original model had) but it's the same one as the Kubelwagen and Willy (basically, scour car armor).
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
User avatar
285mods
Posts: 22
Joined: Tue Dec 03, 2013 12:58 am
Location: US
Contact:

Re: Assigning a material to a PCO problem

Post by 285mods »

Swaffy wrote:I'd like to begin my post by saying the explosive barrel is from ApacheThunder's mod called "DC_UNAUTHORIZED" but I use it in my mod and changed a lot of it. I believe he converted the barrel from Battlefield 2.

I need to look at your post closer to really understand the issue here, but the first thing I noticed is how you said the PCO can take damage from explosives but projectiles go through. The reason this happens is because you don't necessarily need a collision mesh for the object to recieve splash damage. But you do need one for colliding objects (projectiles for this matter).

My guess is that you didn't add a collision mesh to the object you created in GMax. You also want to add a material ID to the collision mesh. I can't remember what ID I used for the barrel (I changed it from what ApacheThunder's original model had) but it's the same one as the Kubelwagen and Willy (basically, scour car armor).
yeah you used Material ID 45 which is the standard light armor, jeeps, apcs, etc.. I tried that.. The reason I don't think it's splash damage from the explosives, is because the main cannon on a tank also has splash damage but shooting at the Barrel-PCO or on the ground around it doesn't damage the Barrel-PCO at all.

The reason I don't think it has anything to do with the gmax file is because the only mesh I changed in gmax was for the cannon barrel.. the wespetower mesh is the default stebarrel1_m1 mesh file.. I will add that bullets do interact with the stebarrels in normal maps.. but when I use the barrel mesh file for the WespeTower, they don't. I'm not all that experienced a modder but every instinct I have points to the PCO / WespeTower not accepting my

Code: Select all

ObjectTemplate.material 45
line.. In the Wake Demo, you have to create a new material anytime you want to add a new projectile or object which is why I created the "Material ID 283" and tried that.. but it had the exact same results as "Material ID 45"

It has to be the Material because vehicles don't interact with the PCO either.. even with default mesh files they have no collision physics at all.. with the barrel mesh, I do get collision physics from vehicles (crashing a jeep into the Barrel-PCO) the jeep cannot drive thru the Barrel-PCO, but it also takes no damage from the collision. while crashing into any other static object, such as a nearby stecrate, it damages the jeep
He is no fool to lose that which he cannot keep, To gain that which he cannot lose.

285mods
User avatar
Swaffy
Posts: 1715
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Re: Assigning a material to a PCO problem

Post by Swaffy »

Did you use the run command to tell the game to load the files, and did you use the same file typed for the code you found in my mod? I think ApacheThunder used "tweak" files for a reason which I don't remember.

*aah!*

Here is the thread I made when I was adding the explosive barrel to my mod. I really hope there's something in there that can help you out!
http://bfmods.com/viewtopic.php?f=6&t=820&p=5660
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
User avatar
285mods
Posts: 22
Joined: Tue Dec 03, 2013 12:58 am
Location: US
Contact:

Re: Assigning a material to a PCO problem

Post by 285mods »

Swaffy wrote:Did you use the run command to tell the game to load the files, and did you use the same file typed for the code you found in my mod? I think ApacheThunder used "tweak" files for a reason which I don't remember.

*aah!*

Here is the thread I made when I was adding the explosive barrel to my mod. I really hope there's something in there that can help you out!
http://bfmods.com/viewtopic.php?f=6&t=820&p=5660
Yes I did. the custom material is working fine.. the problem is assigning it to the Barrel-PCO..

Code: Select all

ObjectTemplate.Material 283
doesn't seem to be working

Also your barrel code doesn't work for my situation.. it would work perfectly if my server required the mod to play, but I want unmodded clients to be able to join and play as well
He is no fool to lose that which he cannot keep, To gain that which he cannot lose.

285mods
User avatar
285mods
Posts: 22
Joined: Tue Dec 03, 2013 12:58 am
Location: US
Contact:

Re: Assigning a material to a PCO problem

Post by 285mods »

Here is a video of me testing the mod.. hopefully someone can help me solve this

http://youtu.be/FNupwxMb3ic
He is no fool to lose that which he cannot keep, To gain that which he cannot lose.

285mods
User avatar
Vilespring
Posts: 740
Joined: Sat Nov 24, 2012 5:47 am
Location: Somewere in the United States

Re: Assigning a material to a PCO problem

Post by Vilespring »

can I see your code?
I believe the wespe gunner PCO doesn't take damage from bullets, no mesh, etc, because damage is determined by hit to the parent PCO, aka, the hull/superstructure.

with the barrel PCO, you forgot to show if you could walk through it. The collision between projectiles and soldiers is determined by collision mesh 2(?). I may not be right. collision mesh 1 is the very rough vehicle/terrain/building collision. I think you are missing a mesh.
A picture is worth a thousand words, but takes up three thousand times the memory.

Area 51: http://battlefieldarea51mod.weebly.com/

Image
"I didn't steal your pizza"
User avatar
285mods
Posts: 22
Joined: Tue Dec 03, 2013 12:58 am
Location: US
Contact:

Re: Assigning a material to a PCO problem

Post by 285mods »

Vilespring wrote:can I see your code?
I believe the wespe gunner PCO doesn't take damage from bullets, no mesh, etc, because damage is determined by hit to the parent PCO, aka, the hull/superstructure.

with the barrel PCO, you forgot to show if you could walk through it. The collision between projectiles and soldiers is determined by collision mesh 2(?). I may not be right. collision mesh 1 is the very rough vehicle/terrain/building collision. I think you are missing a mesh.
You cannot walk thru the barrel mesh, but you can walk thru the default wespetower mesh.. I know I keep saying this, The Mesh file that i'm using is the stebarrel1_m1 from StandardMesh.. I just renamed it to WespeTower_m1. The stebarrels interact with bullets, the pco with the barrel mesh does not.. which i why I think it's a material problem.. does anyone know what the default material would be for the Wespe_Gunner_PCO1 ? the main Wespe is material id 45.. I assumed the PCO would be the same..

http://www.mediafire.com/download/wph65 ... CO+Mod.rar


Image

Thanks for looking and hopefully you find a solution :)
He is no fool to lose that which he cannot keep, To gain that which he cannot lose.

285mods
User avatar
Apache Thunder
Posts: 1213
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: Assigning a material to a PCO problem

Post by Apache Thunder »

What is going wrong is that you need to re-export the mesh with a different material number on the collision mesh faces to match the material you want to use for bullet collision/damage.

The normal ObjectTemplate.material command for PCOs only impacts what "explosion" materials do in damage to the PCO.

For example, setting it to 45 will cause it to take similar damage from explosions as jeeps and other vehicles that are also using that material. However it has no impact at all on direct collision. That's governed entirely by the what was assigned to the COL01/COL02 mesh on export. The only exception is with Projectiles where the material and material2 commands work differently. Reexport the barrel with the collision meshes using your new material, or use a program like forcematid to alter the materials in the SM file. Though I've seen this program fail to update materials on COL01 if the SM file has both a COL01 and COL02 mesh.

I don't recall if I gave that barrel two collision meshes or not, so to be safe just import it into Gmax/3DSMax and rexport with the new material.

Also, the Material2 command is not a valid command for PlayerControlObjects and only works for projectiles (but you have it remmed out. But just mentioning this in case you ever try to use it again).

However, if you wish to specify a custom material for a exploding PCO, use the ObjectTemplate.explosionMaterial command instead. It's essentially the PCO's equivalent to the Material2 command. As far as I know it should be possible to alter the materials in the SM file and it work as a server side mod. The server handles the damage system anyways so I see no reason why this wouldn't work in mulitplayer.

As for the "tweak" files I used in that mod. That was just something I did to make things look similar to BF2 style coding. It has no functional purpose. Yeah I was doing a few weird things back then. :P
ImageImageImage
I have cameras in your head!
User avatar
285mods
Posts: 22
Joined: Tue Dec 03, 2013 12:58 am
Location: US
Contact:

Re: Assigning a material to a PCO problem

Post by 285mods »

Apache Thunder wrote:What is going wrong is that you need to re-export the mesh with a different material number on the collision mesh faces to match the material you want to use for bullet collision/damage.
I apologize for my ignorance, I only started using GMAX very recently and am not very knowledgeable in it's use.. here is a ss of what my export screen looks like.. I assumed I should forcematid to Material ID 45?? since bullets interact with the jeep's armor I assumed they would the barrel pco's as well.

Image

After I did this, the Jeep Collision with the Barrel-PCO now damages the jeep.. so I would call that progress, but bullets still pass right through the Barrel-PCO with no interaction.
He is no fool to lose that which he cannot keep, To gain that which he cannot lose.

285mods
Post Reply