Page MenuHomeFeedback Tracker

Moving items from body to attachment slots of another item results in client not syncing the move.
Closed, ResolvedPublic

Description

I'm trying to send all items attached to player within EEKilled to a 'Grave cross' on death, but for some reason the client does not sync this move, I can only assume I'm going about moving the items incorrectly. On kill, a cross is created, and if you check the cross it is empty and the player corpse has all the items. However if you leave the area and return to force it to sync, the items will properly be displayed on the cross.

Heres a snippet of what I have, just using the headgear for example.

modded class PlayerBase
{
    override void EEKilled(Object killer)
    {
        
        int slot_id
        vector CrossPOS = this.GetPosition() - "0.3 -0.3 0.3";
        vector BodyPOS = this.GetPosition();
        ItemBase GraveCrossItem
        if ( ( CrossPOS[0] > 12600 ) || ( CrossPOS[2] > 1463 && CrossPOS[2] < 3850 ) ) //probably a better way to do this.
        {
            GraveCrossItem = ItemBase.Cast( GetGame().CreateObject("DiedOnCoastCross", "0 0 0" ) );
        }
        else 
        {
            GraveCrossItem = ItemBase.Cast( GetGame().CreateObject("Gravecross", "0 0 0" ) );
        }
        if ( this.FindAttachmentBySlotName("Headgear") != NULL )
        { 
            slot_id = InventorySlots.GetSlotIdFromString("Headgear");

            InventoryLocation SelectedSlot = new InventoryLocation;
            ItemBase SelectedItem = ItemBase.Cast(this.FindAttachmentBySlotName("Headgear"));
            SelectedItem.GetInventory().GetCurrentInventoryLocation(SelectedSlot);
            
            InventoryLocation GraveSlot = new InventoryLocation;
            GraveSlot.SetAttachment(GraveCrossItem, SelectedItem, slot_id);
            GameInventory.LocationSyncMoveEntity( SelectedSlot, GraveSlot );
        }
        GraveCrossItem.SetPosition( CrossPOS );    
        super.EEKilled(killer);        
    }
}

The config for the cross is very basic, heres that for reference:

	class Gravecross: Container_Base
	{
		scope=2;
		displayName="Grave cross";
		descriptionShort="";	
		itemSize[]={10,100};
		model="DZ\structures\specific\cemeteries\cemetery_tombstone10.p3d";
		forceFarBubble="true";
		attachments[]=
		{
			"Head",
			"Shoulder",
			"Melee",
			"Headgear",
			"Mask",
			"Eyewear",
			"Gloves",
			"Armband",
			"Vest",
			"Body",
			"Back",
			"Hips",
			"Legs",
			"Feet"
		};
	};

DiedOnCoastCross is identical, just separate so a separate lifetime value can be used.

Details

Severity
Minor
Resolution
Open
Reproducibility
N/A
Operating System
Windows 10
Category
General

Event Timeline

GetInventory().TakeToDst(InventoryMode.SERVER, SelectedSlot, GraveSlot);

This right here does the trick. Problem solved!

rVn closed this task as Resolved.Apr 29 2019, 10:01 AM
rVn claimed this task.