Enderal SE https://mod.pub/enderal-se/38-enderal-se
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.4 KiB
45 lines
1.4 KiB
Scriptname Tsc_ThrowingWeapons_NPCAmmoScript extends activemagiceffect
|
|
|
|
Event OnEffectStart(Actor akTarget, Actor akCaster)
|
|
mySelf = akTarget
|
|
int size = ScrollList.GetSize()
|
|
While (size > 0)
|
|
size -= 1
|
|
int scrollCount = mySelf.GetItemCount(ScrollList.GetAt(size))
|
|
int ammoCount = mySelf.GetItemCount(AmmoList.GetAt(size))
|
|
if (scrollCount > ammoCount)
|
|
scrollCount = scrollCount - ammoCount
|
|
mySelf.AddItem(AmmoList.GetAt(size), scrollCount, true)
|
|
endIf
|
|
endWhile
|
|
endEvent
|
|
|
|
Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference)
|
|
if (akBaseObject.HasKeyword(WeapTypeBow) && mySelf.IsEquipped(AmmoList))
|
|
mySelf.UnequipItem(equippedItem, true, true)
|
|
endIf
|
|
if (ScrollList.HasForm(akBaseObject))
|
|
int index = ScrollList.Find(akBaseObject)
|
|
mySelf.EquipItem(AmmoList.GetAt(index), true, true)
|
|
endIf
|
|
if (AmmoList.HasForm(akBaseObject))
|
|
equippedItem = akBaseObject
|
|
int wpn = mySelf.GetEquippedItemType(1)
|
|
if (wpn == 7 || wpn == 12)
|
|
mySelf.UnequipItem(mySelf.GetEquippedWeapon(), false, true)
|
|
endIf
|
|
endIf
|
|
endEvent
|
|
|
|
Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
|
|
if (ScrollList.HasForm(akBaseItem))
|
|
int index = ScrollList.Find(akBaseItem)
|
|
mySelf.AddItem(AmmoList.GetAt(index), aiItemCount, true)
|
|
endIf
|
|
endEvent
|
|
|
|
Form equippedItem
|
|
Actor mySelf
|
|
FormList Property ScrollList Auto
|
|
FormList Property AmmoList Auto
|
|
Keyword Property WeapTypeBow Auto |