Jump to content

Electrical mod


Boogman

Recommended Posts

Hello everyone.

 

I'm new to modding 7D2D.

 

How do I get the wire to connect to the model at a specific location. As you can see in the picture, it just

defaults to the center of the model block.

 

Do I need to add a node(bone), join, vetor, etc?

 

I have looked around the Assembly-CSharp.dll and can't figure it out.

 

Any help would be greatly appreciated.

wire.jpg.16dd14588d5b2c712301533a6d06b29f.jpg

Link to comment
Share on other sites

Electrical mod

 

Try adding a property to your models xml: <property name="WireOffset" value="x,y,z" />

 

Wow, worked great...!

 

Thank you very much xyth.

 

I have just started working with the Unity game engine, going to take a while to wrap my head around it.

 

By the way, I do 3d modeling in Maya 2012.

 

Boogman

Link to comment
Share on other sites

Electrical mod

 

You can also have a child gameobject on the model called "WireOffset" and it should link to that.

 

 

HAL9000, I added a child GameObject to the model and set it's location where I wanted the wire to be, sry but it didn't work. I even tried to add the GasmeObject to the parent GameObject and that didn,t work ether, maybe I'm doing something else wrong.

 

HAL9000, I remember that movie when it came out. DAVE.

 

Here is a pic of the GameObject setup.Untitled.jpg.5c05da46ad472ecca86f2bbb5a1a6265.jpg

Link to comment
Share on other sites

Electrical mod

 

WireOffSet, case sensitive, if I recall.

 

Here is what I used: WireOffset

 

 

I checked the Assembly-CSharp.

 

I checked the var at: TileEntityPowered.WireOffset

 

Same thing there. I have made a mistake somewhere.

 

Thanks, didn't know it was case sensitive, I should have, it's C#.

Link to comment
Share on other sites

I logged into my work pc (albeit from my phone) and peeked at a neon sign I made... I had Set instead of set, so I /think/ Set is right. But, it may not be a working copy of my neon sign. =)

 

- - - Updated - - -

 

Find um... Sniper Three08, he's the resident guru on that besides Hal. Xyth likely knows as well.

Link to comment
Share on other sites

Here is what I used: WireOffset

 

 

I checked the Assembly-CSharp.

 

I checked the var at: TileEntityPowered.WireOffset

 

Same thing there. I have made a mistake somewhere.

 

Thanks, didn't know it was case sensitive, I should have, it's C#.

 

Hello Boogman,

 

Here's the code from TileEntityPowered:

 

public Transform BlockTransform
{
	get
	{
		return this.KZZ;
	}
	set
	{
		this.KZZ = value;
		global::BlockValue block = global::GameManager.Instance.World.GetBlock(base.ToWorldPos());
		if (this.KZZ != null)
		{
			Transform transform = this.KZZ.FindChild("WireOffset");
			if (transform != null)
			{
				Vector3 wireOffset = global::Block.list[block.type].shape.GetRotation(block) * transform.localPosition;
				this.WireOffset = wireOffset;
				return;
			}
		}
		if (global::Block.list[block.type].Properties.Values.ContainsKey("WireOffset"))
		{
			Vector3 wireOffset2 = global::Block.list[block.type].shape.GetRotation(block) * global::Utils.ParseVector3(global::Block.list[block.type].Properties.Values["WireOffset"]);
			this.WireOffset = wireOffset2;
		}
	}
}

 

It has to be a direct child of the gameobject, not grandchild or deeper. From your screenshot it looks like you've put it as a grandchild but the image is blurry because the forum shrinks images.

 

Cheers,

 

Hal

Link to comment
Share on other sites

Electrical mod

 

Hum, maybe I am referencing the wrong dll.

 

My reference is set to: C:\SDXModding\Game\Working\7DaysToDie_Data\Managed\Assembly-CSharp.dll

 

Is the that correct?

 

copied pasted from the Assembly-CSharp.dll: TileEntityPowered.WireOffset

 

 

The Assembly-CSharp.dll only has 3 references to WireOffset.

 

var.png.a88a9a222f1af752fb1432de3b06bfaf.png TileEntityPowered.WireOffset

1084029757_ExternalDeclaration.png.8cabe99438d1f6a96845894aacebc3e4.png IPowered.GetWireOffset()

1084029757_ExternalDeclaration.png.8cabe99438d1f6a96845894aacebc3e4.png TileEntityPowered.GetWireOffset()

 

All the same, it worked with adding the property to the xml file, but not the GameObject child.

Link to comment
Share on other sites

Ok, I put it under the mesh, not the GameObject.

 

So it should look like this? GameObject.jpg.c589fe5233cc18c43a3ae66ce87baad1.jpg

 

Hello Boogman,

 

Here's the code from TileEntityPowered:

 

public Transform BlockTransform
{
	get
	{
		return this.KZZ;
	}
	set
	{
		this.KZZ = value;
		global::BlockValue block = global::GameManager.Instance.World.GetBlock(base.ToWorldPos());
		if (this.KZZ != null)
		{
			Transform transform = this.KZZ.FindChild("WireOffset");
			if (transform != null)
			{
				Vector3 wireOffset = global::Block.list[block.type].shape.GetRotation(block) * transform.localPosition;
				this.WireOffset = wireOffset;
				return;
			}
		}
		if (global::Block.list[block.type].Properties.Values.ContainsKey("WireOffset"))
		{
			Vector3 wireOffset2 = global::Block.list[block.type].shape.GetRotation(block) * global::Utils.ParseVector3(global::Block.list[block.type].Properties.Values["WireOffset"]);
			this.WireOffset = wireOffset2;
		}
	}
}

 

It has to be a direct child of the gameobject, not grandchild or deeper. From your screenshot it looks like you've put it as a grandchild but the image is blurry because the forum shrinks images.

 

Cheers,

 

Hal

Link to comment
Share on other sites

Got it sorted homie?

 

Yes, it worked great. I did have the WireOffset (GameObject) in the wrong location. I put it right off the parent GameObject and set is coordinates.

 

Also I found that the block coordinates are from the center of the block.

1904602425_cubeOffset.jpg.92cd136baa1db9a31cfc08468985a9ba.jpg

 

Thanks for help HAL9000 & Guppycur.

Link to comment
Share on other sites

You may find this helpful, if you haven't already seen it.

 

https://7d2dsdx.github.io/Tutorials/index.html

 

Oh yes, that was one of the first things I did. It's a good Tut.

 

I also been going through the Unity Tut's as well.

 

And I'm brushing up on my C#, I have not programed in years.

 

I do all my models in Maya 2012, I made models for a game call F.E.A.R.

 

I did the first female character for the game, also working minigun, sniper, duck nade, maps, etc.

 

Here is a pic of her. 1966466390_FemaleNanosuit.jpg.63f781ee60067a65403ce0f3c54a96d0.jpg

 

She was only 3178 Tris, that's a real lightweight model.

 

Oh, HAL9000 posted the source code of the Assembly-CSharp.dll above, can I get that?

 

Do you code in C#?

 

Thanks for the help...!

Link to comment
Share on other sites

Oh, HAL9000 posted the source code of the Assembly-CSharp.dll above, can I get that?

 

Download dnSpy and put the Assembly-CSharp.dll in and you can see the source. Use the DLL from the SDX version of the game because it does a lot of changes in the background to make the code easier to read

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...