So time is giving me the run around. I just dont seem to understand what Its changing/What its asking.
Essentially Im trying to add days of the week, The inital issue was having to reset the week to allow the Map to function or itd return null. Which if your adjusting day directly. Does work fine.
The problem is you adjust it by minutes or hours, it does adjust the days but not the days int. They eventually break the system and it returns the map as null even if the Int is correct to run it.
Which I thought would be the same? But it seems to run in the background regardless of the foreground.
So green print is recording days. red print is also recording days.
But they are coming back as different ints?! Im baffled.
I feel like Im really close but I just cant figure it out and there must be an easier way to assign the named days of the week without all this faffing.
In green, you are printing your integer Day variable.
In red, you are printing the Day portion of your timespan variable (whatever it is called).
Those are two different, unrelated, variables. When you add time to the timespan it won’t magically update your “Day” variable. And when you change your “Day” variable it won’t update the timespan variable either.
If you want to get day of the week from the Timespan variable, assuming your “world” always starts on Monday, use modulo (%) operator instead. Timespan Days / 7 = numbers of weeks that passed Timespan Days % 7 = division remainder = current day of week.
Hey Folks, Sorry Ive only just managed to get back to my desk. pheww what a week.
Interesting to see the words datetime appear as Another message I received also has mentioned that I should be using datetime rather than Timespan since ive been gone.
As far as I understand now, Timespan is a duration measurement not a measurement of actual time.
So itd make sense youd use timespan to update datetime.
Super interesting!
Ok yeah this makes sense. Ive defo been Understanding this wrong.
Im going to look into date time and better understand exactly what the heck Im doing.
I cant thank you folks enough. It really really helps understanding processes from the vets.
Im going to get cracking in some tutorials etc and have a good look over your guys examples.
Thanks again
edit also I should of shown the first bit as well.
This is why I was getting the day variable.
Ooh you are creating the timespan dynamically from the other variables, I thought it was its own variable.
My comment is wrong then.
Using datetime might be more suited for what you’re trying to achieve, but if your world always start on Monday and if you don’t really care about months/years then timespan should be fine as well. It’s still important to understand what’s going on and why your logic isn’t working.
With what you provided I can’t really explain the logs you’re seeing. Days variable being always zero makes sense if you’re never updating/incrementing it. Then that means you somehow have 14 days worth of hours/minutes, and you are counting backwards? That’s the only sensible explanation I have atm.
I think you guys are defo correct, theres some voodoo going on.
Ive swapped to date time, which works beautifully to display the time etc and it seems to function. But now Im having an issue adjusting the Date time depending what happens in the game.
Essentially I made the DateTime a variable and went to adjust it using + Nodes adjusting it with another 2 hour datetime node. But it keeps throwing me this.
I pulled 2 datetimes out to see If I could even get them to play but its not wanting it.
I just want to add 2 hours to the time per something done in game.
Regarding your initial situation, I believe you could have solved it by simply updating your variables with whatever the Timespan converted them into.
For example, you feed Days=0 Hours=240 Minutes=75 into the Make Timespan node, and the engine converts them into “proper” values, ie: Days=10 Hours=1 Minutes=15
So if you take the result of the timespan structure and put it back into your variables then the logic checks out :
Now even though the logic checks out, it will not work for a different reason (blueprints voodoo), and that’s why using a single datetime or timespan variable is a much better solution here.
How did you get that node lol I had my for each loop node vanish and had to copy paste it from another project entirely but I couldnt find it anywhere.
I cant figure out how to get the Datetime+datetime node to appear.
Wierd. Ive had some brain melters in unreal but Sorting out something I thought would be simple has absolutly ruined me
Im actually missing loads of nodes. Dont have any of these ones. Looks like its a known bug…Urghhhhh Well thats a project to a screeching Halt. What an annoyance.