enderalse/source/scripts/tsc_throwingweapons_npcammoscript.psc

45 lines
1.4 KiB
Plaintext
Raw Normal View History

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