Author Topic: Text "Radiated" in top right of the window while radiated.  (Read 3039 times)

Text "Radiated" in top right of the window while radiated.
« on: February 27, 2017, 12:06:46 pm »
This is the concept idea: Once you get radiation damage, a text (like timeouts) saying "radiated!" show up in the top left corner of the screen.

How do I make this happen? I've been looking timeouts.fos but this is not really a timeout. Just a text that tells you are radiated.

Re: Text "Radiated" in top right of the window while radiated.
« Reply #1 on: February 27, 2017, 01:50:14 pm »
If you are talking about "Tabs" on left top corner like Overweight, LvlUp and etc
it is in chosen_tabs.fos, radiated tab already exists there but just appearing after radiation dose > #define RADIATION_DAMAGE_VALUE     ( 66 )
« Last Edit: February 27, 2017, 01:52:21 pm by Skycast »

Re: Text "Radiated" in top right of the window while radiated.
« Reply #2 on: February 28, 2017, 11:47:39 am »
True, that's what I need. I'm trying to add a new event damage, like thirst or cold damage by copying the radiation.fos and radiation_map script (and editing defines and such things.) Then I set the script and function to a map and when I enter I got this:
Code: [Select]
[20:19:661] FOServer::SScriptFunc::DataRef_Index : Script error: Index is greater than maximum. : Hambre : void AffectHambre(Critter&inout, int) : 11667, 1 : Map::PrepareScriptFunc : Map id<48>, pid<270>
This is the function
Code: [Select]
void AffectHambre( Critter& cr, int value ) // Export
{
    if( cr.IsDead() )
        return;
    if( cr.Stat[ ST_BODY_TYPE ] == BT_ROBOT || cr.Stat[ ST_BODY_TYPE ] == BT_ALIEN )
        return;

    uint[] indexes;
    uint[] rates;
    bool isActive = cr.GetTimeEvents( CTE_HAMBRE, indexes, null, rates ) != 0;
    int  levelVal = cr.Stat[ ST_HAMBRE_LEVEL ];
    int  resistVal = cr.Stat[ ST_HAMBRE_RESISTANCE ];

    if( value >= 0 )
        value -= value * resistVal / 100;
    cr.StatBase[ ST_HAMBRE_LEVEL ] = CLAMP( levelVal + value, 0, 2000 );
    levelVal = cr.Stat[ ST_HAMBRE_LEVEL ];

    if( value > HAMBRE_HIGH_DOSE )
        cr.SayMsg( SAY_NETMSG, TEXTMSG_GAME, STR_HAMBRE_HIGH_DOSE );

    if( levelVal >= HAMBRE_DAMAGE_VALUE )
    {
        if( cr.Damage[ DAMAGE_HAMBRE ] == 0 )
            cr.DamageBase[ DAMAGE_HAMBRE ] = 1;
    }
    else
    {
        if( cr.Damage[ DAMAGE_HAMBRE ] != 0 )
            cr.DamageBase[ DAMAGE_HAMBRE ] = 0;
    }

    if( isActive )   // Try begin event with new effects
    {
        uint stage = rates[ 0 ];
        uint newStage = GetHambreStage( levelVal );
        if( stage != newStage )
            cr.ChangeTimeEvent( indexes[ 0 ], 0, stage );
    }
    else     // Try start new event
    {
        int stage1Val = TABLE_STAGE_VALUE( 1 );
        if( levelVal >= stage1Val )
            cr.AddTimeEvent( "cte_hambre", 0, CTE_HAMBRE );
    }

    if( levelVal >= HAMBRE_DEAD_DOSE )
    {
        cr.ToDead( ANIM2_DEAD_FUSED, null );
        cr.SayMsg( SAY_NETMSG, TEXTMSG_GAME, STR_HAMBRE_DIE );
    }
}
And it's exactly the same as affect_radiation.
Also, ofcourse, the event doesn't start.

Re: Text "Radiated" in top right of the window while radiated.
« Reply #3 on: February 28, 2017, 02:47:38 pm »
Open _defines.fos and check at the bottom Critter data parameters

Like this:
# pragma crdata "Stat           0 199"
# pragma crdata "Skill        200 217"
# pragma crdata "TagSkill     226 229"
# pragma crdata "Timeout      230 256"
# pragma crdata "Kill         260 281"
# pragma crdata "Perk         300 469"
# pragma crdata "Addiction    470 476"
# pragma crdata "Karma        480 497"
# pragma crdata "Damage       500 506" !!!
and etc.

So one of your new vals not fits the gap, most probably DAMAGE_HAMBRE is like define 507. Just change # pragma crdata limits and thats all.
Also dont forget set same values in config.fos
// Range of values for client engine
__DamageBegin     = 500;
__DamageEnd       = 506;
« Last Edit: February 28, 2017, 02:49:43 pm by Skycast »

Re: Text "Radiated" in top right of the window while radiated.
« Reply #4 on: March 03, 2017, 02:11:07 pm »
I have set the values to 507. Still don't understand where is that value expecified. BUT. It's working clean. No errors or anything.
I have a few more things. I tried to add a new drug.

The proto is item tipe "2" which means it's a drug type, put the PID on DrugsIdentifiers, on drug Effects, and table index. Got this error:
Code: [Select]
[03:383] Script message: drugs : Info : Compiling const int[] DrugsIdentifiers : 10747, 28.
[03:383] Script message: drugs : Error : 'PID_TESTDRUG' is not declared : 10752, 25.
[03:384] Script message: drugs : Info : Compiling void DropDrugEffects(Critter&inout) : 10977, 1.
[03:384] Script message: drugs : Error : Use of uninitialized global variable 'DrugsIdentifiers'. : 10996, 20.
[03:386] Script message: drugs : Info : Compiling int GetDrugTableIndex(uint16) : 11108, 1.
[03:386] Script message: drugs : Error : 'PID_TESTDRUG' is not declared : 11200, 6.
[03:389] Script::LoadScript - Unable to Build module<drugs>, result<-1>.
[03:389] Load module fail, name<drugs>.

I think I wrote everything right. As far as I know, the first line in effects, means the debuff of using the drug.

Code: [Select]
// PID_TESTDRUG
    -1,      0,             0,      0,          0,     0,
    ST_HAMBRE_LEVEL,         -200,      0,      0,          0,     0,
    ST_CURRENT_HP,        100,     0,     0,          0,     0,
    -1,         0,      0,      0,          0,     0,
    -1,         0,      0,      0,          0,     0,

What am I doing wrong? Thanks SO MUCH in advance, I have not much time to work on this but indeed its helping me a lot

Re: Text "Radiated" in top right of the window while radiated.
« Reply #5 on: March 04, 2017, 03:49:41 pm »
Nevermind... Sorry 3 Int. I defined the wrong PID