Quote
Heh. It might make you giggle to read this, taken from the comment feed on Epic Encounters' workshop page:

Quote:
i have started carrying chests with me so before a boss fight i build a wall and exploit the game (sad face)

I'm sure he'll be happy soon laugh

I've modified the script now to prefer ice walls, though it had its difficulties:

1) The closest wall isn't always accessible (blocked by characters or objects).
2) Characters should still be able to move items, in case the wall is blocked by them.
3) The script structure should be retained.

I decided against prefering the closest crystal but randomized the selection a bit: they'll choose ice crystal template B with 60% chance (I think B is somewhere in the middle of the wall) and A otherwise. When movement to the crystal fails, they won't prefer walls on their next attempt, but it's still possible that they choose an ice crystal due to the standard item selection (so also crystal C will possibly be targeted here; selection of the closest item, be it a crystal or another item, is more likely here).
After a few tests this works okay; they prefer walls and move items if they can't reach the wall. Often not targeting the closest crystal might look a bit unplausible and, indeed, not be the best possible choice often, but I can't choose the closest crystal as first attempt target inside the CHECK block, I'd need to iterate items instead (requiring more variables and more operations). I can do that if you want.

One mysterious issue occured (beside bulls simply being to fat to act in combat): although I check the item weight, characters sometimes attack other items when there's a wall somewhere in range (which they can't reach, I suppose). Even if I check the weight again, right before they attack, they attack items that don't have 200,000 weight although that's actually impossible. It's not a serious issue, but extremely strange. I can't imagine a reason for this.

Regarding possible conditions for casting fireballs on ice walls. What is your choice? smile

1) Whenever skill is available, regardless of Allies in explosion radius.
2) Never when __Me or an Ally is within the explosion radius.
3) __Me may be within explosion radius, but no Ally.
4) Allies may be within explosion radius, but not __Me.
5) Frozen Allies may be within explosion radius.
6) Allies may be within explosion radius if at least one Ally is frozen.

And one last thing:

Is it possible to let ice crystals display their health points? There's no indication of how much points they have and if damage actually reduces them. The low-level characters weren't able to break the crystals.

Current script version:

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
	FLOAT:_Weight
	FLOAT:_X
	FLOAT:_Z
	FLOAT:_MyPosX
	FLOAT:_MyPosZ
	FLOAT3:_MyPos
	INT:_IgnoreWall = 0
	CHARACTER:_Ally
CHECK "((c1&((c2&c3)|c4|c5))|(c6&c7)|(c8&(c9|c10)))&c11&!c12&c13&((!c14&c15)|c16|c17)"
	IsEqual(_IgnoreWall,0)
	ItemGet(_Item,__Me,7,Lowest,Distance,"05ade06a-6ec0-42a5-a86f-02aaec6688b5")
	IsRandom(0.6)
	ItemGet(_Item,__Me,7,Lowest,Distance,"e41a67ed-9e7b-4df9-981a-a97a649b3cde")
	ItemGet(_Item,__Me,7,Lowest,Distance,"c64d607b-192b-45c7-95c5-02363b2ca30c")
	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)
	ItemIsDestroyed(_Item)
	ItemGetStat(_Weight,_Item,Weight)
	IsLessThen(_Weight,5000)
	IsLessThen(_Weight,60001)
	IsEqual(_Weight,200000) //Ice_Crystal
	IsEqual(_Weight,1100)
ACTIONS
	IF "c1"
		IsEqual(_Weight,200000) //Ice_Crystal
	THEN
		IF "c1&c2&(!c3|c4)"
			CharacterCanCast(__Me,Projectile_EnemyFireball)
			CanSee(__Me,_Item)
			CharacterGet(_Ally,_Item,6,Random,null,Ally)
			CharacterHasStatus(_Ally,FROZEN)
		THEN
			CharacterUseSkill(Projectile_EnemyFireball,_Item)
		ENDIF
		IF "!c1&!c2"
			CharacterHasWeaponType(__Me,Bow,1)
			CharacterHasWeaponType(__Me,CrossBow,1)
		THEN
			IF "c1"
				IsInCombat(__Me)
			THEN
				CharacterMoveTo(_Item,1)
			ELSE
				CharacterMoveTo(_Item)
			ENDIF
		ENDIF
		WHILE "!c1"
			ItemIsDestroyed(_Item)			
		DO
			CharacterAttack(_Item)
		ENDWHILE
	ELSE							
		IF "c1"
			IsInCombat(__Me)
		THEN
			CharacterMoveTo(_Item,1)
		ELSE
			CharacterMoveTo(_Item)
		ENDIF
		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
	Set(_IgnoreWall,0)
	SetPriority("MoveItems",0)
INTERRUPT
	Reset()
	SetPriority("MoveItems",0)
	ON
		OnMovementFailed(_)
	ACTIONS
		IF "c1"
			IsEqual(_Weight,200000)
		THEN
			Set(_IgnoreWall,1)
		ENDIF
	
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; wohl zu OnTurn und OnCombatEnded aendern
ACTIONS
	SetPriority("GetClose",0)
	SetPriority("MoveItems",0)


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