FRandom() Failures

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: FRandom() Failures

Re: FRandom() Failures

by NeuralStunner » Sun Jul 01, 2012 1:00 am

Thanks a bunch. :)

Re: FRandom() Failures

by randi » Sat Jun 30, 2012 9:17 pm

Fixed in r3721.

Re: FRandom() Failures

by NeuralStunner » Sat Jun 30, 2012 7:57 pm

I just gave that a try but it didn't help. There's definitely something up with the expression evaluator.

Re: FRandom() Failures

by wildweasel » Sat Jun 30, 2012 7:40 pm

Well, the problem I ran into (I think) is that in order for it to work properly, the values you feed into FRandom should be floats to begin with, i.e. should be suffixed with .0 to actually work. That's a thing I ran into with ww-nazis' shotguns, if I remember correctly.

Re: FRandom() Failures

by NeuralStunner » Sat Jun 30, 2012 7:14 pm

The output of FRandom is supposed to be a float, which is why it's strange.

Re: FRandom() Failures

by wildweasel » Sat Jun 30, 2012 6:29 pm

You can't just write FRandom(-10.0,10.0)?

FRandom() Failures

by NeuralStunner » Sat Jun 30, 2012 5:05 pm

I'm trying to implement some custom inaccuracy code and keep running into a snag: FRandom only evaluates as a float when used alone. Even multiple FRandoms have to each be multiplied by 1.0 for the resulting expression to remain a float.

Here's some test code. I recommend E1M1, right across from the start is a wide flat wall.

Use TimeFreeze so you can see the shot patterns. The first gun (Slot 3) simply uses 10 degrees in either direction. The second (Slot 4) adds together two random results of 5 degrees, giving it a 10 degree spread but making the extremes less likely.

With both guns, primary fire will give a desired result (an irregular but continuous line of puffs) while alternate fire gives a bad result (only on whole angles, giving a uniform dotted-line of puffs).
Spoiler: Decorate.txt
In short: If I want to use FRandom() more than once in an expression, I have to replace it with (FRandom() * 1.0), which is really bizarre.

I hope I explained well enough.

Top