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"

If Variable, Stop?

I am setting a float variable to some number and I want it to be attached to the Yaw module on the MakeRot node. This value will give the light a rotation to make it day or night, rather than the day or night be set to a cycle.

alt text

I want the cycle to run unless unless the float variable is set to a number. Then instead the time of day will be set to day or night. However when I try to implement this to the given blueprint, my day or night flickers as if it is not just being set but is being updated horrifically.

How can I keep the cycle, but if I choose a value to be updated, the Yaw will ignore the SunSpeed * Delta Seconds and will just set to the given rotation value, giving it a paused effect at either day or night?

If I could find a way for the cycle to run until the set value is achieved by the MakeRot, and stop, I would do that also.

Product Version: UE 4.9
more ▼

asked Dec 16 '15 at 10:42 PM in Blueprint Scripting

avatar image

170 47 49 60

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

3 answers: sort voted first

I found that it was connecting an EventTick just makes it so when setting Day or Night some part of the construction will occur as many times as tick occurs. There was a way to get both working but not both in the same construction.

I eventually found a construction that worked. alt text

I tried all sorts of combinations but it wasn't until I set both casts of the gameInstance BP that held the boolean and S value for yaw to the same branch, set each cast to something different (EventTick & EventBeginPlay), and added a node to stop the set Nighttime from flickering due to how EventTick was coded into the sequence of nodes (it would affect both if I didn't set it up without the Do Once, which I messed up the boolean for --> start closed is not the same as a branch boolean, lol).

Thank you for your help, definitely got me to learn some new nodes such as switch which is very useful and this all got me to a better sequence of nodes involving just one branch. I never like putting one sequence of nodes to both EventTick and EventBeginPlay, just kinda messy, but thanks!

1.png (158.5 kB)
more ▼

answered Dec 17 '15 at 11:09 PM

avatar image

170 47 49 60

avatar image Wicked Dec 18 '15 at 10:48 PM

I still don't understand why you are casting from eventbeginplay and then eventick, since anything you cast from eventtick is going to immediately overwrite eventbeginplay, because its constantly fired where beginplay is 1 time and its the first thing fired. I don't feel like you need eventbeginplay unless you are using it to declare a variable at the start of the game?

avatar image Wicked Dec 18 '15 at 10:53 PM

I set these up hopefully to help simply your equation, If I understand what your trying to accomplish. Its hard when you cant see the full picture of what your trying to do but hopefully they will at least be of some additional help to you. Obviously you will want to substitute my mesh components for your own. I still felt like Set was what you want to use but incase it isn't I included the Add.

This one uses set rotation nmm131-2 photo nmm131-2_zpsbn6mb2rv.png

This one uses add rotation nmm131-3 photo nmm131-3_zpsvwiegyyg.png

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

Hi nmm131,

The node you are looking for is "Set Actor Tick Enabled". This will allow you to determine when the tick is firing. What you can do is have a branch that checks if the value you are checking is == to the set value to stop. If true, run "Set actor tick enabled" and set it to false, this will freeze your tick so it doesn't continue running while you are trying toupdate the day/night cycle differently.

alt text

tickenabled.png (18.8 kB)
more ▼

answered Dec 17 '15 at 07:03 PM

avatar image nmm131 Dec 17 '15 at 08:37 PM

It fixed my problem real quick, however it disallows my emitter from updating its position with EventTick.

How can I set up the target of SetActorTickEnabled to just change the tick of my day/night cycle?

avatar image Adam Davis STAFF Dec 17 '15 at 09:10 PM

Use a timer instead of tick and then simply use the pause timer by function name node. You can set the timer to an extremely low value to come close to tick without having the day/night cycle act as framerate dependent. This would also allow you to continue using tick for other functions without interrupting it. Another Alternative would be to have a sequence that contains each set of functionality. Any functionality you want to stop put a branch in front of it. When you reach the desired value, set the bool to false so that it cannot continue running but does not affect the tick's flow.

avatar image nmm131 Dec 17 '15 at 09:13 PM

Could you show me how to integrate that type of node into the bp listed above? I do not have pause timer by function name node.

So a timer would act as delta seconds, being a measurement of a tick (or close to, as you describe)? What type of timer?

avatar image nmm131 Dec 17 '15 at 09:34 PM

Is it possible to remove the SetActorTickEnabled or to disable it with another node? The target on SetActorTickEnabled is useless to me since promoting the target to a variable just sets it to actor. My cycle does not really have a target except light source and sky sphere and those wouldn't work.

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

