Author Topic: [HowTo play the cr events correctly] Fixing your bugs ;D  (Read 4036 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 »
Mmmwelll,

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 https://github.com/wladimiiir/vault112/blob/master/Server/scripts/drugs.fos (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]
chosen.TimeoutBase[*]
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...

Enjoy.
« Last Edit: May 11, 2019, 07:26:55 am by adumbperson »
The Death After Life.
About me. I hate people generally I still may have respectful talk and recognize the good persons. Careful to what you say, I'm not a kid. My experiences defines me.
[Awaxx] -2024/10/17-