How do I get one number variable to read anothers value?

Get help using Construct 2

Post » Tue Aug 23, 2016 1:10 am

.capx at the bottom
Let me elaborate, I need one number variable to see if another variable equals itself. I have a time system set up through number variables and "Every X seconds.." events, and another set of variables that work alongside a Slider.

Image

The Hour number is simply a text box that is changing to whatever the value is of the slider. But whenever the player clicks Go, it will record the Hour to a number variable and the AM/PM to a text variable.

Image

I have an NPC that you can send away to scavenge, you can use the slider to set the hour he comes back for and you can click the AM/PM to toggle it to set what time of day he comes back. When you click go he uses pathfinding to leave the counter and go somewhere outside of the players view, when he arrives at his destination he finds a path back to the counter. He won't move along this path until the Hours and PM in the time system matches what the player set from the Slider.

Image
Image [Is HOURS = to (whatever the return number hour is)]
Image [ Is AM/PM = to (whatever the return text AM/PM is)]

I know this may appear confusing and unorganized, so here is a .capx to help. http://goo.gl/ErFiFZ The NPC event sheet is 'Colonists' and the time system is within the 'HUD' sheet. (It's not dropbox, but just click the downward point arrow in the top right corner to download it)

Thanks in advance!
----------

If you need a hand with anything, just drop me a PM.
B
8
S
2
Posts: 29
Reputation: 560

Post » Tue Aug 23, 2016 7:21 am

:BUMP:
Just to be clear, the above images and big explanation is just what I tried but didn't work; any help would be greatly appreciated!
----------

If you need a hand with anything, just drop me a PM.
B
8
S
2
Posts: 29
Reputation: 560

Post » Tue Aug 23, 2016 10:51 am

Suppose 'ampm' = "PM"

So ...

If 'scavengerreturnAMPM' = "PM" it sets it to "AM"
Now it is "AM" and the next condtion is true, and it will always be true.
In that next condition it always sets the 'scavengerreturnAMPM' = "PM"

Next tick 'scavengerreturnAMPM' = "PM", and is always "PM"
And it starts all over.

Need to use 'else'.
B
33
S
18
G
27
Posts: 2,447
Reputation: 20,358

Post » Tue Aug 23, 2016 11:23 am

I'm sorry, but I don't fully understand what you just did there. The only problem that I'm having is that the NPC will walk away like it's supposed, and then wait for whatever time the player sets to return and then return.

So if the player sets 7 AM, and it is 5 AM, the NPC will wander off; but when the time system hits 7 AM I want it come back. As far as I know the above events should work, putting it basicly: I want my NPC to read when the Time Hour and AM/PM is equal to what the Scavenge Return Hour and AM/PM is.

Is TimeHour = to ScavengeReturnHour?
Is TimeAM/PM = ScavengeReturnAMPM, if true: NPC|MoveAlongPath
----------

If you need a hand with anything, just drop me a PM.
B
8
S
2
Posts: 29
Reputation: 560

Post » Tue Aug 23, 2016 12:44 pm

So it seems to been a problem with pathfinding after all, when it arrived at the outside waypoint it would neverendingly calculate paths back inside without being able to move along them because they were indefinitely changing.
----------

If you need a hand with anything, just drop me a PM.
B
8
S
2
Posts: 29
Reputation: 560


Return to How do I....?

Who is online

Users browsing this forum: jkmalau and 16 guests