I’m trying to make a puzzle where the player must complete a task without walking x amount of steps.
Once the variable goes below 0 an event will turn on. I’m not very good at scripting.
Thanks.
Variable subtracting by 1 every time the player takes a step.
● ARCHIVED · READ-ONLY
-
-
@Rinux No one answering in this section of the forum would be asking for money. Paid commissions are exclusively in the Classified section.
Furthermore, this is not even a scripting issue, but pure eventing. It is, however, much easier to set up if you turn things around and set your variable to add.
Set a new variable and name it so that you don't accidentally use it for something else as well.
In the Operand section, click Add, click Constant and type 1 in the box.
Select Game Data
Click on the ... at the end
Select Other and from the drop down menu select Steps.
Now your variable is counting how many steps are being taken.
The next bit requires more information from you about how the whole task thing is set up.
For example, if the task is given by an event, then that event would turn on a parallel process which checks what number that variable has reached. Don't forget to include a 'Wait' command to prevent lag. It doesn't need to check it 60 times a second. There would be a conditional branch in it which specified what happens if the variable equals X.
Completing the task turns that parallel process off. -
@Rinux No one answering in this section of the forum would be asking for money. Paid commissions are exclusively in the Classified section.
Furthermore, this is not even a scripting issue, but pure eventing. It is, however, much easier to set up if you turn things around and set your variable to add.
Set a new variable and name it so that you don't accidentally use it for something else as well.
In the Operand section, click Add, click Constant and type 1 in the box.
Select Game Data
Click on the ... at the end
Select Other and from the drop down menu select Steps.
Now your variable is counting how many steps are being taken.
The next bit requires more information from you about how the whole task thing is set up.
For example, if the task is given by an event, then that event would turn on a parallel process which checks what number that variable has reached. Don't forget to include a 'Wait' command to prevent lag. It doesn't need to check it 60 times a second. There would be a conditional branch in it which specified what happens if the variable equals X.
Completing the task turns that parallel process off.
I'm trying this right now. But for some reason I can't add 1 to the variable and make it count the player's steps at the same time. Does it need two separent events? Is it supposed to say: Control Variables : #0004 Steps Left += Steps? -
Forget it. Solved it.I'm trying this right now. But for some reason I can't add 1 to the variable and make it count the player's steps at the same time. Does it need two separent events? Is it supposed to say: Control Variables : #0004 Steps Left += Steps?
-
Sorry, my bad.
Ignore the bit about adding one, simply choose Steps as what it is checking.
What you will have to do is this.
In the event which gives the quest, have it call the variable before anything else. That way it now knows how many steps the player has already taken.
Set a second variable called e.g. checking steps
In the parallel process have a conditional
Subtract the first conditional from the second.
Nested conditional
Is the second conditional equal to or greater than x
If it is, then do your stuff.
I'm on my phone so can't check anything or be more detailed, but hope that is enough to help.
EDIT
You posted a few seconds ahead of me. Glad to know it's working.