Charas-Project
Game Creation => Requests => Tutorials => Topic started by: zuhane1 on June 14, 2007, 01:18:55 PM
-
Right, since my default battle system Paper-Mario-styled-battle didn't work at all, I'm working on a new idea. The battle are using character sets on a map, an auto-start event will control the whole battle. The idea is that a number flashes up and you have about a second to press it, if you press it, you attack, if you don't press the right number or leave it too late, then you don't attack.
The same goes for dodging, press the correct number in time and dodge an enemy attack. This is all working fine (obviously I haven't finished the coding. But there is one problem, I am terrible with timers. What timer coding could I put in and where to make you not attack if the time runs out? Please help! If this works we will have a game like Paper Mario and I will unleash a demo and you can all copy the coding and have nice Paper-Marioey type games!
Here's the first half of my coding:
[img=http://img2.freeimagehosting.net/uploads/th.f1510b0f07.jpg] (http://img2.freeimagehosting.net/image.php?f1510b0f07.jpg)
-
Ok first off though, instead of making that an autostart event on he map, make it a 'call triggered' common event. And on the map, just call that common event. This way if you decided to change your battle system later, you won't have to recode every battle, just edit the one code in the common events.
I don't recomend using timers, make a second 'parallel process' event, (again, i'd put it in the common events). Make it triggered by a switch.
Make it look something like this.
Turn [switch - timer] ON
wait 1.0 seconds
Turn [switch- timer] OFF
So basically all this event does is turn a swtich on for one second and then back off.
Now in your other event, make a variable command that makes a random number between 1 and 9. Set it equal to a variable called [random]. Place a label [1] here, After that, make a key input process, and check the box for numbers and uncheck every other box. Lets call the variable in the key input process [input].
Make a conditional branch for if [input] is equal to [random] (also make an else case for this one to display a miss message or something if you miss, and turn a switch [pressed key] ON.
Inside the regualar part of your conditional branch, make another branch for if [switch - timer] is ON. And in THAT conidtinal branch make your attack.
After everything so far, make another conditinal branch for if [pressed key] is OFF. In that branch, make another for if [switch timer] is ON. And in that conditional branch make a wait 0.0 second command and then jump to label 1.
After that conditional branch, turn the switch [pressed key] OFF.
So in the end, it should look like this.
************************
Variable options [random] = random number between 1 and 9
Label 1
Key input process [input]
IF [input] = [random]
- IF [switch - timer] is ON
-- {attack code}
- End
Else
- Turn [pressed key] ON
End
If [pressed key] is OFF
- If [switch - timer] is ON
-- wait 0.0 seconds
-- Jump to label 1
-end
end
Turn switch [pressed key] OFF
******************
-
You are a genius. I'm gonna give this a shot and come back to you if I'm still having trouble, thanks.
-
Right, I think I've copied it okay but it's still not working. Please help! Just click the attachment.
;)
-
Exactly how isn't it working? Cuz the problem I see with it right now is that you turn the switch 'timer on' on after the loop, so that switch will always be on and thus it's not gonna wait a second, its gonna be held up in that loop forever until a key is pressed.
Anyway, instead of having that switch on, turn a differant swtich on that turns the parallel process event on that handles the
Turn [switch - timer] ON
wait 1.0 seconds
Turn [switch- timer] OFF
stuff.
If thats not wrong with it, i'll test it through and see whats up.
-
I've tried so many things, but I don't think I'm good enough so I'm giving up on it. Thanks anyway.