x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to add a Weapon to the "MyCharacter" Blueprint?

SO i basically followed this tutorial here:

http://creategamesfromscratch.blogspot.co.at/2014/05/prototype-adding-hands-and-weapon.html

I importet the Hands and Animations and voila, the hands where there. (only that the hands where not following the player wich was kind of odd. when i looked left and right they moved but when i wanted to look up or down they where not moving) Then i wanted to add the first weapon.

Now i already created an WeaponType Emu and i Assigned the new Weapon Mesh to the right Socket of the Player Mesh. i positioned it and saved.

No i went into the MyCharacter Blueprint where i created the need variables. I noticed that in the Turorial he also had a "Mesh1P" variable wich i dont know what tyoe it is and for what i need it.

I created the change weapon funktioned as in the Tut but im stuck with the "Set Static Mesh" and "Attach to" Nodes. Every time i spawn in a "Set Static Mesh" it has the Target "self" and in the Tutorial it has not!!! I also cant attach the "weapon" variable to the target because it tells me:

"Opject 2staticmesh is not compatible with Object staticmeshcomponent"

How can i make this like in the tutorial?

Heres the Change Weapon Funktion from the Tutorial: ChangeWeapon Funktion from Tutorial

And here is mine. now i created everything the same like in the Tutorial except for the "Set Static Mesh" and "Attach to" funktions. i importet those but in the "Target" spot both have "self" and i dont know why. in the tutorial they have not.and i cant assign the weapon variable. And the "Mesh1P" i just created myself. i dont know how he did it in the tutorial, he seemed to have skipped that part. maybe thats the problem. i dont even know how blueprint knows to attach the weapon to the character. i never selected the hands mesh or the weapon for the whole blueprint. how is this working? alt text alt text

Product Version: Not Selected
Tags:
1.png (148.2 kB)
2.png (157.5 kB)
more ▼

asked Aug 10 '14 at 08:34 PM in Blueprint Scripting

avatar image

Pandabrain
16 4 7 8

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Ok. Have you checked if the Variable is of the type Static Mesh and not on Static Mesh Component?

The question how this works is easy. Your Hands Mesh has a Socket. In the Tutorials you were told to create it. A socket is a place at your mesh where you can place a model. It follows the bone at which it was created. For better understanding:

Imagine a socket that is created at the middlehandbone and its called Right Hand Socket. Now you can attach a spawned static mesh to it. Like a sword. It will follow the right hand than. I hope that answers your question and i really think set the wrong variable type for the weapon. Maybe a mistake while being to fast.

more ▼

answered Aug 11 '14 at 12:40 AM

avatar image

eXi
6.8k 332 184 465

avatar image Pandabrain Aug 11 '14 at 01:32 AM

thx for the reply. i already know how sockets work and i also created one and assigned the weapon model to it.

what i wanted to know is how the "Set static Mesh" and "Attach to" Variable are working.

As far as i know is that "set static Mesh" defining the weapon i use and "attach to" means to attach that weapon to the specific socket on my mesh.

But in the "Set static Mesh" variable theres no point where i can tell it to choose my specific weapon mesh. how sould the "Weapon" Variable know wich model to pick?

And the "Attach to" has only one the socket specified, not the mesh on wich the socket is. is this enough? or do i have to choose the specific mesh for the hands also somewhere in the variable?

avatar image eXi Aug 11 '14 at 09:32 AM

That's both not true. Look at the Tutorial picture of the nodes. The SetStaticMesh Node gets the Weapon StaticMeshComponent as the Target. So it's Mesh will be changed. And the second pin of the SetStaticMesh Node is set to the reaper model.

And the question with the socket is the same. Your "Mesh1P" is the mesh, that got the Arms. Look at the part auf the tutorial where he sets up the Hands. You can see that he named the Arms "Mesh1P". So thats the component he checks for the Socket Name. You set up the socket, so he can find it and attaches the StaticMesh to it.

Have you fixed the issue with the Weapon variable? The Author did a mistake here. Look at this Picture here:

alt text

Right under the Mesh1P, there is a thing called "Weapon". It's of type "StaticMeshComponent". If you create this, you can use it in you Blueprint. It will be shown as a Variable in the left panel. That's the Variable you need to use for the two Nodes. You can also see that by looking at the Tutorial Version of that step. Right under the name of the function "SetStaticMesh" there is the type of the Target "Target is StaticMeshComponent". I don't know why he told you to create a Weapon Variable. Maybe you need i later but for now, i would delete it, create the StaticMeshComponent in you Components Tab. Drag it at the CameraComponent, so that it's a child of it and use this one.

Your hands not following your mouse/camera movement could be the fact, that you didn't make it a child of the CameraComponent. Look at the Tutorial picture.

avatar image Pandabrain Aug 11 '14 at 02:19 PM

thank u very much. That solved nearly everything i was having trouble with ;)

avatar image eXi Aug 11 '14 at 03:29 PM

Im glad that helped (: Would you mind checking the answer as correct by clicking the "check" icon on the left side of the answer post (the top most post of mine)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question