Author Topic: [HowTo play the cr events correctly] Fixing your bugs ;D  (Read 27 times)

Offline adumbperson

  • Turn around in orbit!
[HowTo play the cr events correctly] Fixing your bugs ;D
« on: May 11, 2019, 07:23:45 am »

I was playing fo2 and the hell they still didn't fix timeouts...

Then decided I'm gonna show how... (I still haven't done this on my prototype... will serve.)

Well so why are the timeouts freezing that way?...

The answer is that it is an engine's internal feature, it's not bad at all when you do the required work to make it work...

So the drugs are handled through critter time event.

For reference (but timeouts handling is missing)

formula to set timeout is (example for a psycho):
Code: [Select]
duration = DrugEffects[ index + TABLE_DURATION( stage ) ];
cr.TimeoutBase[ TO_PSYCHO ] =  __FullSecond + ( duration * 60 );

By now engine handles timeout and freeze them when you are in turn based mode.

For an accurate timeout handling we need to pick chosen time events related to drugs and read all durations to update
Code: [Select]
You'll usually do this into the function that terminate turn based mode...

To read time event durations...
Code: [Select]
// DrugsIdentifiers from drugs.fos's defines
int[] identifiers;
uint[] indexes, duration, rates;
uint count = cr.GetTimeEvents( DrugsIdentifiers, identifiers, indexes, duration, rates );
for( uint i = 0; i < count; i++ )
    Log( "identifiers:"+identifiers[i]+", indexes:"+indexes[i]+", duration:"+duration[i]+", rates:"+rates[i] );

Now you can easily update timeouts correctly...

« Last Edit: May 11, 2019, 07:26:55 am by adumbperson »
Dumb or right... ez.