FOnline Development > Questions and Answers

Questions

<< < (2/4) > >>

Lidae:
Ok, fuck it. Apparently I'm really bored/helpful tonight.

In _defines.fos, line 871, add:

--- Code: ---#define MODE_DISABLE_LOOT                        (545)

--- End code ---

In main.fos, function critter_use_skill, around line 1190, replace the following:


--- Code: ---    case SKILL_LOOT_CRITTER:           // Loot critter, only targetCr is valid
    {
        CritterTrophy(targetCr, cr);   // Critters like brahmins should drop meat, skin etc cr.ShowContainer(targetCr,null,TRANSFER_CRIT_LOOT);
        cr.Action(ACTION_PICK_CRITTER, 0, null);
        cr.ShowContainer(targetCr, null, TRANSFER_CRIT_LOOT);
        if(cr.Mode[MODE_HIDE] != 0 && Random(0, 1) == 1 && cr.GetAccess() < ACCESS_TESTER)
            cr.ModeBase[MODE_HIDE] = 0;
        return true;
    }

--- End code ---

With this:


--- Code: ---    case SKILL_LOOT_CRITTER:           // Loot critter, only targetCr is valid
    {
        if (cr.Mode[MODE_DISABLE_LOOT] != 0) return true;
        CritterTrophy(targetCr, cr);   // Critters like brahmins should drop meat, skin etc cr.ShowContainer(targetCr,null,TRANSFER_CRIT_LOOT);
        cr.Action(ACTION_PICK_CRITTER, 0, null);
        cr.ShowContainer(targetCr, null, TRANSFER_CRIT_LOOT);
        if(cr.Mode[MODE_HIDE] != 0 && Random(0, 1) == 1 && cr.GetAccess() < ACCESS_TESTER)
            cr.ModeBase[MODE_HIDE] = 0;
        return true;
    }

--- End code ---


That should make it so that you can't loot the critter when it's dead, if the parameter MODE_DISABLE_LOOT is non-zero. Since 0 is the default value for all parameters, you have to set it to for example 1 for all players (if that's what you want). To do this, go to main.fos, function critter_init. At around line 1600, you have this:


--- Code: ---    if(cr.IsPlayer())
    {
        cr.ParamBase[TO_SLEEPY_STOPPED] = 0;
--- End code ---

Replace with this:


--- Code: ---    if(cr.IsPlayer())
    {
        cr.ParamBase[TO_SLEEPY_STOPPED] = 0;
        cr.ModeBase[MODE_DISABLE_LOOT] = 1;
--- End code ---


Now you want to make it so that you actually keep your items when you respawn, rather than having them moved to the ground where you died. In replication.fos, at line 452, replace the following:


--- Code: ---        if(_CritCanDropItemsOnDead(cr))
        {
            if(!(map.GetLocation().GetProtoId() == LOCATION_Hinkley && IsInsideArena(cr)))
                DropItems(cr);
        }

--- End code ---

with this:


--- Code: ---        if(_CritCanDropItemsOnDead(cr) && cr.Mode[MODE_DISABLE_LOOT] == 0)
        {
            if(!(map.GetLocation().GetProtoId() == LOCATION_Hinkley && IsInsideArena(cr)))
                DropItems(cr);
        }

--- End code ---


I think that should do the trick. I don't know what penalty you want for dying instead of losing your items, but this obviously only disables the looting for players. If you want partial loot, it will be a bit more complicated.

I also didn't test this at all, so don't sue me if there's a mistake somewhere.

Aralvar:
Lidae, I could kiss you right now. Come here, seriously. I'm going to kiss you.

Aralvar:
Nevermind, it was my fault sorry!

Lidae:
Hm, well ok. Are you using the 2238 SDK?

Anyway, for the critter_init part, the important thing is this:


--- Code: ---if (cr.IsPlayer()) cr.ModeBase[MODE_DISABLE_LOOT] = 1;
--- End code ---
Just add that line for example at the first line of critter_init, or the last one. So it looks like this:


--- Code: ---void critter_init(Critter& cr, bool firstTime)
{
    if (cr.IsPlayer()) cr.ModeBase[MODE_DISABLE_LOOT] = 1;
    /../
}

--- End code ---

For the replication.fos, the key line is "DropItems(cr)" - that's what causing the items to be moved to the ground. Search the document for that line, you should find something that at least resembles what I wrote (otherwise it's a little strange). The important thing here is to make sure that DropItems(cr) is not called if the critter's parameter MODE_DISABLE_LOOT is not equal to zero.


Come to think of it, what program are you using to view the file? If you're using notepad, the linebreaks might be screwed up. Try notepad++.

Aralvar:
I'm using the only SDK I can find, from http://svn2.xp-dev.com/svn/fonline_sdk/

Is that not the correct one? I tried googling "FOnline 2238 SDK" and only that turned up.

Agh, I'm an idiot. Just found it I think.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version