Scripters: Can you check this script for normalizing notoriety?

The place to discuss scripting and game modifications for X³: Reunion.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
voxol
Posts: 429
Joined: Sun, 30. Oct 05, 14:42
x3

Scripters: Can you check this script for normalizing notoriety?

Post by voxol » Mon, 21. Aug 06, 08:34

In order to try and overcome the problem of relative notoriety I have used the function given in the tutorial sticky and attempted to reverse its function to calculate the 'true', or as I term it, 'normalized' notoriety loss/gain. I posted this originally in http://forum2.egosoft.com/viewtopic.php?t=149556 - the script I've been trying to use it on is that one.

I'm using this function repeatedly over a timeout period with a timestep inbetween calls, i.e. numerically integrating, then getting the total and using it to reward the player.

Following is a reversed version of the function given in:

http://forum2.egosoft.com/viewtopic.php ... sc&start=0

Code: Select all

002   $value = $newnoto - $oldnoto
003   $modifier = $value / 5
004   
005   $absmodifier = $modifier
006   skip if $absmodifier > 0
007    $absmodifier = 0 - $absmodifier
008   
009   $absvalue = $value
010   skip if $absvalue > 0
011    $absvalue = 0 - $absvalue
012   
013   skip if not $absmodifier != 1 AND $absvalue < ( $absmodifier * 5 )
014    return $modifier
015   
016   $modifier = ( 100 * $value ) / $oldnoto
017   skip if not $oldnoto < 0 AND $modifier > 0
018    return $modifier
019   
020   $modifier = ( $value * 100 ) / ( $oldnoto + 1000 )
021   return $modifier
It seems to work, in a way. I found is that if $oldnoto is -'ve, the returned value is +'ve, so outside of this function I do a check for this condition and set the return value to be -'ve... which seems to work, but I dont know why, and thats a little worrying.

What happens: The first couple of attacks and destructions of enemy stations result in a large (approx 100) value returned from my integrator. Subsequently, smaller values are returned, and this seems to stay the same no matter the notoriety from that point on. Following is a list of some values I got in a run wiping out Blue Profit of all stations (and any offending ships):

Started with high notoriety - could buy all but M1/M2, didnt look at notoriety originally and didnt store in logbook, doh.

New notoriety | Normalized value of difference
Lots | 0
-1044 | -101
-2104 | -85
-3129 | -40
-3249 | -3
-2104 | -85
-3984 | -14
-6294 | -33
-6559 | -3
-7644 | -14
-8239 | -7
-9947 | -15
-10622| -4
-12012| -9
-14717| -15
-16837| -7
-18342| -4
-18652| -1
-19082| -1
-19662| -1
-20161| -2


So it seems as if, after an initial period of high value, probably because of the surprise attack, it 'cools down' to around 15 for destroying a station and bits and bobs lower than that as stations/ships are attacked. Do these numbers make sense?

If someone is willing to take the time to check this, make sure that mathematically it should work, I would be most grateful. I have stared at the function in the sticky several times and still dont 'get' it, so the above function could easily be wrong. I just attempted to reverse its functioning, without understanding what its trying to do.

Excepting this, I am about ready to release my Cold War script that uses this function, and naturally dont want to do so if its bugged at all.

Also, if this does turn out to work and anyone wants to use this library, feel free to do so.

Let me know what you think,

Voxol.

Post Reply

Return to “X³: Reunion - Scripts and Modding”