CodeCodeCode

Skyrim Papyrus Script

Aug 10th, 2012
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.73 KB | None | 0 0
  1. Function TrySellStorage(ObjectReference akSourceContainer = None, Int aiIndex = 0, Form akForm = None)
  2.     aiIndex = akSourceContainer.GetNumItems()
  3.  
  4.     If (aiIndex >= 1) ;Objects exist in storage container
  5.         While (aiIndex > 0)
  6.             aiIndex -= 1
  7.             akForm = akSourceContainer.GetNthForm(aiIndex)
  8.             Int counter = akSourceContainer.GetItemCount(akForm)
  9.  
  10.             While (counter >= 1) ;same object type still exists
  11.                 counter -= 1
  12.  
  13.                 If (akForm.GetGoldValue() <= 5)
  14.                     If (Utility.RandomInt(1,100) <= 95)
  15.                         SeptimsSold += akForm.GetGoldValue()
  16.                         akSourceContainer.RemoveItem(akForm, 1)
  17.                     EndIf
  18.                 ElseIf ((akForm.GetGoldValue() >= 6) &&  (akForm.GetGoldValue() <= 20))
  19.                     If (Utility.RandomInt(1,100) <= 90)
  20.                         SeptimsSold += akForm.GetGoldValue()
  21.                         akSourceContainer.RemoveItem(akForm, 1)
  22.                     EndIf
  23.                 ElseIf ((akForm.GetGoldValue() >= 21) &&  (akForm.GetGoldValue() <= 50))
  24.                     If (Utility.RandomInt(1,100) <= 75)
  25.                         SeptimsSold += akForm.GetGoldValue()
  26.                         akSourceContainer.RemoveItem(akForm, 1)
  27.                     EndIf
  28.                 ElseIf ((akForm.GetGoldValue() >= 51) &&  (akForm.GetGoldValue() <= 100))
  29.                     If (Utility.RandomInt(1,100) <= 50)
  30.                         SeptimsSold += akForm.GetGoldValue()
  31.                         akSourceContainer.RemoveItem(akForm, 1)
  32.                     EndIf
  33.                 ElseIf ((akForm.GetGoldValue() >= 101) &&  (akForm.GetGoldValue() <= 250))
  34.                     If (Utility.RandomInt(1,100) <= 40)
  35.                         SeptimsSold += akForm.GetGoldValue()
  36.                         akSourceContainer.RemoveItem(akForm, 1)
  37.                     EndIf
  38.                 ElseIf ((akForm.GetGoldValue() >= 251) &&  (akForm.GetGoldValue() <= 500))
  39.                     If (Utility.RandomInt(1,100) <= 30)
  40.                         SeptimsSold += akForm.GetGoldValue()
  41.                         akSourceContainer.RemoveItem(akForm, 1)
  42.                     EndIf
  43.                 ElseIf ((akForm.GetGoldValue() >= 501) &&  (akForm.GetGoldValue() <= 750))
  44.                     If (Utility.RandomInt(1,100) <= 20)
  45.                         SeptimsSold += akForm.GetGoldValue()
  46.                         akSourceContainer.RemoveItem(akForm, 1)
  47.                     EndIf
  48.                 ElseIf ((akForm.GetGoldValue() >= 751) &&  (akForm.GetGoldValue() <= 1000))
  49.                     If (Utility.RandomInt(1,100) <= 10)
  50.                         SeptimsSold += akForm.GetGoldValue()
  51.                         akSourceContainer.RemoveItem(akForm, 1)
  52.                     EndIf
  53.                 ElseIf (akForm.GetGoldValue() >= 1001)
  54.                     If (Utility.RandomInt(1,100) <= 5)
  55.                         SeptimsSold += akForm.GetGoldValue()
  56.                         akSourceContainer.RemoveItem(akForm, 1)
  57.                     EndIf
  58.                 EndIf
  59.  
  60.                 ;
  61.                 ;If (akForm.GetType() == 23) ;if object is scroll
  62.                 ;   ; calc scroll shit
  63.                 ;ElseIf (akForm.GetType() == 26) ;if object is armor
  64.                 ;   ;Armor TestArmor = akForm as Armor
  65.                 ;
  66.                 ;   If ((akForm as Armor).IsJewelry())
  67.                 ;       If (Utility.RandomInt(1,100) <= 30)
  68.                 ;           akSourceContainer.RemoveItem(akForm, 1)
  69.                 ;       EndIf
  70.                 ;   EndIf
  71.                 ;EndIf
  72.             EndWhile
  73.         EndWhile
  74.     EndIf
  75. EndFunction
Advertisement
Add Comment
Please, Sign In to add comment