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"

Accessing public bool in different BP

Please excuse me for asking so many questions.

I currently have:

  • BP_Flashlight

  • FirstPersonCharacter (BP)

My FirstPersonCharacter has a key input that toggles the light of the BP_Flashlight. My BP_Flashlight has a Sphere Collision so it can overlap enemies and attract them to the player.

My goal is to set the radius of that Sphere Collision to 0 when the flashlight is off, and to ~340 when the flashlight is toggled on.

My problem seems to be I either can't access the sphere from my FirstPersonCharacter, or I can't access the key press from my BP_Flashlight.

I tried to create a public toggle Bool that would be set in the FirstPersonCharacter, and below you can see in the BP_Flashlight I'm trying to access that bool, but I'm not doing it properly.

I also clumsily attempted to make some form of Interface to utilize another bool that I theorized I could access between the two BPs but it did not pan out.

The warning reads: "First Person Character does not inherit from Sphere Collision (Cast to FPCharacter would always fail).

Any help would be greatly appreciated.

Product Version: UE 4.18
Tags:
more ▼

asked Dec 24 '17 at 10:42 PM in Blueprint Scripting

avatar image

Pachyderm
14 2 3 6

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

1 answer: sort voted first

Hi Pachyderm,

I see you have added your BP_FlashLight as a component to FirstPersonCharacter. You can easily access any public variable that are defined in your BP_FlashLight from your FirstPersonCharacter blueprint as such:

Inside your FirstPersonCharacter Blueprint, on the left in the Components List, click and drag BP_FlashLight into your blueprint. Once it appears there as a variable, click and drag from its output pin and while the dragged line is still there released the click button and a list of options appears. Type the name of your boolean variable (In your case it seems to be FlashLightToggle) and you should be able to access it from there.

Hope this helps.

more ▼

answered Dec 24 '17 at 10:54 PM

avatar image

Vizgin
1.5k 10 10 17

avatar image Pachyderm Dec 24 '17 at 11:15 PM

Thank you so much, works like a charm! :]

(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