Author Topic: Fonline 2238 SDK Looting in areas  (Read 4370 times)

Fonline 2238 SDK Looting in areas
« on: January 31, 2014, 07:09:44 pm »
Hi

How to turn on looting in areas like Brotherhood of Steel bunker or Navarro?

I killed npc and cant loot his corpse etc.




JovankaB

  • Guest
Re: Fonline 2238 SDK Looting in areas
« Reply #1 on: February 01, 2014, 11:02:43 am »
Most Enclave/BoS soldiers in their bases have guard scripts attached, that's why they can't be looted. You can change it globally in guard.fos module, see line 238 with GuardInit function:

Code: [Select]
void GuardInit(Critter& guard)
{
    _CritSetMode(guard, MODE_NO_ENEMY_STACK);
    _CritSetMode(guard, MODE_NO_LOOT);
    _CritSetMode(guard, MODE_NO_STEAL);
    _CritSetMode(guard, MODE_NO_DROP);
    _CritSetMode(guard, MODE_UNLIMITED_AMMO);
    _CritSetExtMode(guard, MODE_EXT_NO_WALL_CHECK);
    _CritSetExtMode(guard, MODE_EXT_GUARD);
}

By removing or commenting these lines:
Code: [Select]
    _CritSetMode(guard, MODE_NO_LOOT);
    _CritSetMode(guard, MODE_NO_STEAL);
    _CritSetMode(guard, MODE_NO_DROP);

you will make all guards drop items on death and lootable (all guards, not only BoS/Enclave).

It's not enough to just disable MODE_NO_LOOT, because anti-looting scripts are a bit paranoid and if there is any of these 3 flags set (MODE_NO_LOOT, MODE_NO_STEAL, MODE_NO_DROP), critter won't drop items on death and will delete them instead.
« Last Edit: February 01, 2014, 11:08:34 am by b__B »

Re: Fonline 2238 SDK Looting in areas
« Reply #2 on: February 01, 2014, 07:03:53 pm »
Hello and thx for answer.

I did what u say and npcs are lootable now but enclave/brotherhood folks do not drop their armors.

I changed attribute in object editor in power armors to be dropable. In encounters enclave/brotherhood npcs drops their armors but in bases not.

EDIT. Any npc in town did not drop their armors. Vault city, reno etc. only weapons, ammo etc.

Any idea why?
« Last Edit: February 01, 2014, 07:37:00 pm by Peter86A »

Offline Wipe

  • Rotator
  • Random is god
Re: Fonline 2238 SDK Looting in areas
« Reply #3 on: February 02, 2014, 12:53:03 am »
Other than guards scripts mentioned by Jovanka, there's another one which does almost same thing; see npc_unlootable.fos
Not sure now, but i think most (if not all) non-guards town NPCs uses it.
« Last Edit: June 19, 2014, 01:07:06 pm by Wipe »
Games are meant to be created, not played...

Re: Fonline 2238 SDK Looting in areas
« Reply #4 on: February 02, 2014, 11:17:48 am »
And what about armors in guards bags Wipe?

Any guard after death do not drop their armor (in random encouters npcs drops armors).

npc_unlootable.fos How to edit this file without any bad consequences like errors etc?

It looks like this:

Quote
//
// FOnline: 2238
// Rotators
//
// npc_unlootable.fos
//

#include "_macros.fos"

void critter_init(Critter& guard, bool firstTime)
{
    _CritSetMode(guard, MODE_NO_LOOT);
    _CritSetMode(guard, MODE_NO_STEAL);
    _CritSetMode(guard, MODE_NO_DROP);
}
« Last Edit: February 02, 2014, 11:46:47 am by Peter86A »

JovankaB

  • Guest
Re: Fonline 2238 SDK Looting in areas
« Reply #5 on: February 02, 2014, 08:36:57 pm »
You can simply comment _CritSetMode lines by adding // in front of them:

Quote

void critter_init(Critter& guard, bool firstTime)
{
    // _CritSetMode(guard, MODE_NO_LOOT);
    // _CritSetMode(guard, MODE_NO_STEAL);
    // _CritSetMode(guard, MODE_NO_DROP);
}

Also check this Polish AngelScript tutorial: http://forum.newfmc.pl/index.php?board=13.0
« Last Edit: February 02, 2014, 08:39:29 pm by b__B »

Re: Fonline 2238 SDK Looting in areas
« Reply #6 on: February 02, 2014, 09:48:37 pm »
Obviously! thx

And one more thing, no drop armors by guards issue, any idea with it? :)

JovankaB

  • Guest
Re: Fonline 2238 SDK Looting in areas
« Reply #7 on: February 02, 2014, 09:51:11 pm »
no idea how it works, maybe they don't have armors at all just armor skin?

Re: Fonline 2238 SDK Looting in areas
« Reply #8 on: February 02, 2014, 09:55:57 pm »
Awerness perk says they have armors and helmets.

JovankaB

  • Guest
Re: Fonline 2238 SDK Looting in areas
« Reply #9 on: February 03, 2014, 06:36:12 am »
There is one more piece of code you need to change, in critter_dead function, main.fos module:

Quote
    // move all armor items to inventory of npc. delete it if no drop.
    if(cr.Stat[ST_REPLICATION_TIME] < 0 && cr.IsNpc())
    {
        for(uint i = 0, j = items.length(); i < j; i++)
            if(items.GetType() == ITEM_TYPE_ARMOR && items.CritSlot != SLOT_INV)
            {
                if(FLAG(items.Flags, ITEM_NO_STEAL) || FLAG(items.Flags, ITEM_NO_LOOT))
                    DeleteItem(items);
                else

                    cr.MoveItem(items.Id, 1, SLOT_INV);
            }
    }


Delete red parts.

I'm not sure if the NoLoot/NoSteal flags have any effect beside the code above, it may be the case that you will have to turn them off in some armor protos like Power Armor. Use Object Editor to do it.



The item dropping is quite a mess as you can see, there are flags in item protos that can influence it, critter parameters, messy scripts in main and replication modules...
« Last Edit: February 03, 2014, 11:19:04 am by b__B »

Re: Fonline 2238 SDK Looting in areas
« Reply #10 on: February 03, 2014, 04:58:06 pm »
Thx a lot for you answers.

Problem solved :)

Re: Fonline 2238 SDK Looting in areas
« Reply #11 on: June 19, 2014, 08:17:57 am »
Just in case anyone wondering about this topic.
I wanted to remove the no loot, no drop restriction from Ares Silo; I did the above mentioned and didn't quite work out.
I searched around and find out that Ares Silo has it own location specify no loot, no drop restriction.

Go to map_ares.fos, on line 60 you will find the below codes:
Quote
// =============================================
// Super Mutants / Critter
// =============================================
void _Mob(Critter& mob, bool firstTime)
{
    mob.ModeBase[MODE_NO_LOOT] = 0;
    mob.ModeBase[MODE_NO_DROP] = 0;
    mob.ModeBase[MODE_NO_STEAL] = 0;
    mob.ModeBase[MODE_UNLIMITED_AMMO] = 1;
    _CritSetExtMode(mob, MODE_EXT_MOB);
    mob.SetEvent(CRITTER_EVENT_IDLE, "_MobIdle");
}

Change the value of the no_loot, no_drop attribute to "0", and now the muties in the base can be looted.
I think other locations may have similar settings.