Hey whats up everyone!
i would like to request a script which allow the player to do different things according to some conditions.
here is an explanation of the script:
alright you talk to a monster and he will attack you then a picture should come on the screen with the letter you should press to avoid the attack but if you don't press the button in time then you can set something else to happen.
so its like this i should be able to write like a code in the event to let it start the count with how much time i want to run down then if i press the button i choose in the line of code then it will continue what is in the event but if not then you get game over.
You can do that with events. It should be less complicated. Use a few parallel process (maybe even just one?) where you set a variable to a specific amount, then use the parallel process to determine if the player has pressed the button before the time has run out. If not, "something else" happens. Trust me, it is much easier to make this with events than with a script. I have planned a minigame for my game where you have to press the buttons that appear on the screen so I already thought about this problem. A script is a possible solution, but not the best one.
Well Blizzard thats easy to say for you!
i know nothing about VARIABLES!
but the parallel process and switches i can do.
One event command...Button Input Processing. Or something like that (Don't remember the name since I don't have XP on this computer). What that command does is according to the button the player presses it'll record it onto a variable. Say if the A button (Being the space bar and etc. I think) was worth 15 (Which is a close approximation to what the value is), it'll be recorded onto that variable you chose. Each button has a certain number assigned to it in Button Input Processing, and it's up to you to find that button number.
Now the variable issue itself, it's really easy. It's kind of similar to algebra, but not so really. All you need to do is find the variable value of that button, make a conditional branch on that variable being equal to the variable button value pressed and voila, you can get the end result.
Here's an easier more visual style:
Button Input Processing on Variable 0001
Conditional Branch: If Variable 0001 = 15 (15 is going to be that approximation number for accept)
Do whatever
-----
The button input processing notices the player pressing the button that uses 15, and if so then it'll modify the variable to that number...Hope it's understandable... :^_^':
Oh i get the picture!
when i use the button input to A i will set a number to it!
then i will make a variable with that number inside a conditional branch.
so when i press A then it will run the things i want.
what about the timer?
I'm assuming this off the top of my head and that's to use an In-Game Timer. In eventing, you should know where that is. Now, hide the clock, set a certain time. When you want to trigger the consequence, make sure the seconds is below 0-1 on a new page, and then stop the timer there and go for the punishments of not pressing the button
This is probably not the most optimal solution, but I'm pretty sure it works. Just off the top of my mind, as usual. :)
Variables are as simple as switches. Switches only have 2 states while variables can technically have infinite. Instead of true/false (1/0) you have all possible numbers.
EDIT: The code would be something like:
if variable > 0
(optional)show_picture(for_this_button)
variable -= 1
if pressed(the_right_button)
(optional)erase_picture(for_this_button)
make_sound(the_one_when_you_succeeded)
turn_on_switch(the_one_when_you_succeeded)
turn_off_switch(the_one_that_runs_this_parallel_process)
end
else
(optional)erase_picture(for_this_button)
make_sound(the_one_when_you_failed)
turn_on_switch(the_one_when_you_failed)
turn_off_switch(the_one_that_runs_this_parallel_process)
end
Use one switch for each button you have and one parallel process common event. When you want a button to be triggered simply activate its switch and set the variable as timer. 20 frames are 1 second in events. i.e. If you set the variable to 40, the player has 2 seconds to respond. Don't forget you need 1 variable, 2 switches (for fail/succeed for later processing) and as many switches and common events as the number of buttons you use. In the end you can just use a parallel process on the map that checks which of the 2 special switches has been triggered (fail or succeed) and make the appropriate actions.
:knight:
Thanks i will try that! :^_^':