#@Mr. PotatoAim Sorry, got distracted -

1 messages ยท Page 1 of 1 (latest)

lilac mist
#

Not a problem! I appreciate your time ๐Ÿ™‚

left dagger
#

All good. I live to serve. Plus if its a road I walked, all I got to is remember.

So its the arsenal not the storage, but let me dig a lil more - to see if there isn't a set storage in code - I'm quite sure their is.

lilac mist
#

ahh okay, yeah it was confusing as to what storage component I should use. The weapons boxes had universal storage but others had arsenal

left dagger
#

So basically the diffrence is one has less features. Arsenal stuff all as supply cost running though it and code to pull from config storeage.

SCR_ArsenalInventoryStorageManagerComponent

#

Shows you a bit on how to add, at the end of the day your going to have a comp that "at some point" injects into the storage XYZ - which is how Arsenal sets up.

#

Your goal is just to take a static array of resources and rando inject them right?

#

"resources" = game items

lilac mist
#

yeah pretty much, fill my own config of items and then choose a random amount of random items to put in that storage

left dagger
#

So basically I would recommend modding with the arsenal. Do you need cost/supply/money?

lilac mist
#

nah I don't need any supplies or systems tied to it, just a basic storage container that has singular items inside

left dagger
#

Ok then that's semi easier. Gimmi a few moments to see the best way to inject.

#

ok so the main/root action is SCR_InventoryStorageManagerComponent.InsertItem you could use that and have another comp call it (and do the pull down of the resource config and randomizer), and inject the items. Since your not doing anything with the UI, it should be normal on first viewing, so you don't need to do anything fancy. Remember you'll need RPL on your box, and a storage of some kind, universal will work.

lilac mist
#

so universal storage + arsenal comps on the box.

Where do I pull the storage manager comp from?

left dagger
#

Uni Storage + your comp (MyLilBoxSetupComp)+ RPLcomp, and your comp would have code that on init, go use this class, and this function in that manager and do the work of setting up the box

#

ArseManager is just a child/style of the larger managers to provide the auto loading function and cost functions. You could modify the arsenal, but building your own "setup comp" is probably quicker and more bug free.

lilac mist
#

will have a gander, cheers!

left dagger
#

Rgr. I'm gonna take a stab at it and see if what I told you is remotely correct ๐Ÿ˜›

lilac mist
#

it sounds like how I was exploring it, I wasn't sure how to go about making "insert item" happen

Next issue will probably be how to pull a resource from a config to insert it, but the comps you mentioned should help me out there

left dagger
#

That I can get you the code for, super easy

maiden shadow
#
class ZEL_StorageSpawningComponent : ScriptComponent
{
    SCR_UniversalInventoryStorageComponent m_StorageComponent;
    SCR_InventoryStorageManagerComponent m_InvManComp;
    //------------------------------------------------------------------------------------------------
    override void OnPostInit(IEntity owner)
    {
      SetEventMask(owner, EntityEvent.INIT);
    }
    //------------------------------------------------------------------------------------------------
    override void EOnInit(IEntity owner)
    {
        m_InvManComp = SCR_InventoryStorageManagerComponent.Cast(owner.FindComponent(SCR_InventoryStorageManagerComponent));
        m_StorageComponent = SCR_UniversalInventoryStorageComponent.Cast(owner.FindComponent(SCR_UniversalInventoryStorageComponent));
    }
    //------------------------------------------------------------------------------------------------
    protected void Spawn()
    {
        if(!m_InvManComp)
            return;        
        if(!m_StorageComponent)
            return;        
        if (!Replication.IsServer())
            return;            
        Resource LootResource = Resource.Load("{E57DBDA5C50F07FF}Prefabs/Weapons/Rifles/M16/Rifle_M16A2_carbine_4x20.et");
        IEntity SpawnedEntity = GetGame().SpawnEntityPrefab(LootResource);
        
        if (!SpawnedEntity )
            return;

        if (!m_InvManComp.TryInsertItemInStorage(SpawnedEntity , m_StorageComponent))
            SCR_EntityHelper.DeleteEntityAndChildren(SpawnedEntity );
    }
};
left dagger
#

Testing

#

I can't trigger the EonInit for some reason on my box, so I can't parse what a Ent Config looks like atm, but between our two codes you should be good to go.

#

I can't seem to push code...

#

Zelik will likely handle the rest. I gotta do some other stuff today

maiden shadow
left dagger
maiden shadow
left dagger
#

I'm not a fan of posturing but you do you ๐Ÿ˜›

maiden shadow
#

If I don't know the answer I just don't reply. Pretty simple, I don't go around misleading or making things up.

lilac mist
#

thanks both!

so I have it kind of working I think, I can see the items spawn when I don't make them delete straight away but they don't seem to insert into the storage ๐Ÿค” could that be because of the storage type not being right for the item?

maiden shadow
#

You're trying to spawn them into an arsenal?

lilac mist
#

trying to spawn them into a box that has a universal storage comp on, not arsenal

maiden shadow
#

Then the component I posted above is all you need

#

If the storage space and such isn't big enough(the item will not fit in the storage). So it will be deleted.

lilac mist
#

ahh will be the storage volume ๐Ÿคฆโ€โ™‚๏ธ

maiden shadow
#

Most people forget the Max Weight and leave it at 0

#

I've done that plenty of times.

lilac mist
#

yep that too

maiden shadow
#

If you use my component i'd appreciate it if you left the description

#

Do change the tag though.

lilac mist
#

I'd already made my own component prior to all this, had half right half missing ๐Ÿ˜‚

lilac mist
#

Is there a different function for trying to insert into a vehicles storage?

Trying the same thing but it doesn't seem to insert anything ๐Ÿค”

maiden shadow
#

vehicles don't have a SCR_InventoryStorageManagerComponent

#

They have a SCR_VehicleInventoryStorageManagerComponent

#

Just get the ScriptedInventoryStorageManagerComponent instead

#

it's the parent class of both of them

lilac mist
#

Yeqh I tried swapping to for an inventory storage manager but it didn't work either, and using SCR_VehicleInventoryStorageManagerComponent with try to insert, it didn't work

Ah okay, will have a go with that

maiden shadow
#

then you won't have to have functionality specifically for vehicles.