FOnline Development > Questions and Answers

FOnline SDK - Question

<< < (87/93) > >>

Wind_Drift:

--- Quote from: Demenise on April 13, 2013, 09:16:17 am ---I also have a problem with critters wearing armor in worldmap_init I put .AddItem( PID_LEATHER_JACKET, 1, 1, SLOT_ARMOR ) under the critter id that I wanted to wear it and it worked but i did it for the caravan guards and unity patrol ncr etc.. and they don't wear the armors I wanted them to wear instead they put the items in the inventory why is it doing this it works for some critters?

--- End quote ---

Figured this one out.

In worldmap_init when the critters are initialized, it'll have their script defined as well.  For NPC groups like Raiders, etc... it'll have "encounter_npc@_NpcInit", or something similar.

Go to encounter_npc.fos, find this part, and add in the "favorite armor" sections.  Or just copypasta this...


--- Code: ---void _NpcInit( Critter& npc, bool firstTime )
{
    uint bt = npc.Stat[ ST_BODY_TYPE ];
    if( bt >= BT_MEN && bt <= BT_GHOUL )
    {
        npc.SetEvent( CRITTER_EVENT_MESSAGE, "_NpcMessage"     );
        npc.SetEvent( CRITTER_EVENT_DEAD, "_NpcDead"        );
        npc.SetEvent( CRITTER_EVENT_SMTH_DEAD, "_NpcSmthDead"    );
        npc.SetEvent( CRITTER_EVENT_SMTH_USE_SKILL, "_NpcSmthUseSkill" );
        npc.SetEvent( CRITTER_EVENT_PLANE_END, "_NpcPlaneEnd"    );
        npc.SetEvent( CRITTER_EVENT_STEALING, "_NpcStealing"    );
        npc.SetEvent( CRITTER_EVENT_SMTH_USE_ITEM, "_NpcSmthUseItem" );
        npc.SetEvent( CRITTER_EVENT_SMTH_DROP_ITEM, "_NpcSmthDropItem" );

        Item@[] items;
        npc.GetItems( -1, items );
        bool favrtAmmoSet = false;
        bool favrtWpnSet  = false;
bool favArmor = false;
        for( uint i = 0, j = items.length(); i < j; i++ )
        {
            SetDeterioration( items[ i ], Random( 80, 95 ) );
            if( items[ i ].GetType() == ITEM_TYPE_WEAPON && !favrtWpnSet )
            {
                npc.SetFavoriteItem( SLOT_HAND1, items[ i ].GetProtoId() );
                favrtWpnSet = true;


            }

        }
for( uint i = 0, j = items.length(); i < j; i++ )
{
SetDeterioration( items[ i ], Random( 60, 85 ) );
if( items[ i ].GetType() == ITEM_TYPE_ARMOR && !favArmor )
{
npc.SetFavoriteItem( SLOT_ARMOR, items[ i ].GetProtoId() );
favArmor = true;
}
}

    }
}

--- End code ---

I haven't exactly figured out how to make it drop to their inventory slot on death, but I'm working on it.

This will at least make them WEAR the armor, and not take it off the second they get the chance.

fonliner:
Hey guys, can you tell me what config is good? Also I would like to know if it is ok use 1440x900 window mode.And yes I run direct version, not open gl.

Wind_Drift:

--- Quote from: fonliner on June 19, 2013, 09:30:10 am ---Hey guys, can you tell me what config is good? Also I would like to know if it is ok use 1440x900 window mode.And yes I run direct version, not open gl.

--- End quote ---

I set my scroll step at 32, but you would probably get the results you want by comparing your 2238 settings to what you have running in the SDK config.

 ;D

wladimiiir:
Is there some other function on Client side, that acts like Critter#RefreshVisible()? So some function that refreshes FOV (e.g. after Dir change).

Outlawries:
How can I make encounters more frequent?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version