So I'm trying to code a function to return a value like random();
but I want to use the skill of my FrikaC brand Frikbots to influence the outcome of a random number
Heres what I whipped together in a few minutes. I know how to program, but not in C. So I guess what I'm saying is I don't know how to code when it comes to quake.
So this should loop, and will return a number like random, unless the skill is set to a higher level, in which case, the random return is influenced and won't return a number until a number within range is met for that skill level.
Right? Or is that not cool with the quake engine, just relooping until an outcome is met. It's not an infinite loop or anything obviously, but.. I guess I could see how the engine might think I'm making a loop for no reason. It works fine in other languages.
It doesn't work obviously, otherwise I wouldn't be posting. Advice anyone?
but I want to use the skill of my FrikaC brand Frikbots to influence the outcome of a random number
Heres what I whipped together in a few minutes. I know how to program, but not in C. So I guess what I'm saying is I don't know how to code when it comes to quake.
Code:
void () bot_skillsets = { local float botss, ssrand; botss = self.b_skill; while (botss) { ssrand = random(); if (botss == 0) { return ssrand; } else if (botss == 1) { if (ssrand >= 0.2) return ssrand; } else (botss == 2) { if (ssrand >= 0.4) return ssrand; } } };
Right? Or is that not cool with the quake engine, just relooping until an outcome is met. It's not an infinite loop or anything obviously, but.. I guess I could see how the engine might think I'm making a loop for no reason. It works fine in other languages.
It doesn't work obviously, otherwise I wouldn't be posting. Advice anyone?
Comment