#Well that’s hard to answer because there
1 messages · Page 1 of 1 (latest)
Right, but it’s not intended to subtract the stat itself, if that makes sense.
and -= is shorthand for writing something like
variable = something - variable
I believe
if you want just the player damage minus the boss defense
remove the =
if I am getting your problem right
when faced with stuff like this it could help to draw out a flowchart of the steps you want your function/coroutine to take
Ok, that worked.
not in code, but pseudocode or words
Thanks.
There is something else but I’m wondering if it’s more suited for the advanced sections.
Basically, the coroutine is supposed to stop when either of the characters reach 0HP, but it seems to be forcing me to use a waitforseconds command to get those results. It might just be an issue of how I structured the coroutine though.
from what I know
you have to cache a reference to the coroutine
you can do that in start or whatever
but also the coroutine will stop at the end regardless since you're not looping
Think of coroutines as any other function, except that you can pause in the middle
so if it reaches the end, that's it
this shows an example of caching it
any progress?
Not quite, I’m trying a bunch of different things right now to try and solve the problem, right now I’m making the conditions if an actor’s hp is < 0 as opposed to <= 0.
that doesn't really matter
do you want the coroutine to run the entire boss fight until a condition is met?
Yes, that’s the plan.
you can just wrap the code in a while(true) loop for example
waitforseconds pauses the whole execution and right now your stats will only be evaluated once when you start the coroutine
also in case you're starting this coroutine in update, try not to
you usually don't want to run the same coroutine multiple times at the same time
Ok, thanks for helping. Problem isn’t quite solved yet but I think I know what I’m going for now.
👍