FOnline Development > Questions and Answers
Text "Radiated" in top right of the window while radiated.
Grey:
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.
Skycast:
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 )
Grey:
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: ---[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>
--- End code ---
This is the function
--- Code: ---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 );
}
}
--- End code ---
And it's exactly the same as affect_radiation.
Also, ofcourse, the event doesn't start.
Skycast:
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;
Grey:
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: ---[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>.
--- End code ---
I think I wrote everything right. As far as I know, the first line in effects, means the debuff of using the drug.
--- Code: ---// 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,
--- End code ---
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
Navigation
[0] Message Index
[#] Next page
Go to full version