Uploaded the new version. I made some additional changes to reduce the amount of item check conditions, to guide the character closer to the target, and hopefully achieve small improvements:

http://www.nexusmods.com/divinityoriginalsin/mods/98/?

Script:

Code
INIT

CHARACTER:__Me

EXTERN FLOAT3:%TargetPos = null
FLOAT3:%TempTarget
INT:%ItemMoveSuccess = 0

/* //to be added to every reaction with movement

VARS
	FLOAT3:_Pos
INTERRUPT
Reset()
ON
		OnMovementFailed(_Pos)
	ACTIONS
	SetVar(__Me,"TargetPos",_Pos)
	CharacterEvent(__Me,"ActivateGetClose")
*/

BEHAVIOUR

REACTION GetClose, 0
USAGE PEACE	
USAGE COMBAT
VARS
	FLOAT:_distance
	FLOAT:_MyX
	FLOAT:_MyZ
	FLOAT:_TargetX
	FLOAT:_TargetZ
	FLOAT:_AttemptCounter = 0
	FLOAT:_AddX
	FLOAT:_AddZ
	FLOAT:_Divisor
	FLOAT3:_Target
	FLOAT3:_MyPos
	FLOAT3:_TargetPosition
ACTIONS
	IF "c1&c2"
		GetPosition(__Me,_MyPos)
		GetVar(_TargetPosition,__Me,"TargetPos")
	THEN
		Set(%TempTarget,_TargetPosition)
	ENDIF
	IF "c1&c2&c3&c4&c5"
		GetX(_MyPos,_MyX)
		GetZ(_MyPos,_MyZ)
		GetX(_TargetPosition,_TargetX)
		GetZ(_TargetPosition,_TargetZ)
		GetDistance(_distance,__Me,_TargetPosition)
	THEN
		Subtract(_TargetX,_MyX)
		Subtract(_TargetZ,_MyZ)
		IF "c1&c2"
			IsGreaterThen(_distance,11)
			IsLessThen(_distance,18)
		THEN
			GetRandom(_Divisor,3.0,3.2,3.5)
		ELIF "c1"
			IsGreaterThen(_distance,17.9)
		THEN
			GetRandom(_Divisor,3.8,4.0,4.3)
		ELSE
			GetRandom(_Divisor,1.8,2.0,2.2)
		ENDIF
		Divide(_TargetX,_Divisor)
		Divide(_TargetZ,_Divisor)
		Add(_MyX,_TargetX)
		Add(_MyZ,_TargetZ)
		SetX(%TempTarget,_MyX)
		SetZ(%TempTarget,_MyZ)
		CharacterLookAt(%TempTarget)
		IF "c1"
			IsGreaterThen(_AttemptCounter,4)
		THEN
			Set(_AttemptCounter,0)
			SetPriority("MoveItems",0)
			IF "c1"
				IsInCombat(__Me)
			THEN
				CharacterEndTurn()
			ELSE
				DelayReaction("GetClose",5)
			ENDIF			
			SetPriority("GetClose",0)
		ELIF "c1"
			IsLessThen(_distance,4)
		THEN	
			CharacterLookAt(_TargetPosition)
			IF "c1"
				IsInCombat(__Me)
			THEN
				CharacterMoveTo(_TargetPosition,1,0,0,0.2,1)
			ELSE
				CharacterMoveTo(_TargetPosition,0,0,0,0.2,1)
			ENDIF
			SetPriority("GetClose",0)
		ELIF "!c1"
			IsLessThen(_distance,4)
		THEN			
			IF "!c1"
				FindValidPosition(%TempTarget,6,__Me)
			THEN
				Interrupt("GetClose")
			ENDIF
			IF "c1"
				IsInCombat(__Me)
			THEN
				CharacterMoveTo(%TempTarget,1,0,0,0.2,1.4)
			ELSE 
				CharacterMoveTo(%TempTarget,0,0,0,0.2,1.4) 
			ENDIF
			SetPriority("MoveItems",0)
		ELSE
			Set(_AttemptCounter,0)
			SetPriority("MoveItems",0)
			SetPriority("GetClose",0)
		ENDIF
	ENDIF
INTERRUPT
	Reset()
	ON
		OnMovementFailed(_)
		OnManualInterrupt("GetClose")
	ACTIONS
		Add(_AttemptCounter,1)
		SetPriority("MoveItems",3000)
		SetPriority("GetClose",0) 
		
REACTION MoveItems, 0
USAGE PEACE
USAGE COMBAT
VARS
	ITEM:_Item
	ITEM:_Item2
	ITEM:_IgnoreItem1
	ITEM:_IgnoreItem2
	ITEM:_IgnoreItem3
	FLOAT:_Weight
	FLOAT:_X
	FLOAT:_Z
	FLOAT:_MyPosX
	FLOAT:_MyPosZ
	FLOAT:_distance
	FLOAT3:_MyPos
