• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

Electrical mod

Boogman

New member
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

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

 
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

 
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

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

 
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.

 
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:

Code:
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

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

External Declaration.png IPowered.GetWireOffset()

External Declaration.png TileEntityPowered.GetWireOffset()

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

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

So it should look like this? GameObject.jpg

Hello Boogman,
Here's the code from TileEntityPowered:

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

cube Offset.jpg

Thanks for help HAL9000 & Guppycur.

 
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. Female Nanosuit.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...!

 
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

 
Back
Top