Is that the "crappy/weird 'maths like' " stuff you are talking about? I understand the first line, but the next two are....
;D
Actually, even I can't remember why I had to do it like that..
_mkunit addRating _mkratUx - (_mkratUx * 2); -> changes the units rating to 0
_mkratU = _mkratUx / 10000; -> original rating 'taken' from the unit is put below the decimal, so it's now 0000.xxxx, and stored into a variable...
_mkunit addRating (_mkratUx + (_mkratU / 2)) + 10; -> Now, this actually confuses me too ;D but this was the only way I could add the rating to the unit, so that it includes the
unitsRating.initialRating...
The other math bit just reverses that above action... Weirdly, but does it anyway...
I absolutely suck in maths so that's probably the reason why these are so confusing...
_ratUm = _ratUx - (_ratUx mod 1); -> this should 'even' up the rating (above the decimal of course) to make it 'zeroable'...
_ratU = ((_ratUx - _ratUm) * 10000) + random 3; -> the above decimal value is first 'zeroed' and then divided by 10000 to get the below decimal value... It can be done this way as OFP can understand only the above decimal value... the
random 3 adds a random value at the end to compensate that 'OFP oddity on long floating points' stuff...
_ratU = _ratU * 2; -> well, this shows that there's something wrong in some of the above 'maths' as the gained value needs to be multiplied by two in order for it to be correct...
Altough, this was not needed when I was first testing this, I needed to add this later on, about the same time I started the vehicle testing...
Because at one point I could retrieve the drivers rating, but below decimal rating was always half of the actual rating, so I just added that line there...
If there's somebody who has a better way of completing this, please share...
So maybe when the unit gains more score, then things start getting screwed up
May be, altough There was no problems with the score gained, but then again, I never tested it so that it would have gone over 10000...
But, I think OFP works so that you can have 6 digits above the decimal and 6 below, so this should stay pretty stable if thinking like that...
Just a possibility, I guess. But perhaps it would help to do this:
Private -> rating + 0.1
Corporal -> rating + 0.2
Sergeant -> rating + 0.3
And so on and so forth. That way there are less numbers after the decimal to get messed up with OFP's 'fuzzy math'.
Could be, altough I would still need some of the fuzzy stuff to actually put that below the decimal ;D
That's why I never even place manned vehicles anymore (just an empty one and then moveindriver someone)
I do this too quite a lot, only when I'm sure I will not be scripting the vehicle into anything, I place the 'original' filled unit...
But usually I manage to funk up the mission when every single object on the map is somehow scripted
But I have some thoughts.... basically, you shouldn't use the "driver" command for vehicles, because some vehicles have no driver (eg, m2 machine guns). I think the "crew" command would be better
Trust me, I have tried
crew too, in many many many (*commandant Lazard voice*) different ways...
The driver is currently there just to keep the stuff working on men so I can prove it works on some level...
just make it do the "rank" routine if a unit has been passed, otherwise it does the "mark" routine. For example
Yeah, good point... I'll add that...
Altough, this is just a 'rough' code, I usually start the optimizing when the code works otherwise...
First off, it appears to do the "rank" routine even when you call the script for the "mark" routine
This code is actually a bit earlier version that I currently had, but the current had so much 'confusement' in it that it just didn't work, so I reverted back to a version that works which of course has less stuff in it than the one that stopped working altogether...
This version indeed runs both the routines but will not when I get the vehicle part working...