Battle system recreation

Started by Construed, Wed 29/02/2012 06:13:31

Previous topic - Next topic

Construed

#20
How can you not get that lol?

monster attack = 5

is not

monster attack = 4

nor do the different lines of that small line of code produce anywhere near the same results 1 2 3 4 5 have nothing in common except the fact that they are numbers, they all equal different values.

its the plainest most simplistic shit i've ever heard in my life
and your arguing with me about it?


Anyway I've had to come up with my own way of doing this system as you still all fail to add anything productive to this post,

As you see here, even simplistic minded people can workaround your advanced math calculations.

Code: ags

 if (level <= 3) {
  
 level++;
 expierance += 15;
  player_maxhealth += 5;
  player_maxmana += 5;
  player_maxstamina += 5;
  strength += 1; 
  Display ("You have reached level %d And now have, %d strength, %d health, %d mana, %d stamina, %d gold",level, strength, player_maxhealth, player_maxmana,player_maxstamina, goldshow );



 if (level >= 3) {
  
 level++;
 expierance += 5;
  player_maxhealth += 1;
  player_maxmana += 1;
  player_maxstamina += 1;
  strength += 1; 
  Display ("You have reached level %d And now have, %d strength, %d health, %d mana, %d stamina, %d gold",level, strength, player_maxhealth, player_maxmana,player_maxstamina, goldshow );




I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Ryan Timothy B

Exactly why we keep bringing it up to you! It's so damn obvious you can't see it.

Your code wasn't:

Code: ags

int damage = Random(5);

if (damage == 0) MonsterHealth -= 41;
else if (damage == 1) MonsterHealth -= 22;
else if (damage == 2) MonsterHealth -= 76;
//etc


If that was the case we would have completely ignored it. But you're simply subtracting a random number plus one from the health of the monster. We're not trying to say the lines of code are exactly the same, they achieve the exact SAME results. Seriously. Get out a piece of paper and start crossing this off.

MonsterHealth -= Random(5) + 1;

If the random was 0, you'd be subtracting 1 from MonsterHealth.
If the random was 1, you'd be subtracting 2 from MonsterHealth.
If the random was 2, you'd be subtracting 3 from MonsterHealth.
If the random was 3, you'd be subtracting 4 from MonsterHealth.
If the random was 4, you'd be subtracting 5 from MonsterHealth.
If the random was 5, you'd be subtracting 6 from MonsterHealth.

You weren't subtracting a random number from MonsterHealth. You were subtracting Random + 1. Simple algebra.
Spend an hour staring at your code until the light suddenly comes on. If it doesn't, then I strongly suggest that programming isn't for you.

RickJ


Construed

Yea, i know it subtracts a random +1 but as khris stated
Every line does the same exact thing which it doesn't.
and being that its random it could be +1 +4 +3 +2
in that order still giving it a random effect.

I cant even begin to post the code i've done in the past week.
"The message exceeds the maximum allowed length (30001 characters). "
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

straydogstrut

EDIT: Ryan's last post has explained it the same as me and much more concisely..oh well!

Goodness this thread has gotten even more out of control since I started replying, and here I was hoping to calm things down :(

Grim, Khris is trying to help you.

His code does the same as your code in fewer lines. However, I realise that you cannot at the moment see that. Please just say so and ask for further clarification politely instead of making insults at everyone else's intelligence. I'm sorry but if you behave like that, you can only expect negativity in return.

If Khris was wrong i'm sure he would say so, however in this case he isn't. This is not a competition. It is not about who is cleverer than who. You asked for help and Khris gave it. The least you could do is entertain the idea that he might be right, even if you do not believe so.

Quote from: GrimReapYou on Thu 01/03/2012 19:07:00
Yea, i know it subtracts a random +1 but as khris stated
Every line does the same exact thing which it doesn't.
and being that its random it could be +1 +4 +3 +2
in that order still giving it a random effect.

It seems you do see the pattern in your code by what you've said there but for clarity i'll continue with another iteration of the explanation:

In pseudocode your code does the following:
Set dmg to a random number from 0 up to and including 5

If dmg is zero take away one from monsterz
Otherwise, if dmg is one take away two from monsterz
Otherwise, if dmg istwo take away three from monsterz
Otherwise, if dmg is three take away four from monsterz
Otherwise, if dmg is four take away five from monsterz
Otherwise, if dmg is five take away size from monsterz

Khris' code is saying:
Set dmg to a random number from 0 up to and including 5

take away dmg plus 1 from monsterz

So where dmg is zero we can see that this will minus 1 from monsterz: the value of dmg (0) plus 1
If dmg is one, it will minus 2 from monsterz: the value of dmg (1) plus 1
If dmg is two it will minus 3 from monterz: the value of dmg (2) plus 1
and so on..

Does that make sense? Do you see that that is producing the same result as your code.

Realise that no-one is saying dmg is the same as monsterz but that the number you want to subtract is always one more than the value of dmg. The order makes no difference. That is the pattern that Khris' code reproduces. If this wasn't the case, if the value subtracted wasn't constantly one more than the value of dmg, then yes, this particular solution wouldn't fit.

Regarding the presentation of your code. No-one is telling you to code a certain way, only suggesting that taking care to format your code on the forum will make it easier for others to read and help you. You might find it easy to find the right } by skimming down the left hand side but not everyone does which is why, for example, indentation helps. Since you stated you don't want to conform to everyone else's approach, why should you expect them to conform to yours? Learn to consider your audience.

Before this thread gets any more out of control I would just ask you to be polite and respectful to your fellow AGSers. You may not agree with them, you don't even have to listen to their advice - by all means, do your own thing - but please show consideration for them as human beings. You wouldn't start insulting someone who gave you directions to the Post Office just because it was different to what you expected, so why behave like that here? People are willing to help you if you give them the chance.

I hope that the above explanation has made things clearer. If you don't follow, please let me know. It's up to you which method you as both produce the same result. You do not have to implement the newer code, but you were looking for more efficient ways to deal with random numbers which is what the above achieves.

Construed

Yea, I kinda realized that about khris was trying to help awhile back but i was too raged to accept it.
I want to apologize to khris ryan and especially WHAM for reacting the way I did, I guess even at my age I have a lot of growing up to do.

I sincerely apologize Wham for being racist towards you. I didn't mean what i said.
I hope someday you can forgive me.

And also ryan and khris I apologize for being ignorant and hostile towards you, I guess i dont take crit very well which is something I'll have to work on.

I may not even continue the project due to fear of what activisions response might be to the game, but I just wanted to clear the air with you guys..
Wether i stick around or not.

Also thanks ghost and stray for the gentle responses...

I wish you all well and again you have my apologies   :-X
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

SMF spam blocked by CleanTalk