FOnline Development > Share Your Work
[HowTo play the cr events correctly] Fixing your bugs ;D
(1/1)
adumbperson:
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: ---duration = DrugEffects[ index + TABLE_DURATION( stage ) ];
cr.TimeoutBase[ TO_PSYCHO ] = __FullSecond + ( duration * 60 );
--- End code ---
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: ---chosen.TimeoutBase[*]
--- End code ---
You'll usually do this into the function that terminate turn based mode...
To read time event durations...
--- Code: ---// 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] );
--- End code ---
Now you can easily update timeouts correctly...
Enjoy.
Navigation
[0] Message Index
Go to full version