So, in all places where you turn on switch 4, add these commands:
Code:
Control Variables: Chicken Saved Steps = Game Data > Other > Steps
Control Variables: Chicken Current Steps = Gam Data > Other > Steps
When you want to change the number of steps required, either set a variable for it within an event, or have a parallel process event set up on the map just for this purpose, with the following:
Code:
Control Variables: Chicken Steps Required = 250
Erase Event
When you first get the chicken, if this variable hasn't already been set, you will need to set it, so it knows how many steps to start off with.
Now make your common event like this:
Code:
Wait 10 Frames
Control Variables: Chicken Current Steps = Game Data > Other > Player Steps
Control Variables: Chicken Current Steps -= Chicken Saved Steps
If: Chicken Current Steps >= Chicken Steps Required
Control Variables: Chicken Saved Steps = Game Data > Other > Player Steps
Control Variables: Pickup Reward = Random 1..100
If: Pickup Reward <= 50
Control Variables: Gold from Pickup = Random 5..50
Text: You found \v[x] gold! (x is the variable id for Gold from Pickup)
Change Gold = Gold from Pickup
Else
If: Pickup Reward <= 80
Text: You found a small potion!
Change Items + Small Potion
Else
If: Pickup Reward <= 90
Text: You found a medium potion!
Change Items + Medium Potion
Else
If: Pickup Reward <= 95
Text: You found a rare artifact!
Change Items + Rare Artifact
Else
Text: You found a large potion!
Change Items + Large Potion
End
End
End
End
End
I note that your common event is conditioned by switch 4, which means you've fed the chicken. This means if you're indoors and the chicken is fed, it will find stuff inside houses as well as outside. If that's what you want to happen, it's all good. If it's not though, you'll want to condition your common event by a different switch, and put that code above that initializes the step counters wherever THAT switch is turned on, rather than where switch 4 is turned on.