Announcement

Collapse
No announcement yet.

Variables communication.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    Originally posted by Fjordhoj View Post
    The Britain, you are my new hero

    It worked like a charm. Thank you very much for your help and explanations, this is going to help a lot.

    I finally seem to understand how it works. This seem to be a system where the activated BP pushes the variables to the next BP edits it through that. 10 mins of fiddling around i was also able to make the opposite system, where the activated BP correctly pulls the variable from another BP and acts on the information it gets. As far as i can tell, these are the only two ways required to handle general variables in every way needed.

    Thank you again

    Problem solved
    I'm glad I could help!

    Please do not ignore Fen's suggestion though. The way I do things is old school, and that's because OOP has been a struggle for me to adopt. OOP is the way to go when it comes to efficiency, speed, and less bug iterations. The way I am doing it uses loops, which is fine, unless you have allot of whatever it is iterating.

    Leave a comment:


  • replied
    The Britain, you are my new hero

    It worked like a charm. Thank you very much for your help and explanations, this is going to help a lot.

    I finally seem to understand how it works. This seem to be a system where the activated BP pushes the variables to the next BP edits it through that. 10 mins of fiddling around i was also able to make the opposite system, where the activated BP correctly pulls the variable from another BP and acts on the information it gets. As far as i can tell, these are the only two ways required to handle general variables in every way needed.

    Thank you again

    Problem solved

    Leave a comment:


  • replied
    Thank you for the replies, and thank you for the Blueprint example Britain.
    Can't wait to try the method out, to see if it's the magic solution, but it sure looks promising.
    Calling it ID instead is of course the obvious solution, should have thought of that myself

    Got home late. So don't have time to work on it this evening, but will most certainly try your ideas when i have the time.
    Hopefully i do tomorrow.

    Leave a comment:


  • replied
    Originally posted by Fen View Post
    Hello,
    @TheBritain : By setting a ref on event begin play you'll not have to loop

    @Fjordhoj : The error with "dor" in construction script is that your variable "fra las"... is not set. You have to set a variable to be able to use it.
    I know loops are generally bad, just call me old school lol. I will still leave my example in case he ever needs to know how to do that as well.

    Leave a comment:


  • replied
    Something like this perhaps.

    Click image for larger version

Name:	examp.png
Views:	1
Size:	272.9 KB
ID:	1066201

    Leave a comment:


  • replied
    Hello,
    @TheBritain : By setting a ref on event begin play you'll not have to loop

    @Fjordhoj : The error with "dor" in construction script is that your variable "fra las"... is not set. You have to set a variable to be able to use it.

    Leave a comment:


  • replied
    Originally posted by Fjordhoj View Post
    Hi Britain

    I will try and work from your link when i get home, it certainly looks like it's going to get it going in the right direction.

    Yes, it consists of 2 switches, and 2 doors, and the key is just a variable that change when certain events occur, nothing more than that
    If it were me, I would make a variable called ID on a door blueprint. I would also make a variable called KEY on a switch blueprint. Then when you press the switch, have it loop through all doors, and if it finds one with an ID that matches the switch KEY, do something. In this way, you only need one Door blueprint and one switch blueprint. I can make an example if that is confusing.

    Leave a comment:


  • replied
    Hi Britain

    I will try and work from your link when i get home, it certainly looks like it's going to get it going in the right direction.

    Yes, it consists of 2 switches, and 2 doors, and the key is just a variable that change when certain events occur, nothing more than that

    Leave a comment:


  • replied
    Let's go back to the basics for a moment, so I can better understand you problem. First, you said you had problems communicating with other blueprints. Have you read this?

    https://docs.unrealengine.com/latest...nts/index.html

    Next, from what I gather, you are trying to use 2 switches to open 2 different doors, and from what I gather, there might be a key involved?

    Leave a comment:


  • replied
    Thank you for the reply

    I deleted the two, and didnt add anytthing. However now i get an error saying: "Error Accessed None 'Fra LåsBP' from node 'Construction Script' in blueprint 'GItterN'"

    But the construction script is empty?

    Leave a comment:


  • replied
    In your construction script blueprint you are setting the "DorNr." variable to itself, which is not necessary. You should be setting a value to the "DorNR." variable instead.

    If you modify this value from the details panel in editor, then you can just remove the Set node and the variable, since it will be set automatically. So you either want to set it to the value of some other variable, or just remove those 2 nodes from the contruction script and the error should go away.

    Hope that helps, let me know if you need more info.

    Leave a comment:


  • replied
    Although above statements say "You just do this and that" and "thats easy and simple " time has flown by, and this is my closest result (i think) so far.

    However i get an error based on the construct script, where i assign an integer individually to each door.

    Click image for larger version

Name:	1.jpg
Views:	1
Size:	97.0 KB
ID:	1066188

    Click image for larger version

Name:	2.jpg
Views:	1
Size:	136.2 KB
ID:	1066189

    Click image for larger version

Name:	3.jpg
Views:	1
Size:	72.0 KB
ID:	1066190

    Click image for larger version

Name:	4.jpg
Views:	1
Size:	167.8 KB
ID:	1066191

    Lås = Lock, Gitter = Door.

    Please supply a blueprint if you have the 5 mins it takes for you to make it, or if i do any blatant errors, please point them out :-)

    Leave a comment:


  • replied
    Yea casting to other actors to change and get public variables is a really easy, and simple soulution. Another thing I usually do is create custom events and call them in other blueprints via casting to them.

    Leave a comment:


  • replied
    Without getting into getters and setters (which I generally don't use for variable heavy games), I normally like to cast my other actors during begin play, and then reference their public variables. For variables that are generally global, and need to access allot, I put them on a level settings object that inherits from a base settings object, then I just loop to cast that. I am sure someone more verse with Unreal has a better way, but this is how I get by.

    Leave a comment:


  • started a topic Variables communication.

    Variables communication.

    Hi everyone.

    I have been watching videos, reading tutorials and old fashion trial and error for +3 hours now and still can't seem to figure out what should be a relatively simple problem.
    I have trouble figuring out how variable communication between blueprints work.
    There doesn't seem to be one best use of practice on how this works, and therefore it seems that all tutorials go about it in different ways.
    The problem is more complex than below, but i have simplified it for the understanding.


    I have two instances of a blueprint with a simple switch (SW 1 and 2)
    I have two instances of a door blueprint (DR 1 and 2)
    I have a variable designating the level of the key Var1
    Var1 is also used for other things, so i want it to be easy accessed with as few steps as possible.

    SW 1 opens DR 1 when Var1 > 1
    SW 2 opens DR 2 when Var1 > 2

    What is the best way to handle this variable (And variables in general)
    Do i store them in the player BP, the level BP or do i create a new BP designated for all variables (Like a variable inventory bag)?

    Can blueprints trade variable information directly, or do they have to come across the level BP?

    I imagine the Var1 as an integer, and then having an array of booleans for each number of instanced doors. How do i make it so that DR 1 is relying on bool1, DR 2 on bool 2 and so on. (As in differentiating instances BP from one another)

    I hope you can help, as this is a HUGE frustration, and with so much relying on variables it really hinders me a lot.
    If it's not asking to much, can you please also illustrate with a simple setup also, on exactly how you would approach this problem.

    Click image for larger version

Name:	Help.jpg
Views:	1
Size:	59.3 KB
ID:	1143926

    All help is greatly appreciated :-)

    Cheers
Working...
X