38 Replies
why is what still 2
mb
this is paused before the enemy dmg caculation
also
$code
To post C# code type the following:
```cs
// code here
```
Get an example by typing
$codegif
in chat
For longer snippets, use: https://paste.mod.gg/most people don't want to download random files
BlazeBin - ophphrqiiuor
A tool for sharing your source code with the world!
ty, will take a look at it once I'm at my pc
k
BlazeBin - lsaovwqzoplo
A tool for sharing your source code with the world!
um guys
i think i just fixed it
hold on leme see
nvm
can you give
Player
code?yes
BlazeBin - fkirmdmgwxdy
A tool for sharing your source code with the world!
I started to look at it: https://paste.mod.gg/smksixlurjhq/0
I took out all of the ReadKey because we're just at the debugging stage, right? Easy enough to add them in later.
I think i might have fixed it but sometimes it works and sometimes it dosent
I don't know what the problem is. I was just kind of refactoring the code to something that's quick/easy to test.
what are the inputs necessary to get to the point you want?
for instance if you defend and then the enemy defends if u attack the next turn and the enemy attacks the next turn it will work and damage will = 1 but if you start the battle and defend and they attack right after it dosent work. damage will = 2 (totaldamageYou)
oh, I don't think I saw that code.
No I mean the inputs that will sometimes get it to work
and the inputs that dont
https://paste.mod.gg/czdicnpqwdnz/0
I thought this was the full code.
So I didn't have anything related to fighting.
heres what happens if they attack right after
You can see what I'm doing with your code.
I'm separating out all of the text and inputs so I can quickly test for some known inputs
Yeah, that just has player code.
this one here has it
Yeah, I spent time on the wrong one.
Hopefully someone else can help you more.
You'd still benefit from breaking out all of the
Console
stuff from your main codeOk i will
@yolan Heres my problem: In my code this code it caculates the damage based on the temp armour and armour. Now in my code i have a defend button and when you press it it increases tempArmour by 1.
Now when the enemy attacks
}its suppose to decrease damage by 1. It dosent. The temparmourValue will BE = TO 1 and still ArmourPlusArmour1 will be 0. It dosent make sense. Heres another thing, When defending right when the battle stars and the enemy attacks right after the damae will still be 2. But if you defend and enemy also defends.Next turn when the enemy attacks damage will be = to 1 . I will provide you with an shrot video
battle code.
(both defend and both attacked causing it to work)
dosent matter when it starts aslong as its in order
also and heres the player code
well ... such error are often created when there is a var not in the proper scope "bracket symbols"... else than that you should make sure you Log your error only at the end of everything not in the middle since you do tons of math it will get confusing finding the error....
for me your code is so simple that it is not a bug , it behave like it should ...
there is also the possibility of you erasing a variable with the "=" operator !
at your place i would try to make the code more clear and take time to read every line ! ... some time just sleeping on it and coming back in the morning ; you get to see more clearly
but thats my take on it ! 🙂 peace to you good luck
i made it a field tho
in a minute imma just leave it there
@Pope
I.... Fixed it sorry for pinging you
wasnt thinking when i did that
I fixed it . The problem was: At the start the caculation totalDamage get scaculated then if you defend it tempArmour gets ++ right. But the cacutaltions only happens when the loop resets. so when the enemy attacked it still did 2 damage because the caculation wasnt updated
So i added checks in the middle
so that fixed it
after 2 days
its finally fixed
😄
Thank you all
$close @Silk&Song
If you have no further questions, please use /close to mark the forum thread as answered