#INCLUDE State_Manager
INIT
USING State_Manager
CHARACTER:__Me
CHARACTER:%Victoria = CYS_OrcLibrarian_6a429053-8eb7-48d1-94cc-7292449487d7
TRIGGER:%pointBook = CYS_PointCecil1_faad94a4-5ae5-45bc-9b71-31510bc6cef5
TRIGGER:%pointCloset = CYS_Point_Cecil_Closet_37dac4f4-48e2-4ae7-b34d-349bf5273287
TRIGGER:%pointOutside = CYS_PointOrcLibOutside_e6945537-cff1-4699-b3f9-5d2a47ceed9d
ITEM:%cupboard = FUR_Rich_Cupboard_A_Door_A_002_ee9c92f9-ff31-41e9-965e-0128bf72d6b2
FLOAT3:%TargetPos
FLOAT3:%TempTarget
BEHAVIOUR
REACTION State_ActionManager, 0
USAGE PEACE
ACTIONS
GetWeightedRandom(%currentAction, "Action_ReadBook", INT:10, "Action_TalkToGuardsOutside", INT:4, "Action_LookIntoCloset", INT:4)
SetPriority(%currentAction, 1100)
REACTION State_VictoriaDead, 0
USAGE PEACE
VARS
FIXEDSTRING:_Animation
ACTIONS
CharacterMoveTo(%Victoria,1)
CharacterLookAt(%Victoria)
GetWeightedRandom(_Animation,"Crying_01",FLOAT:15,"Kneel_01",FLOAT:10,"Kneel_02",FLOAT:10,"Depressed_01",FLOAT:5)
CharacterPlayAnimation(_Animation)
Sleep(4)
DialogStart("CYS_AD_CecilMourning",__Me)
REACTION Action_ReadBook, 0
USAGE PEACE
VARS
FLOAT3:_Pos
ACTIONS
IF "!c1"
CharacterHasStatus(__Me,SITTING)
THEN
CharacterMoveTo(%pointBook, 0)
CharacterUseItem(CYS_CecilChair_acb98a79-1842-48ab-a86d-0fd1e177abaf)
ENDIF
CharacterPlayAnimation("Idle1")
CharacterPlayAnimation("Idle3")
Sleep(3)
CharacterPlayAnimation("Idle2")
SetPriority(%currentAction, 0)
INTERRUPT
Reset()
ON
OnMovementFailed(_Pos)
ACTIONS
Set(%TargetPos,_Pos)
PlayEffectAt(%TargetPos,"FX_Env_Fire_Blue_B")
SetPriority("GetClose",2000)
REACTION Action_TalkToGuardsOutside, 0
USAGE PEACE
ACTIONS
CharacterMoveTo(%pointOutside, 0)
CharacterLookFrom(%pointOutside)
Sleep(4)
SetPriority(%currentAction, 0)
REACTION Action_LookIntoCloset, 0
USAGE PEACE
VARS
FLOAT3:_Pos
ACTIONS
CharacterMoveTo(%pointCloset, 0)
CharacterLookFrom(%pointCloset)
CharacterPlayAnimation("Fidget_Forward_01")
ItemOpen(%cupboard)
CharacterPlayAnimation("Look_Left_Short_01")
CharacterPlayAnimation("Look_Right_Short_01")
ItemClose(%cupboard)
SetPriority(%currentAction, 0)
INTERRUPT
Reset()
ON
OnMovementFailed(_Pos)
ACTIONS
Set(%TargetPos,_Pos)
PlayEffectAt(%TargetPos,"FX_Env_Fire_Blue_B")
SetPriority("GetClose",2000)
REACTION GetClose, 0
USAGE PEACE
VARS
FLOAT:_distance
FLOAT:_MyX
FLOAT:_MyZ
FLOAT:_TargetX
FLOAT:_TargetZ
FLOAT:_AttemptCounter = 0
FLOAT:_AddX
FLOAT:_AddZ
FLOAT:_Divisor
FLOAT3:_Target
FLOAT3:_MyPos
ACTIONS
Sleep(1)
GetPosition(__Me,_MyPos)
Set(%TempTarget,%TargetPos)
IF "c1&c2&c3&c4&c5"
GetX(_MyPos,_MyX)
GetZ(_MyPos,_MyZ)
GetX(%TargetPos,_TargetX)
GetZ(%TargetPos,_TargetZ)
GetDistance(_distance,__Me,%TargetPos)
THEN
Subtract(_TargetX,_MyX)
Subtract(_TargetZ,_MyZ)
GetRandom(_Divisor,1.8,1.9,2,2.1,2.2)
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)
CharacterEndTurn()
SetPriority("GetClose",0)
ELIF "c1"
IsLessThen(_distance,4)
THEN
CharacterMoveTo(%TargetPos,0,0,0,0.2,1)
SetPriority("GetClose",0)
ELIF "!c1"
IsLessThen(_distance,4)
THEN
CharacterMoveTo(%TempTarget,0,0,0,0.2,1)
SetPriority("MoveItems",0)
ELSE
Set(_AttemptCounter,0)
SetPriority("MoveItems",0)
SetPriority("GetClose",0)
ENDIF
ENDIF
INTERRUPT
Reset()
ON
OnMovementFailed(_)
ACTIONS
PlayEffectAt(%TempTarget,"FX_Env_Fire_Red_A")
Add(_AttemptCounter,1)
SetPriority("MoveItems",3000)
SetPriority("GetClose",0)
REACTION MoveItems, 0
USAGE PEACE
VARS
ITEM:_Item
ITEM:_IgnoreItem1
ITEM:_IgnoreItem2
ITEM:_IgnoreItem3
FLOAT:_Weight
FLOAT:_X
FLOAT:_Z
FLOAT:_MyPosX
FLOAT:_MyPosZ
FLOAT3:_MyPos
CHECK "(c1&c2&c3&c4&!c5&c6)|(c7&c8&c9&!c10&c11)"
ItemGet(_Item,__Me,6,Random,Distance,"")
IsFacing(__Me,_Item)
CanSee(__Me,_Item)
ItemGetStat(_Weight,_Item,Weight)
IsLessThen(_Weight,1000)
IsLessThen(_Weight,40001)
ItemGet(_Item,%TempTarget,6,Random,Distance,"")
IsFacing(__Me,_Item)
ItemGetStat(_Weight,_Item,Weight)
IsLessThen(_Weight,1000)
IsLessThen(_Weight,40001)
ACTIONS
IF "!c1"
ItemIsDestroyed(_Item)
THEN
CharacterMoveTo(_Item)
ENDIF
GetPosition(__Me,_MyPos)
GetRandom(_X,-3,-2,2,3)
GetRandom(_Z,-3,-2,2,3)
IF "c1&c2"
GetX(_MyPos,_MyPosX)
GetZ(_MyPos,_MyPosZ)
THEN
Subtract(_MyPosX,_X)
Subtract(_MyPosZ,_Z)
SetX(_MyPos,_MyPosX)
SetZ(_MyPos,_MyPosZ)
ENDIF
IF "!c1"
ItemIsDestroyed(_Item)
THEN
CharacterMoveItem(_Item,_MyPos)
ENDIF
SetPriority("MoveItems",0)
INTERRUPT
Reset()
SetPriority("MoveItems",0)