Jump to content

OnInit \ OnPlayerBowShot.. never triggered..


majistik

Recommended Posts

Documentation of the random arrow(from list) bow script:

 

"extends ReferenceAlias" is importent in quests! :whistling:

 

Scriptname ABRandomQuest extends ReferenceAlias

Weapon property GlassBowABRandom auto
Weapon property DaedricBowABRandom auto
Weapon property OrcishBowABRandom auto
Weapon property EbonyBowabRandom auto
Ammo Property ABArrowBigGreenhead  Auto
Ammo Property ABArrowBlack Auto
Ammo Property ABArrowBlackexp Auto
Ammo Property ABArrowBlackexpbig Auto
Ammo Property ABArrowblue Auto
Ammo Property ABArrowGreen Auto
Ammo Property ABArrowIce Auto
Ammo Property ABArrowIceExpL Auto
Ammo Property ABArrowIceExpS Auto
Ammo Property ABArrowOrange Auto
Ammo Property ABArrowOrangebaloon Auto
Ammo Property ABArrowRed Auto
Ammo Property ABArrowSmallRed Auto
Ammo Property ABArrowWhite Auto
Ammo Property ABArrowYellow Auto
Ammo Property ABArrowYellowfast Auto
Quest Property ABrandomBowQuest  Auto  

Ammo[] BirdsInInentoryArray
int RandomX
int NumOfBirdsNow
string BirdsString

Event OnInit()
NumOfBirdsNow = 0
BirdsInInentoryArray = new Ammo[16]
NumOfBirdsNow=GetNowCountAB()
EndEvent

int Function GetNowCountAB()

NumOfBirdsNow = 0
if (Game.GetPlayer().GetItemCount(ABArrowBigGreenhead) != 0)
 BirdsInInentoryArray[NumOfBirdsNow]=(ABArrowBigGreenhead)
 NumOfBirdsNow=NumOfBirdsNow+1
endIf
if (Game.GetPlayer().GetItemCount(ABArrowBlack) != 0)
 BirdsInInentoryArray[NumOfBirdsNow]=(ABArrowBlack)
 NumOfBirdsNow = NumOfBirdsNow+1
endIf
if (Game.GetPlayer().GetItemCount(ABArrowBlackexp) != 0)
 BirdsInInentoryArray[NumOfBirdsNow]=(ABArrowBlackexp)
 NumOfBirdsNow = NumOfBirdsNow+1
endIf
if (Game.GetPlayer().GetItemCount(ABArrowBlackexpbig) != 0)
 BirdsInInentoryArray[NumOfBirdsNow]=(ABArrowBlackexpbig)
 NumOfBirdsNow = NumOfBirdsNow+1
endIf
if (Game.GetPlayer().GetItemCount(ABArrowblue) != 0)
 BirdsInInentoryArray[NumOfBirdsNow]=(ABArrowblue)
 NumOfBirdsNow = NumOfBirdsNow+1
endIf
if (Game.GetPlayer().GetItemCount(ABArrowGreen) != 0)
 BirdsInInentoryArray[NumOfBirdsNow]=(ABArrowGreen)
 NumOfBirdsNow = NumOfBirdsNow+1
endIf
if (Game.GetPlayer().GetItemCount(ABArrowIce) != 0)
 BirdsInInentoryArray[NumOfBirdsNow]=(ABArrowIce)
 NumOfBirdsNow = NumOfBirdsNow+1
endIf
if (Game.GetPlayer().GetItemCount(ABArrowIceExpL) != 0)
 BirdsInInentoryArray[NumOfBirdsNow]=(ABArrowIceExpL)
 NumOfBirdsNow = NumOfBirdsNow+1
endIf
if (Game.GetPlayer().GetItemCount(ABArrowIceExpS) != 0)
 BirdsInInentoryArray[NumOfBirdsNow]=(ABArrowIceExpS)
 NumOfBirdsNow = NumOfBirdsNow+1
endIf
if (Game.GetPlayer().GetItemCount(ABArrowOrange) != 0)
 BirdsInInentoryArray[NumOfBirdsNow]=(ABArrowOrange)
 NumOfBirdsNow = NumOfBirdsNow+1
endIf
if (Game.GetPlayer().GetItemCount(ABArrowOrangebaloon) != 0)
 BirdsInInentoryArray[NumOfBirdsNow]=(ABArrowOrangebaloon)
 NumOfBirdsNow = NumOfBirdsNow+1
endIf
if (Game.GetPlayer().GetItemCount(ABArrowRed) != 0)
 BirdsInInentoryArray[NumOfBirdsNow]=(ABArrowRed)
 NumOfBirdsNow = NumOfBirdsNow+1
endIf
if (Game.GetPlayer().GetItemCount(ABArrowSmallRed) != 0)
 BirdsInInentoryArray[NumOfBirdsNow]=(ABArrowSmallRed)
 NumOfBirdsNow = NumOfBirdsNow+1
endIf
if (Game.GetPlayer().GetItemCount(ABArrowWhite) != 0)
 BirdsInInentoryArray[NumOfBirdsNow]=(ABArrowWhite)
 NumOfBirdsNow = NumOfBirdsNow+1
endIf
if (Game.GetPlayer().GetItemCount(ABArrowYellow) != 0)
 BirdsInInentoryArray[NumOfBirdsNow]=(ABArrowYellow)
 NumOfBirdsNow = NumOfBirdsNow+1
endIf
if (Game.GetPlayer().GetItemCount(ABArrowYellowfast) != 0)
 BirdsInInentoryArray[NumOfBirdsNow]=(ABArrowYellowfast)
 NumOfBirdsNow = NumOfBirdsNow+1
endIf
return NumOfBirdsNow
EndFunction

Event OnPlayerBowShot(Weapon akWeapon, Ammo akAmmo, float afPower, bool abSunGazing)
 if (akWeapon == (GlassBowABRandom) || akWeapon == (EbonyBowabRandom) || akWeapon == (OrcishBowABRandom) || akWeapon == (DaedricBowABRandom) )
   RandomX = Utility.RandomInt(1, NumOfBirdsNow) - 1

     if (Game.GetPlayer().GetItemCount(BirdsInInentoryArray[RandomX]) == 0)
       NumOfBirdsNow=GetNowCountAB()
       RandomX = Utility.RandomInt(1, NumOfBirdsNow) - 1
        if (NumOfBirdsNow == 1)
       Game.GetPlayer().EquipItem(BirdsInInentoryArray[0])
        endIf
     endIf

     if (NumOfBirdsNow > 1)
       Game.GetPlayer().EquipItem(BirdsInInentoryArray[RandomX])
     endIf

  endIf

endEvent

Edited by majistik
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...