CHECK "(((c1&c2)|(c3&(c4|c5)))&c6&c7&((!c8&c9)|c10|c11))&!c12"
	IsRandom(0.4)
	ItemGet(_Item,__Me,7,Lowest,Distance,"")
	ItemGet(_Item,__Me,7,Random,Distance,"")
	CanSee(__Me,_Item)
	IsRandom(0.3)
	IsFacing(__Me,_Item,120)
	ItemGetStat(_Weight,_Item,Weight)
	IsLessThen(_Weight,5000)
	IsLessThen(_Weight,60001)
	IsEqual(_Weight,200000) //Ice_Crystal
	IsEqual(_Weight,1100)
	ItemIsDestroyed(_Item)
ACTIONS
	IF "c1"
		IsInCombat(__Me)
	THEN
		CharacterMoveTo(_Item,1)
	ELSE
		CharacterMoveTo(_Item)
	ENDIF
	IF "c1"
		IsEqual(_Weight,200000) //Ice_Crystal
	THEN
		WHILE "!c1"
			ItemIsDestroyed(_Item)
		DO
			CharacterAttack(_Item)
		ENDWHILE
	ELSE
		GetPosition(__Me,_MyPos)
		GetRandom(_X,-3,-2,2,3)
		GetRandom(_Z,-3,-2,2,3)
		IF "!c1&c2&c3"
			ItemIsDestroyed(_Item)
			GetX(_MyPos,_MyPosX)
			GetZ(_MyPos,_MyPosZ)
		THEN
			Subtract(_MyPosX,_X)
			Subtract(_MyPosZ,_Z)
			SetX(_MyPos,_MyPosX)
			SetZ(_MyPos,_MyPosZ)
			IF "c1"
				FindValidPosition(_MyPos,6,_Item)
			THEN
				StartTimer("CheckMoveItemSuccess",3,0)
				CharacterMoveItem(_Item,_MyPos)
				Set(%ItemMoveSuccess,1)	
			ENDIF
		ENDIF
	ENDIF
	SetPriority("MoveItems",0)
INTERRUPT
	Reset()
	SetPriority("MoveItems",0)
	
EVENTS

EVENT CheckItemMoveSuccess
ON
	OnTimer("CheckMoveItemSuccess")
ACTIONS
	IF "c1"
		IsEqual(%ItemMoveSuccess,1)
	THEN
		Set(%ItemMoveSuccess,0)
	ELSE
		Interrupt("MoveItems")
	ENDIF
	
EVENT GetCloseActivation
ON
	OnCharacterEvent(__Me,"ActivateGetClose")
ACTIONS
	SetPriority("GetClose",2000)
	
EVENT SetPathAIPriorities
ON
	OnTurnEnded() //also thrown when __Me kills the last enemy to end combat
ACTIONS
	SetPriority("GetClose",0)
	SetPriority("MoveItems",0)


The following changes have been made:

- reduced the max distance to the temporary target to about 6m, so characters hopefully get a bit closer to the relevant items; therefore, an item check near the temporary target shouldn't be necessary any more
- increased/decreased the weight of several items to exclude/include them for item movement behaviour (list s. above)
- reduced the item check conditions
- the priorities of 'GetClose' and 'MoveItems' are set to 0 OnTurnEnded to avoid unnecessary movement/item movement and issues with redhanded reactions NPCs might trigger after combat (making them unresponsive)

From my testings:

I think I've created a similar (or same) situation as Furin did, but I can hardly help NPCs here. The following complications will probably remain:

1) Other characters block the path, so the active character will try to move items but can't solve the situation. Turn will be skipped after four attempts.

2) The character doesn't face the blocking items and will try to move irrelevant items. With some luck he will change his position in a way that he will face the relevant items. I could try letting characters change their direction to face other areas and hopefully find the right items by chance. Though I don't know if/how much it would help.

3) The character has no possible line of sight to the enemy because everything is blocked with massive items (like crates). I'm not sure what the default combat behaviour of NPCs would be; do they try to change their position to get sight? Because currently characters sometimes seem to look into completely different directions than they should and do either nothing, if they don't find items, and skip turn after a while or move irrelevant items. I produced this situation by blocking the door to Shereth's room with crates. When I replaced one crate with a candleholder or left little space between the crates (and positioned my character so that the character could see me) the characters used their distance skills and could handle the items better/at all.

4) Low weight items won't be moved now, but the character still checks over them of course. This can lead to the character needing several/many attempts to finally solve the situation, if many small items are dropped between the character and the blocking items (so the irrelevant items are closer to the character).

Small, winding and crowded (by characters and/or items) locations are the most complicated ones and can be used to the player's advantage most. The AI and the scripting show the greatest limitations and flaws here.
In Boss fights NPCs should usually handle the player's attempts to block path quite well. Often the areas are open and wide enough. A strategy like this from Ragshak would definitely lead to a surprise, and a quick end: http://steamcommunity.com/sharedfiles/filedetails/?id=860124545.

That's all I have for now.




My mods for DOS 1 EE: FasterAnimations - QuietDay - Samaritan