80 lines
2.6 KiB
Plaintext
80 lines
2.6 KiB
Plaintext
Scriptname Tsc_ThrowingWeapons_PlayerScript extends ReferenceAlias
|
|
|
|
GlobalVariable Property ModVersion Auto
|
|
Tsc_ThrowingWeapons_QuestScript Property QuestScript Auto
|
|
FormList Property AmmoItemList Auto
|
|
FormList Property ScrollList Auto
|
|
Actor Property PlayerRef Auto
|
|
Keyword Property ActorTypeNPC Auto
|
|
|
|
Event OnPlayerLoadGame()
|
|
|
|
if (ModVersion.GetValue() < 3.0)
|
|
QuestScript.version3Update()
|
|
ModVersion.SetValue(3.0)
|
|
Debug.Notification("True Spear Combat updated to V0.7")
|
|
endIf
|
|
|
|
QuestScript.fnisUpdate()
|
|
EndEvent
|
|
|
|
Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
|
|
if (AmmoItemList.HasForm(akBaseItem))
|
|
int index = AmmoItemList.Find(akBaseItem)
|
|
form wpn = ScrollList.GetAt(index)
|
|
PlayerRef.AddItem(wpn, aiItemCount, true)
|
|
if (akSourceContainer)
|
|
int scrollCount = akSourceContainer.GetItemCount(wpn)
|
|
int ammoCount = akSourceContainer.GetItemCount(akBaseItem)
|
|
if (scrollCount > ammoCount)
|
|
scrollCount = scrollCount - ammoCount
|
|
akSourceContainer.RemoveItem(wpn, scrollCount, true)
|
|
endIf
|
|
endIf
|
|
endIf
|
|
endEvent
|
|
|
|
Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)
|
|
if (AmmoItemList.HasForm(akBaseItem))
|
|
int index = AmmoItemList.Find(akBaseItem)
|
|
form wpn = ScrollList.GetAt(index)
|
|
int ammoCount = PlayerRef.GetItemCount(akBaseItem)
|
|
int scrollCount = PlayerRef.GetItemCount(wpn)
|
|
if (ammoCount < scrollCount)
|
|
scrollCount = scrollCount - ammoCount
|
|
PlayerRef.RemoveItem(wpn, scrollCount, true)
|
|
endIf
|
|
if (akDestContainer.HasKeyword(ActorTypeNPC))
|
|
akDestContainer.RemoveItem(akBaseItem, aiItemCount, true)
|
|
akDestContainer.AddItem(wpn, aiItemCount, true)
|
|
endIf
|
|
endIf
|
|
endEvent
|
|
|
|
Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference)
|
|
int index
|
|
form wpn
|
|
if (AmmoItemList.HasForm(akBaseObject))
|
|
index = AmmoItemList.Find(akBaseObject)
|
|
wpn = ScrollList.GetAt(index)
|
|
PlayerRef.EquipItem(wpn, false, true)
|
|
elseIf (ScrollList.HasForm(akBaseObject))
|
|
index = ScrollList.Find(akBaseObject)
|
|
wpn = AmmoItemList.GetAt(index)
|
|
PlayerRef.EquipItem(wpn, false, true)
|
|
endIf
|
|
endEvent
|
|
|
|
Event OnObjectUnequipped(Form akBaseObject, ObjectReference akReference)
|
|
int index
|
|
form wpn
|
|
if (AmmoItemList.HasForm(akBaseObject))
|
|
index = AmmoItemList.Find(akBaseObject)
|
|
wpn = ScrollList.GetAt(index)
|
|
PlayerRef.UnequipItem(wpn, false, true)
|
|
elseIf (ScrollList.HasForm(akBaseObject))
|
|
index = ScrollList.Find(akBaseObject)
|
|
wpn = AmmoItemList.GetAt(index)
|
|
PlayerRef.UnequipItem(wpn, false, true)
|
|
endIf
|
|
endEvent |