How to pause during a while
HugoXandre
23 Feb 2016, 21:30I have a while health > 0 for a battle function. I does infinite battle during player and enemy have health > 0
But I need make a pause for each round. Something like that:
The fact is that if I use wait { battle } function, Quest gives and error about ONLY ONE WAIT FUNCTION EVERYTIME
so.. what can I do?? Thanks
sorry english, not my first languaje.
But I need make a pause for each round. Something like that:
while player.health > 0 and enemy.health > 0
{
player attacks
enemy.health = enemy.health - player.attack
**NEED TO MAKE A PAUSE HERE **
enemy attacks
player.health = player.health - enemy.attack
**NEED TO MAKE ANOTHER PAUSE HERE **
}
The fact is that if I use wait { battle } function, Quest gives and error about ONLY ONE WAIT FUNCTION EVERYTIME
so.. what can I do?? Thanks
sorry english, not my first languaje.
The Pixie
23 Feb 2016, 22:15The general problem is described here:
viewtopic.php?f=10&t=5661&p=38966
The standard way to approach this in Quest is to have the player type a command to make a single attack.
>ATTACK ORC
You swing your blade at the orc and do 5 hits
The orc is attacking you; it tries to bit and misses.
Each command is one "turn", and the script for that command first handles the player attack (and whether the enemy is dead), then handles the enemy attack (and whether the player is dead) (in fact the second half might be better in a turnscript).
By the way, if you are working off-line, you might want to look at this:
viewtopic.php?f=18&t=5976
viewtopic.php?f=10&t=5661&p=38966
The standard way to approach this in Quest is to have the player type a command to make a single attack.
>ATTACK ORC
You swing your blade at the orc and do 5 hits
The orc is attacking you; it tries to bit and misses.
Each command is one "turn", and the script for that command first handles the player attack (and whether the enemy is dead), then handles the enemy attack (and whether the player is dead) (in fact the second half might be better in a turnscript).
By the way, if you are working off-line, you might want to look at this:
viewtopic.php?f=18&t=5976
HegemonKhan
23 Feb 2016, 22:18Unfortunately, in quest and for its 'while' loops, I don't think you can pause it, sadly.
that said though, I'm a code noob and quest code noob still, some of the good coders who also know quest coding well, may know of ways to do this, so wait for their authoritative posts on this matter.
------
you can also take a look at my combat code, at least for ideas (if you can't or don't want to or don't understand it enough to use):
viewtopic.php?f=10&t=3348&start=120#p22483
(scroll down to my next post also, as it has the key/legend for all of my annoying abrevs)
and there's of course Pixie's and Pertex' Combat Libraries too, to look at and/or use: look in the 'libraries and code samples' forum board for them.
that said though, I'm a code noob and quest code noob still, some of the good coders who also know quest coding well, may know of ways to do this, so wait for their authoritative posts on this matter.
------
you can also take a look at my combat code, at least for ideas (if you can't or don't want to or don't understand it enough to use):
viewtopic.php?f=10&t=3348&start=120#p22483
(scroll down to my next post also, as it has the key/legend for all of my annoying abrevs)
and there's of course Pixie's and Pertex' Combat Libraries too, to look at and/or use: look in the 'libraries and code samples' forum board for them.
HugoXandre
24 Feb 2016, 08:39The Pixie wrote:
The standard way to approach this in Quest is to have the player type a command to make a single attack.
>ATTACK ORC
You swing your blade at the orc and do 5 hits
The orc is attacking you; it tries to bit and misses.
Each command is one "turn", and the script for that command first handles the player attack (and whether the enemy is dead), then handles the enemy attack (and whether the player is dead) (in fact the second half might be better in a turnscript).
That works! I only had to eliminate the while in the attack function and add the verb attack to the enemy object.
Thanks!