ID:180789
 
how do I make it possible to use the verb fight(), and the char starts fighting another char. The other one defends and then he attacks and so on.

All this should be automatic after the first player has used fight() on the second.


(if I can get this together I have a completly new game for you)
On 2/16/01 11:58 am Kaidorin wrote:
how do I make it possible to use the verb fight(), and the char starts fighting another char. The other one defends and then he attacks and so on.

All this should be automatic after the first player has used fight() on the second.


(if I can get this together I have a completly new game for you)

There is no one answer...what you are really asking is how to put together a combat system.

Clearly one of us needs to do some sample code for a combat system, since the question comes up a lot...

If I get around to it, maybe I'll do something this weekend.

In the meantime, you should think about it this way:

What are the steps involved in combat?

Put together a list of the steps you want, and then we can help you fill in the steps.
In response to Deadron

Put together a list of the steps you want, and then we can help you fill in the steps.

My ideas for some of the things that might be needed are to see what is being worn in certain systems or take the AC.

Also sometimes there are different damges put together into one and the character may have different resistances to some. For example he gets hit with a flaming sword. Player take x flame damage and x blade of physical damage.
In response to karver
ok, here are the steps I want:

compare the attackers fat* + 1d10 to defenders fat - 1d10

if the result is positive, subtract it from defenders fat else do nothing.

if defenders fat < 1 then, transform him into another kind of mob.

goto step 1 but switch roles

well that is all the steps.




* I know it sounds strange but you will see when the game is online, wich will hopefully be today (if I can fix this) or tomorrow if I can't.
In response to Kaidorin
On 2/16/01 1:22 pm Kaidorin wrote:
ok, here are the steps I want:

compare the attackers fat* + 1d10 to defenders fat - 1d10

if the result is positive, subtract it from defenders fat else do nothing.

if defenders fat < 1 then, transform him into another kind of mob.

goto step 1 but switch roles

well that is all the steps.

That's the algorithm for damage...but how about the steps for combat? For example, you already mentioned:

1) someone starts a fight
2) the other person defends

etc...the real question here is how to put that together in the game, which you can do if you figure out what these steps are.

For example, some implications from this:

1) someone starts a fight

That means they have a target they are fighting, and you need to remember who that target is. So they have, at minimum, a mob.target variable.

2) the other person defends

That means they need to pay attention to who attacked them. And if more than 2 people can play, and if more than one person attacked, then they may need to keep track of all the people who have attacked them and aren't dead yet.

Etc.

So if you do the pseudo-code (the english language description) of all the steps involved in a fight, then the code requirements start coming clear, like needing mob.target and maybe mob.attacker.
In response to Deadron
compare the attackers fat* + 1d10 to defenders fat - 1d10

if the result is positive, subtract it from defenders fat else *UPDATE*!!!add the (negative) result to attackers fat!!!!*UPDATE*.

if either ones fat < 1 then, transform him into another kind of mob.

well that is all the steps.

That's the algorithm for damage...but how about the steps for combat? For example, you already mentioned:

actually, that algotrithm decides all things related to the combat. The one with the highest result should inflict a loss of fat on the other.


now since I have realizes that they doesn't have to continue fighting automatically, I want the usr to DblClick the mob he wants to attack.

What would the code look like?