I'm trying to create a harvesting system with an array, I'm close to getting it right but there's still something missing. Currently I can click on plot objects (planting areas) and they get selected, the player goes to the location but doesn't perform any action, just stays still.
Code objective: The player can click on multiple plots (planting areas), which are highlighted with a white effect when selected. The character will perform the harvest in the order of the clicks, completing one action before moving on to the next.
Final Revised Code:
Event 1: Mouse -> Left button clicked on Terra
Conditions:
Terra -> isSelected = 0
Actions:
Terra -> Set animation frame to 1 (shows the effect).
Terra -> Set isSelected to 1.
ActionsArray -> Push back Terra.UID on X axis.
Event 2: System -> Every tick
Conditions:
Player -> isBusy = 0
ActionsArray -> Value at (0, 0, 0) > -1
System -> Pick Terra by UID (ActionsArray.At(0))
Actions:
Player -> Set isBusy to 1.
Player -> Find path to (Terra.X, Terra.Y).
Event 3: Player -> On Pathfinding arrived
Actions:
System -> Wait 1.5 seconds (simulates picking).
Terra -> Set isSelected to 0 (deselects the plot).
Terra -> Set animation frame to 0 (returns to normal frame).
ActionsArray -> Pop front on X axis (removes the processed UID).
Player -> Set isBusy to 0.
I don't know what I'm doing wrong, if anyone can help me I'd appreciate it!