Use a select float, and a make literal bool. This will select the float you want to use based off your variable conditions.

 photo nmm131Solution_zpsbbj2io9y.png

more ▼

answered Dec 17 '15 at 09:37 PM

avatar image

106 13 22 23

avatar image nmm131 Dec 17 '15 at 09:48 PM

That allows for my other EventTick nodes to work along with my set day or night. My cycle will not work though. Is there a way to set A to EventTick and B to EventBeginPlay depending on the value of the boolean? True & False?

B (boolean) is set to checked when the S value, or in select node the B value is not set. So when B boolean is being set along with S value, which plugs into B on select node, B will remain unchecked and B will be picked and give the correct pitch to change day or night. However it will flicker from daylight to whatever int value is picked.

CastToMyGameInstance holds all the variables for use, as they are being set outside the bp. It is connected to an EventBeginPlay.

avatar image nmm131 Dec 17 '15 at 10:14 PM

How come this makes my day/night flicker when B is being picked? This is the only flaw I have with the select node:

alt text

1.png (216.5 kB)
avatar image Wicked Dec 17 '15 at 10:17 PM

"I want the cycle to run unless unless the float variable is set to a number"

I'm assuming this is being set by beginplay? Or is this sunspeed? the formula above I created based off the assumption that the float variable you referenced was sun speed.

"Is there a way to set A to EventTick and B to EventBeginPlay depending on the value of the boolean? True & False?"

If you create a variable that is updated on eventbeginplay and eventtick, you can use that as the select bool. If thats what you mean?

avatar image nmm131 Dec 17 '15 at 10:19 PM

Well SunSpeed * Delta Seconds changes the Yaw to create the cycle. When I drag in the S variable from MyGameInstance it acts as, say 0 degrees yaw or -135 degrees yaw for a set day / night as opposed to a cycle.

SunSpeed will just alter the length of one cycle. Everything works, the cycle and setting the day or night. However when it is set to just day or night, the night flickers (starts at night, flickers to day then back to night in a millisecond, & will not stop) like if it were being set multiple times.

avatar image Wicked Dec 18 '15 at 05:24 AM

Have you debugged it? To see if any of the variables are changing when they shouldnt be?

avatar image nmm131 Dec 17 '15 at 10:25 PM

Everything from MyGameInstance (Boolean "B" and Float "S") is being set in the event graph of a widget inside a separate level.

avatar image Wicked Dec 17 '15 at 10:27 PM

This may not be related to the issue but I have had strange things happen when I've ran a large amount of sequences off event tick.

avatar image nmm131 Dec 17 '15 at 10:34 PM

I was mistaken. The CastToMyGameInstance was hooked up to EventTick, I changed it to EventBeginPlay and my day/night had no problem with flickering. However my cycle would not begin. I start the game without having S or B SET, the default values are 0 and checked. So until I set S and B in the other level, the day/night won't enact, it should start with the cycle but it is not for some reason.

avatar image Wicked Dec 17 '15 at 10:39 PM

Thats because in your screen shot it looks like If b is checked then you are selecting to use S which is 0. So you are adding no rotation at all. You can either switch a and b or use a NOT boolean instead of = for B, I have to run I will be back in an hour or two and I will check back.

avatar image nmm131 Dec 17 '15 at 10:44 PM

B boolean is automatically set to checked every time unless I change it in the separate level, which is when S is set a value as well.

I am reading that if boolean is checked, which it is always until set to unchecked from separate bp, then pick the value A which is set to SunSpeed * Delta Seconds.

avatar image Wicked Dec 17 '15 at 10:31 PM

I figured out your problem, AddLocalRotation is constant. If you want the sun to stay in a specific spot you need to SetRotation.

avatar image nmm131 Dec 17 '15 at 10:37 PM

If I have either the cycle or the S variable (without eventTick delta seconds * sunSpeed) plugged into MakeRot --> Yaw plugged into -->AddActorLocation --> UpdateSunDirection they both will work separately. I don't have SetLocalRotation

I have SetActorRotation which doesn't work.

avatar image Wicked Dec 17 '15 at 10:44 PM

If I remember correctly placing any number into AddRotation will cause it to continue adding that rotation. Where as SetRotation sets it to a specific point. One is dynamic and one is static.

avatar image nmm131 Dec 17 '15 at 10:55 PM

I put in a number for yaw and because it was hooked to an EvenTick, it kept going haywire.

I tried using a DoOnce however my cycle worked and my day/night did not.

alt text

1.png (209.4 kB)
(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