Here's what i'm trying to do (I'm using Dan's turn-based engine):
In my game, whenever a player goes up to another player and uses the "Duel" verb, they start a two-player turn-based battle. My problem is, they don't do the same thing each turn. Let me show you a little deeper what I want to do:
One player will go first. This player chooses an attack. After that, the next player chooses a defense. Then the damage is done, depending on the attack and defense chosen. So, how could I have the defender choose a defense on his turn, instead of doing the same as the attacker?
Thank you in advance.
ID:180577
May 12 2001, 12:02 pm
|
|
In response to Deadron
|
|
It sounds like you just need to track who is the attacker and who is the defender, and base their options on that. I think you have the right idea. I'll try putting it in steps: 1. A player starts a duel with another player. 2. The first player's turn starts. 3. The first player chooses an attack. 4. The second player's turn starts. 5. The second player chooses a defense to the first player's attack. 6. Damage is dealt to the defender, dependant upon the attack and defense chosen and my formulas. 7. If the defender survives the attack, it becomes his turn to attack... And it goes on from there. It's kinda hard to word it, but I need to know how to make the attacker's turn different from the defender's turn, because in the code, BeginTurn() is always the same. I hope you got it. Thank you. |
In response to Cinnom
|
|
On 5/12/01 7:05 pm Cinnom wrote:
It sounds like you just need to track who is the attacker and who is the defender, and base their options on that. Okay this is a good list. Now here is the key to solving this: you have the ability to track any information you want. You can even add stuff to Dan's turn library to make it work... So, for example, you could choose to add an attribute to mobs like so: mob var duel_status // "attacker" or "defender" mob/dueling_partner // The person I'm dueling, if anyone Then when a player starts a duel, set that player's duel_status to "attacker" and their dueling_partner to the other mob. At the same time, set the other player's dueling status to "defender" and their dueling partner to the attacker. Then you can provide options based on the dueling status. This is only one possible way, and others might work better for you...the important thing is to realize that you can track anything you want here by adding attributes to the mobs and objects. |
In response to Deadron
|
|
Okay this is a good list. Now here is the key to solving this: you have the ability to track any information you want. You can even add stuff to Dan's turn library to make it work... I tried something similar to this before, and there's a small problem. The variables I need are local under mob, and the BeginTurn() proc is global. So BeginTurn() can't access those variables... What can I do about that? Thanks. |
In response to Cinnom
|
|
On 5/13/01 4:41 pm Cinnom wrote:
I tried something similar to this before, and there's a small problem. The variables I need are local under mob, and the BeginTurn() proc is global. So BeginTurn() can't access those variables... What can I do about that? Thanks. Sure it can. As long as you have a variable pointing to the mob you can access the mob's variables. If your variable is called my_mob, then you access its variables this way: if (my_mob.dueling_status == "attacker") |
In response to Deadron
|
|
On 5/13/01 6:16 pm Deadron wrote:
On 5/13/01 4:41 pm Cinnom wrote: OK, I got you now. Now, I made a few global variables to keep track of the players fighting and the current turn. But I have one last question before I can get on with it. Since these are global variables (and as far as I see, they'll have to be), will they be taken over if someone starts a fight, and then someone else starts another fight? (Will the second fight interfere with the first one?) |
In response to Cinnom
|
|
On 5/14/01 3:10 pm Cinnom wrote:
On 5/13/01 6:16 pm Deadron wrote: Right, that's what will happen. You don't want those to be global variables, you want them to be owned by the mobs. Sounds like a good time to read up on variables and get them down solid -- you'll be glad you did! The online guide has some info here: http://www.byond.com/docs/guide/info.html#1.3 |
In response to Deadron
|
|
Right, that's what will happen. You don't want those to be global variables, you want them to be owned by the mobs. Well... The reason why those variables are global is so that I can keep track of the mobs from the BeginTurn() proc (which is global). If the mobs own those variables (if I make them local under mob), how will I be able to access them without global variables to keep track of the mobs? |
In response to Cinnom
|
|
On 5/14/01 6:29 pm Cinnom wrote:
Right, that's what will happen. You don't want those to be global variables, you want them to be owned by the mobs. I would have to look at Dan's code, which I haven't seen in a long time. But I assume there is some way that BeginTurn() knows about mobs so it can tell them it's their turn? |
In response to Deadron
|
|
On 5/14/01 7:55 pm Deadron wrote:
On 5/14/01 6:29 pm Cinnom wrote: Turn/mob/cur_player 'nuff said. |
Thanks for providing the detail, but I'm still not sure what the question is...could you maybe list out the steps some more?
It sounds like you just need to track who is the attacker and who is the defender, and base their options on that.