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

0 favourites
  • 5 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • .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.

    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.

    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.

    [Is HOURS = to (whatever the return number hour is)]

    [ 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!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • :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!

  • 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'.

  • 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

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)