Author Topic: How to make a weapon plant bricks?  (Read 783 times)

I need my weapon to plant bricks like the brick planting tool. How would I do this? I would like it so that when you use the weapon it basically replaces the Brick Planting tool so you can change bricks while holding it. (Like the Fill can replaces the paint can)
« Last Edit: June 25, 2010, 06:08:15 PM by takato14 »

Bump D:> I know its possible; the Swiss Army Gun does it...

Uhhm... Scroll?
You need to be more specific.

If you know the swiss army gun does it, why haven't you looked at its coding to try and find out for yourself?

If you know the swiss army gun does it, why haven't you looked at its coding to try and find out for yourself?
I have. I couldnt figure it out, the way the Swiss army Gun works is that the coding is all split up to create a situation where you can make modes fairly easily. The division of the coding makes the functions very hard to follow and understand. Its basically this: The functions that are the actual modes of the gun are only small snippets of code. They do not work without the entire root code of the Swiss army Gun. Its hard to pick out which parts of the codes make it plant bricks.

Uhhm... Scroll?
You need to be more specific.
What do you mean be more specific? I want the projectile to deploy bricks. What else is there to say?

Well then use the brick tool. What else is there to say?

Just search for the plant mode's coding. You don't need to know how the entire gun works.

Just search for the plant mode's coding. You don't need to know how the entire gun works.
I found the plant mode's coding; it doesnt work without the main part of the gun! The plant mode coding itself doesnt function alone, it needs the remainder of the code that is in the main Swiss army gun coding to actually do something.

Think of it like this. A program made using the Microsoft .NET framework cant run without the framework installed. The gun's main code is the framework, and the brick planting mode is the program.
« Last Edit: July 02, 2010, 12:27:23 PM by takato14 »

As far as the actual brick planting...
Found in a post not too long ago and used it for one of my projects.

Code: [Select]
%brick = new fxDtsBrick()
{
position = position;
dataBlock = datablock;
colorID = color;
client = client;
};
%brick.setTrusted(1);
%brick.isPlanted = 1;
%brick.plant();

Make sure you change position, datablock, colorid, and client to match what you need.
and then use %player.tempbrick.getDatablock() for the datablock

As for other things to make it just like the brick planting tool, I don't know. Your best bet is to do what other people have already said - look at the swiss army gun. Use that as a resource to figure a few things out. Of course you can't just copy and paste it and expect it to work.
« Last Edit: July 02, 2010, 02:20:44 PM by Headcrab Zombie »

I found the plant mode's coding; it doesnt work without the main part of the gun! The plant mode coding itself doesnt function alone, it needs the remainder of the code that is in the main Swiss army gun coding to actually do something.

Think of it like this. A program made using the Microsoft .NET framework cant run without the framework installed. The gun's main code is the framework, and the brick planting mode is the program.
Believe it or not I know what I'm talking about. This will plant a brick with the correct arguments.
Code: [Select]
brickDeployProjectile.onCollision(%obj, %col, 0, %pos, "0 0 1");That's exactly what I told you to find. It doesn't need the swiss army gun to function.

(*FaceDesk*) Im so stupid. Sorry for being such a novice; I KNOW you know what you're talking about, Amade; Ive seen your work. Thanks for helping me out, guys. Sorry for not paying attention. Credit to all of you who helped out.