Hello and hi
I have been fiddling with unreal for a short period of time.
Now i wanna learn to make gameplay happen.
Like put box on button to activate a windmill that activates a raft (once activated will loop forever) that the player then can use to move cross the water.
That's what i wanna do.
So far ive managed to get the trigger volume to activate the raft to go to its end location, but that's it.
i had a stupid notion that its better to rig models then import them and be able to control them a lot more by using joints.
Sadly it feels like its even more difficult since i don't know if i should treat the prop actor as a character or not.
To me all i want to do is activate the windmill when i hit the trigger volume and then activate the raft to go in a loop back and forth.
Feeling unsure on what's the good practice here.
I have googled and youtubed and tried to find anything in the wiki but there isn't anything on this type blueprinting.
Here are the skeleton meshes i was to activate by a trigger volume.
https://youtu.be/loda5IYKfzoIll gladly take links, explanations, screenshots, feedback and what not.
Thanks in advance.
Replies
For triggering them:
You would probably want reusable actros in your game, so you could make like "interactive bridge" actor that has an "open" and "close" custom event, and some parameters to adjust the motion etc. Then, you could also have a specific trigger volume, that can trigger interactive bridges. You could also have "interactive moving object" class instead of moving bridge one and then from this point its much easier to get correct references to man different actors, but it makes thinking about the base class much harder. Still worth the time thinking about it... So lets say you only made interactive bridge and not a shared base class. Then you would have an actor with the trigger volume, lets say it triggers on overlapping with the player. It should have a variable that is a type of your moving bridge reference. You make it public, so you can edit its value per instance in the level. You place one bridge actor and one of this trigger. You pick (eyedrop icon next to the exposed variable on the details panel) the bridge as the reference in the level. The trigger actor would have an overlap event where it would call open or close even on the bridge. Having the direct reference to the bridge that you picked in the editor per instance would allow you to access those events easily on an instance that you want.
I have a breakdown of such an approach but from what I see now I made it pretty much the other way around, but it doesn't matter, you could do it both ways, check out this thread - second page, after the middle of the page:
http://polycount.com/discussion/157279/the-wonders-of-technical-art-unreal-engine#latest
Hope this helps.
http://polycount.com/discussion/158846/ue4-technical-tutorials-chapter-1-custom-hp-bar-damage-heal#latest
http://polycount.com/discussion/158863/ue4-technical-tutorials-chapter-2-healer-pad-custom-actors-actor-components#latest
http://polycount.com/discussion/160680/ue4-technical-tutorials-chapter-3-usage-of-custom-actors-design#latest
I'm showing some examples of blueprints communication when you don't have direct references because you need to get them at runtime or is unknown.
I have been looking into the sequenser but most ppl seem to be using the matinee for a lot of things. ITs scarce with tuts on the sequenser.
I need of course all those things. i just havent worked on them in that order. i just wanna get going with the puzzles,. and if its fun ill continue else ill do something else.
Il ldo your tuts. maybe something will land :P Thanks again man!
Matinee/Sequencer/Timeline anime - for what you want to use it for, I would definitely go with a timeline and no matinee or sequencer.
I am getting an error in the in the collection parameter, but its due to the fact i havent added any data inside it. what do i add in there? iam getting an direct error on the collection parameter. i think ive done as u done but it does not look it.
And it works. Now how do i reference the bridge bp inside the button bp.
Bridge bp not working but i dont know since i cant trigger it:P
Its just that connection i need.
This way you can set up which button trigger which bridges for example. Or like in my main thread, you can have an array or references so it triggers multiple. There are a couple of images there like this:
http://polycount.com/discussion/157279/the-wonders-of-technical-art-unreal-engine#latest
This does the same thing, its done with using a public array.
parameter collection -> use a simple scalar parameter instead, and you can change its value in bp with "set scalar parameter value" - not the collection one.
If you are still unable to reference it for some reason, I can take a some time into this and make an example tomorrow.
trigger with static mesh that animates looking like a pressed down button thats an bp wich will be moveble anywhere in the game.
Connect that trigger button to the interactive bridge through the variable "interactivebridge" in the trigger button bp referencing the bridge bp.
Starting the timeline animation of "lowering" the bridge down and then stops and stays down.
To me, its easier to maybe do it in the level sequencer, but then i cant rotate the bridge actor cause that seems to mess up the rotation on the pieces of the bridge static mesh making it not play using the transformation values/location values. And besides i just wanna drag and drop 1 actor instead of selecting 3-5 static mesh pieces. anytime.
Good practice is good practice, and its hard learning it.
still on healthbar 1 tut:
I created custom events, Damage & Health. made them into functions, but i cant attach the player reference to the damage and the heal target since it does not accept that playerbp reference connection.
Cast to player
Here there are several cast to, but none named cast to player. i tried using cast to player state but its not working either.
Both of those are criticial to progress, i assume its also shit behind the stick so to speak.
Will continue on with the struggle, google and view the documentation. but its all scrambled and hard getting a clearity on it.
Wanted logic:
- There is the player, it has an integer variable in it that we will want to modify through another actors later.
- There is a trigger, when the player starts overlapping with it, the trigger will call a custom event in a third actor
- There is a third actor that has a custom event to modify the int value in the player - this class isn't necessary, I made it to show better how to make like a chain reaction between different classes, and also to have more examples of blueprints communication in this explanation. This whole thing could be done with just the player and the trigger.
Implementation:
1.
I started with the trird actor that will actually modify the players int value.
This actor has a cube as visual representation, but this is only for demonstration purposes to make the actor visible, its not necessary to do this.
Important - When you want to modify or call something in an actor, you need to have an exact reference to tell it which placed instance to "talk to". To get a reference to the current player ID 0, you can use "get player character". This will return you something that is a "character" class, and its also the locally controller player char. I used a custom player character class, it inherits from character, this is why the cast will work from a "character" class reference, because basically my custom char is a child class of character. So I do get player char -> cast to my own character class, and I store it in a variable, as a reference to the player. Cast to can give you exact references. Input object can be a parent class. I don't really want to talk much more about this now, its a bit more complicated than this when its a random actor with some class, get the basics first.
Since we want to add some integer value to the players integer variable, I also added an integer variable, that is public, so when I place this actor in the level, I can manually set its value. This means I could place 2 of this, and they could add different values to the players int.
On triggered, I print out who triggered it because why not, and then I call "AddToNumber" on the player.
2.
Next step is to make the trigger class that will be able to call the "triggered" event in any triggerable actor. I also wanted to allow this actor to be triggered only by the local player, and nothing else so I again get a reference to the player on event begin play. Its important to note that if you implement respawning and stuff like that, You will need to get new reference on each respawn since the player won't be the same actor anymore.
I added a variable that is a type of my triggerable actor, and made it public, so again, it can be set on the placed instances - hand pick it. Then on the overlap event of the collision volume of this actor, I call if it was the player, it will call "triggered" on the given triggerable actor.
3.
The player...
Not much needs to be explained here, "AddToNumber" event adds the input of the event to the players current integer variable.
Here is the whole thing in action, see the logs from the print string:
https://www.youtube.com/watch?v=dWpUsXjrtc0&feature=youtu.be
Here are the project files:
https://www.dropbox.com/s/a2tffapenkdsihm/ReferencesTutorial.zip?dl=0
Hope this clears out everything. Have fun!
Note - I only implemented "wasd" movement and no turning with the mouse, so don't expect it to work. This is all for demonstrationg communication between different classes.
- event: can be executed over multiple frames, but can't be reused in another classes.
- function: can't be executed over multiple frames, and can't be reused in another classes.
- macro: can be executed over multiple frames, and can be reused (you can have a macro library)
The best one in these blueprints in this tutorial above would be functions because I didn't use delays, nor reusing of the logic. But basically any of these three can work.
Its difficult as hell to be honest.
Here goes.
These are the names i work with.
My custom Player class =PhysicsBallBp
Bp_trigger= ButtonBp
Bp_Triggerable_actor= BridgeBp
warnings: In both buttonbp & bridgebp the cast to PhysicsBallBp gives the warning:
So in Bp_trigger= ButtonBp the cast to is casting to the playerbp (where the movement set up is located) & (in the bridgeBp, the cast node is set up to the playerbp aswell.) I assume this is wrong. Since when i play it, nothing happens when i hit the buttonBp trigger.
As for the rest the most challenging part was getting the correct pins on the nodes.
Again, iam truly grateful for the help and feedback!
When i hit play in the editor, i was blessed with a little special something in the editors output.
Error Blueprint Runtime Error: Accessed None trying to read property ActorToTrigger from function: 'ExecuteUbergraph_Button_Bp' from node: Triggered in graph: EventGraph in object: Button_Bp with description: Accessed None trying to read property ActorToTrigger
So thats my question to you, inside the My custom Player class =PhysicsBallBp
what am i suppose to connect to the "set number" node. thats where its an issue right its not connected.
oh and also from the branch node in buttonbp ive set the
oncomponentbeginoverlap (button, trigger) > branch true > timeline "button pressed down anime" play
oncomponentbeginoverlap (button, trigger) other actor > math equal to > branch
player ref >math equal to
But what am i suppose to connect to the branch false?
When PIE´d. the button disappears totally and the bridge is still static and not triggered. Also I got like 160 "playineditor" errors :P
Theres the button bp, when pressed start timeline animation and then trigger bridge bp .
I think iam a little more bald now but it feels like i just had some really good sex. But better.
Next in line is to make it so i can push a box onto the button and activate it like that.
This was really tricky for me, but it feels i got know blueprinting a helluva lot more now.
I do however get a warning in the button bp.
And thats how i did it.
Hopefully this will clear out this casting a little bit:
https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/CastNodes/
Basically this is necessary when 2 totally different classes wants to access functionality or variables from / in each other. But please read the doc page, it will help.
I have 1 thing i want to add as well to this whole thing and that's to either change material when bridge bp is activated. Cause i have 2 - 3 rolling hoops that have an animated texture. i am considering removing that though just so i dont have to bother with it.
But then i feel like a bitch and don't really want to make anything really suffer due to incompetence from my part. And something i personally love in games, its when its mechanical thingymajigs with several parts reacting to what the player does.
So what i did was that i separated the rolling hoops from the base mesh, the part where the animated parts are attached to.
So i can make either a new bp on the rolling hoop static mesh Or at least reference it.
So i found a tutorial on how to change the material from a non animated one to the animated one.
Made two materials, one not animated and one with the panner node.
and when player presses the button and activates the bridge coming down, i want this to activate as well. but no matter where i connect the animated material node it just sticks with the non animated material.
I can make this change with an event by itself, but since its connected to the bridge animation, i thought it would be best to add the material change the to the bridge bp.
Is it best to just make a bp and then cast to that from the bridge bp.