Jump to content
We are aware aware of an issue with authentication on the site. See our status page for details. ×

JugX

Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by JugX

  1. I'm having a difficult time getting my object to apear in the creation kit. I created a throne in blender and exported it with the appropriate settings. I opened a mesh in nifskope that I previously confirmed does work. I then opened the mesh I created, copied the NiTriShapeData's from it and pasted them in the working mesh. I removed all the unwanted trishapes and assigned the propper children to the BSFaceNode. I linked the working lighting properties to the new trishapes and finally went through the node tree to make sure everything was alligned properly.

     

    Everything seemed to work, the texture displayed properly to the mesh in nifskope. After opening the creation kit I edited the base to a duplicated object select my newly created .nif file but the object is completely black. The lighting and shading effects work. They actually add a shiney gloss to the object but the texture is not there the object is just a glossy black shape of my mesh.

     

    Not sure if it's any help but below i included an image of the original mesh (left) and the created mesh (right).

     

    http://i.imgur.com/yNaKerh.jpg

     

    Any help would be much appriciated.

  2. Before I get started, let me explain exactly what I'm trying to do. I would like to be able to make a custom container that will display the object I am placing in it, just like a bookshelf. I was successfull in creating a potion rack by taking the 3 "playerbookshelf" scripts and replacing the word book with potion (old potion scripts were all buggered). There were a few other things like duplicating all the bookshelf keywords and triggers and renaming them to match the potion scripts but with a little trial and error it all finally worked. Click on the shelf place a potion in and it pops up right there on the shelf. Not so fast said the shield. I can't for the life of me, figure out what is keeping this same method from working on a Shield Rack. I will try to list all my steps as detailed as possible below in hopes that someone knows where my mistake was.

     

     

    • First I needed a default shield marker. The books and potions luckily already had one, but there is no substance to them, they are simply base items, referenced to a "Dummy.nif" model. In order to make one for the Shield Rack I extracted "dummyshield01.nif" from the meshes bwa. I then duplicated a standard Ebony Shield, edited the base by removing all data. I left the Items Biped Object listed as shield and kept the playable tab checked. It wouldn't let me drop it in to CK without it. Finally I changed the World Models to "dummyshield01.nif". This created a "DefaultShieldRackShieldMarker" which glowed orange just like the book and potion markers.

     

    • I then duplicated "PlayerBookShelfContainer", "PlayerBookShelfClickTrigger", and "PlayerBookshelfTrigger" and renamed them with the word "ShieldRack" in place of the word "BookShelf". I now have all 4 pieces required to create my shelf. Even though I have my triggers and containers created I still need quite a few keywords. So I create; "ShieldRackShield01-18","ShieldRackTrigger01-04", "ShieldRackContainer", and "ShieldRackClickTrigger". I created these keywords the same way I created the triggers, containers, and markers - by duplicating the bookshelf variants and renaming them.

     

    • This Part I'm not completely sure is nessasary but I did it anyways, just incase. By duplicating the bookshelf versions I created, "LItemShieldClutter", "ShieldRackFirstActivateMessage", ShieldRackNoMoreRoomMessage", ShieldRackNotAShieldMessage", "ShieldRackRoomLeftMessage", and Finally "ShieldRackGlobal" That pretty much wraps up the duplication part.

     

    • Next I needed 3 scripts; "PlayerShieldRackContainerScript", "PlayerShieldRackTriggerSCRIPT" and "PlayerShieldRackClickTriggerSCRIPT" (Note: the caps are important) I opened the scripts with notepad++ and replaced the word bookshelf, and book, with shieldrack and shield throughout each script. The caps are important here too so I search for specified caps. Example: ShieldRack replaces BookShelf, shield replaces book.

     

    • Now I should have all the components required to create my Shield Rack. For some reason CK wouldn't read the scripts i created to add them to my items so in order to get around that I dragged the originals I created out of the scripts folder and just created a new blank scripts on CK with the same name. After the scripts are created I then copied and pasted the content into them.

     

    Moment of Truth time here. I go to Compile the scripts. "PlayerShieldRackTrigger" success!, "PlayerShieldRackClickTrigger" success!, "PlayerShieldRackContainer" FAILED ><. Go figure... Thats the big script too. I have no typos in that script. It was copied straight from the bookshelf script. Below is the error recieved in the Compiler Output.

    Starting 1 compile threads for 1 
    files...
    Compiling 
    "PlayerShieldRackContainerScript"...
    C:\Program Files 
    (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PlayerShieldRackContainerScript.psc(228,16): 
    cannot convert to unknown type shield
    C:\Program Files 
    (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PlayerShieldRackContainerScript.psc(228,16): 
    cannot cast a form to a shield, types are incompatible
    C:\Program Files 
    (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PlayerShieldRackContainerScript.psc(244,16): 
    cannot convert to unknown type shield
    C:\Program Files 
    (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PlayerShieldRackContainerScript.psc(244,16): 
    cannot cast a form to a shield, types are incompatible
    No 
    output generated for PlayerShieldRackContainerScript, compilation 
    failed.
    Batch compile of 1 files finished. 0 succeeded, 1 
    failed.
    Failed on 
    PlayerShieldRackContainerScript
     

    

    

    

     

    "PlayerShieldRackContainerScript" Is in the clickable spoiler below.

     

     

     

     

    Scriptname PlayerShieldRackContainerScript extends ObjectReference
    import debug
    import utility
    Form Property LItemShieldClutter Auto
    {Clutter item list to fill the shelf with}
    Keyword Property ShieldRackShield01 Auto
    Keyword Property ShieldRackShield02 Auto
    Keyword Property ShieldRackShield03 Auto
    Keyword Property ShieldRackShield04 Auto
    Keyword Property ShieldRackShield05 Auto
    Keyword Property ShieldRackShield06 Auto
    Keyword Property ShieldRackShield07 Auto
    Keyword Property ShieldRackShield08 Auto
    Keyword Property ShieldRackShield09 Auto
    Keyword Property ShieldRackShield10 Auto
    Keyword Property ShieldRackShield11 Auto
    Keyword Property ShieldRackShield12 Auto
    Keyword Property ShieldRackShield13 Auto
    Keyword Property ShieldRackShield14 Auto
    Keyword Property ShieldRackShield15 Auto
    Keyword Property ShieldRackShield16 Auto
    Keyword Property ShieldRackShield17 Auto
    Keyword Property ShieldRackShield18 Auto
    Keyword Property ShieldRackTrigger01 Auto
    Keyword Property ShieldRackTrigger02 Auto
    Keyword Property ShieldRackTrigger03 Auto
    Keyword Property ShieldRackTrigger04 Auto
    {List of required Keywords}
    ObjectReference Property ShieldMarker01 Auto Hidden
    ObjectReference Property ShieldMarker02 Auto Hidden
    ObjectReference Property ShieldMarker03 Auto Hidden
    ObjectReference Property ShieldMarker04 Auto Hidden
    ObjectReference Property ShieldMarker05 Auto Hidden
    ObjectReference Property ShieldMarker06 Auto Hidden
    ObjectReference Property ShieldMarker07 Auto Hidden
    ObjectReference Property ShieldMarker08 Auto Hidden
    ObjectReference Property ShieldMarker09 Auto Hidden
    ObjectReference Property ShieldMarker10 Auto Hidden
    ObjectReference Property ShieldMarker11 Auto Hidden
    ObjectReference Property ShieldMarker12 Auto Hidden
    ObjectReference Property ShieldMarker13 Auto Hidden
    ObjectReference Property ShieldMarker14 Auto Hidden
    ObjectReference Property ShieldMarker15 Auto Hidden
    ObjectReference Property ShieldMarker16 Auto Hidden
    ObjectReference Property ShieldMarker17 Auto Hidden
    ObjectReference Property ShieldMarker18 Auto Hidden
    ObjectReference Property ShieldRackTrigger01Ref Auto Hidden
    ObjectReference Property ShieldRackTrigger02Ref Auto Hidden
    ObjectReference Property ShieldRackTrigger03Ref Auto Hidden
    ObjectReference Property ShieldRackTrigger04Ref Auto Hidden
    Int Property MaxShieldsAllowed Auto Hidden
    {Max shields allowed on this partciular shelf}
    Int Property CurrentShieldAmount Auto Hidden
    {The current amount of shields placed on the shelf}
    Form Property EmptyForm Auto Hidden
    {Null Form}
    ObjectReference Property EmptyRef Auto Hidden
    {Null Ref}
    Form Property CurrentShieldForm Auto Hidden
    {Shield Form we are working with at any one time}
    ObjectReference Property CurrentShieldRef Auto Hidden
    {Shield Ref we are working with at any one time}
    Form Property PlacedShield01 Auto Hidden
    Form Property PlacedShield02 Auto Hidden
    Form Property PlacedShield03 Auto Hidden
    Form Property PlacedShield04 Auto Hidden
    Form Property PlacedShield05 Auto Hidden
    Form Property PlacedShield06 Auto Hidden
    Form Property PlacedShield07 Auto Hidden
    Form Property PlacedShield08 Auto Hidden
    Form Property PlacedShield09 Auto Hidden
    Form Property PlacedShield10 Auto Hidden
    Form Property PlacedShield11 Auto Hidden
    Form Property PlacedShield12 Auto Hidden
    Form Property PlacedShield13 Auto Hidden
    Form Property PlacedShield14 Auto Hidden
    Form Property PlacedShield15 Auto Hidden
    Form Property PlacedShield17 Auto Hidden
    Form Property PlacedShield16 Auto Hidden
    Form Property PlacedShield18 Auto Hidden
    {List of Placed Shield Forms}
    ObjectReference Property PlacedShield01Ref Auto Hidden
    ObjectReference Property PlacedShield02Ref Auto Hidden
    ObjectReference Property PlacedShield03Ref Auto Hidden
    ObjectReference Property PlacedShield04Ref Auto Hidden
    ObjectReference Property PlacedShield05Ref Auto Hidden
    ObjectReference Property PlacedShield06Ref Auto Hidden
    ObjectReference Property PlacedShield07Ref Auto Hidden
    ObjectReference Property PlacedShield08Ref Auto Hidden
    ObjectReference Property PlacedShield09Ref Auto Hidden
    ObjectReference Property PlacedShield10Ref Auto Hidden
    ObjectReference Property PlacedShield11Ref Auto Hidden
    ObjectReference Property PlacedShield12Ref Auto Hidden
    ObjectReference Property PlacedShield13Ref Auto Hidden
    ObjectReference Property PlacedShield14Ref Auto Hidden
    ObjectReference Property PlacedShield15Ref Auto Hidden
    ObjectReference Property PlacedShield17Ref Auto Hidden
    ObjectReference Property PlacedShield16Ref Auto Hidden
    ObjectReference Property PlacedShield18Ref Auto Hidden
    {List of Placed Shield Refs}
    Bool Property AlreadyLoaded = FALSE Auto Hidden
    {Whether this scritp has already went through it's OnCellLoad() Event}
    Bool Property BlockShields = FALSE Auto Hidden
    {Used for when you can't place any more shields}
    Message Property ShieldRackFirstActivateMESSAGE Auto
    {Display message when the player activates a shieldrack for the first time.  Only displays once.}
    Message Property ShieldRackNoMoreRoomMESSAGE Auto
    {Displayed message for when the amount of shields the player is placing excedes the shelf limit.}
    Message Property ShieldRackNotAShieldMESSAGE Auto
    {Message displayed when the player places a non shield form in the container.}
    Message Property ShieldRackRoomLeftMESSAGE Auto
    {Notification that tells the player how much room is left on the shelf upon first activating it.}
    GlobalVariable Property ShieldRackGlobal Auto
    {Global showing whether or not the player has ever activated a shieldrack}
    
    EVENT OnCellLoad()
     if AlreadyLoaded == FALSE
      ;Trace("SHIELDCASE - Running OnCellLoad()")
      ; Get all the shield markers
      ShieldMarker01 = GetLinkedRef(ShieldRackShield01)
      ShieldMarker02 = GetLinkedRef(ShieldRackShield02)
      ShieldMarker03 = GetLinkedRef(ShieldRackShield03)
      ShieldMarker04 = GetLinkedRef(ShieldRackShield04)
      ShieldMarker05 = GetLinkedRef(ShieldRackShield05)
      ShieldMarker06 = GetLinkedRef(ShieldRackShield06)
      ShieldMarker07 = GetLinkedRef(ShieldRackShield07)
      ShieldMarker08 = GetLinkedRef(ShieldRackShield08)
      ShieldMarker09 = GetLinkedRef(ShieldRackShield09)
      ShieldMarker10 = GetLinkedRef(ShieldRackShield10)
      ShieldMarker11 = GetLinkedRef(ShieldRackShield11)
      ShieldMarker12 = GetLinkedRef(ShieldRackShield12)
      ShieldMarker13 = GetLinkedRef(ShieldRackShield13)
      ShieldMarker14 = GetLinkedRef(ShieldRackShield14)
      ShieldMarker15 = GetLinkedRef(ShieldRackShield15)
      ShieldMarker16 = GetLinkedRef(ShieldRackShield16)
      ShieldMarker17 = GetLinkedRef(ShieldRackShield17)
      ShieldMarker18 = GetLinkedRef(ShieldRackShield18)
      ShieldRackTrigger01Ref = (GetLinkedRef(ShieldRackTrigger01) as PlayerShieldRackTriggerSCRIPT)
      ShieldRackTrigger02Ref = (GetLinkedRef(ShieldRackTrigger02) as PlayerShieldRackTriggerSCRIPT)
      ShieldRackTrigger03Ref = (GetLinkedRef(ShieldRackTrigger03) as PlayerShieldRackTriggerSCRIPT)
      ShieldRackTrigger04Ref = (GetLinkedRef(ShieldRackTrigger04) as PlayerShieldRackTriggerSCRIPT)
      ; Count how many shields can be placed on this shelf
      CountMaxShields()
      AlreadyLoaded = TRUE
     endif
    endEVENT
     
    EVENT OnActivate(ObjectReference akActionRef)
     ; Removing all items from container as a precaution
     ;Trace("SHIELDCASE - I've been ACTIVATED!")
     BlockActivate()
     ;Trace("SHIELDCASE - Blocking activate on all shields")
     ;Trace("SHIELDCASE - ShieldRackTrigger01Ref = " + ShieldRackTrigger01Ref)
     ShieldRackRoomLeftMESSAGE.Show((MaxShieldsAllowed - CurrentShieldAmount))
     ;debug.Notification("You can place " + (MaxShieldsAllowed - CurrentShieldAmount) + " more shields on this shelf.")
     if (ShieldRackGlobal.GetValue() == 0)
      ShieldRackFirstActivateMESSAGE.Show()
      ShieldRackGlobal.SetValue(1)
     endif
     ;CurrentShieldAmount = 0
     if ShieldRackTrigger01Ref
      ;Trace("SHIELDCASE - Setting FIRST trigger to GoToState IgnoreShields")
      ShieldRackTrigger01Ref.GoToState("IgnoreShields")
     endif
     if ShieldRackTrigger02Ref
      ;Trace("SHIELDCASE - Setting SECOND trigger to GoToState IgnoreShields")
      ShieldRackTrigger02Ref.GoToState("IgnoreShields")
     endif
     if ShieldRackTrigger03Ref
      ;Trace("SHIELDCASE - Setting THIRD trigger to GoToState IgnoreShields")
      ShieldRackTrigger03Ref.GoToState("IgnoreShields")
     endif
     if ShieldRackTrigger04Ref
      ;Trace("SHIELDCASE - Setting FOURTH trigger to GoToState IgnoreShields")
      ShieldRackTrigger04Ref.GoToState("IgnoreShields")
     endif
     Wait(0.25)
     ; The following will fire when the player leaves inventory
     ;Trace("SHIELDCASE - Out of Inventory so placing all the shields")
     UpdateShields()
     if ShieldRackTrigger01Ref
      ;Trace("SHIELDCASE - Setting FIRST trigger to GoToState WaitForShields")
      ShieldRackTrigger01Ref.GoToState("WaitForShields")
     endif
     if ShieldRackTrigger02Ref
      ;Trace("SHIELDCASE - Setting SECOND trigger to GoToState WaitForShields")
      ShieldRackTrigger02Ref.GoToState("WaitForShields")
     endif
     if ShieldRackTrigger03Ref
      ;Trace("SHIELDCASE - Setting THIRD trigger to GoToState WaitForShields")
      ShieldRackTrigger03Ref.GoToState("WaitForShields")
     endif
     if ShieldRackTrigger04Ref
      ;Trace("SHIELDCASE - Setting FOURTH trigger to GoToState WaitForShields")
      ShieldRackTrigger04Ref.GoToState("WaitForShields")
     endif
    endEVENT
    
    Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)
     if (akBaseItem as Shield)
      if BlockShields == FALSE
       ; If the item is a shield find the corresponding shield reference and remove it.
       ;Trace("SHIELDCASE - Form being Removed " + akBaseItem + " is a Shield! Remove it from the list")
       RemoveShields(akBaseItem, aiItemCount)
       CurrentShieldAmount = CurrentShieldAmount - aiItemCount
      else
       BlockShields = FALSE
      endif
     endif
    endEvent
    
    Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
     ;Trace("SHIELDCASE - Adding " + akBaseItem + " to the Shield Container")
     
     if (akBaseItem as Shield)
      ; If the item being added is a shield then check to see if there is room in on the shelf.
      ;Trace("SHIELDCASE - Form being Added " + akBaseItem + " is a Shield!")
      if ((aiItemCount + CurrentShieldAmount) <= MaxShieldsAllowed)
       ; There's room on teh shelf, manage the shield placement
       ;Trace("SHIELDCASE - " + CurrentShieldAmount + "/" + MaxShieldsAllowed + " There is room for another shield, lets place it on the shelf.")
       AddShields(akBaseItem, aiItemCount)
       CurrentShieldAmount = CurrentShieldAmount + aiItemCount
      else
       ; There is no room on the shelf.  Tell the player this and give him his shield back.
       ;Trace("SHIELDCASE - " + CurrentShieldAmount + "/" + MaxShieldsAllowed + " There's no more room for shields on this shelf.")
       utility.waitMenuMode(0)
       ;MessageBox("You can't place that many shields on this shelf")
       ShieldRackNoMoreRoomMESSAGE.Show()
       ;Trace("SHIELDCASE - Remove it from this container...")
       BlockShields = TRUE
       self.RemoveItem(akBaseItem, aiItemCount, true, Game.GetPlayer())
       ;Trace("SHIELDCASE - ...and give it back to the player")
      endif
     else
      ; The item placed in the container isn't a shield, so give the player back and tell him only shields are allowed.
      ;Trace("SHIELDCASE - Form " + akBaseItem + " is NOT a Shield!")
      ;Trace("SHIELDCASE - Since the placed item wasn't a shield remove it from the container...")
      self.RemoveItem(akBaseItem, aiItemCount, true, Game.GetPlayer())
      ;Trace("SHIELDCASE - ...and give it back to the player")
      ;(Game.GetPlayer()).AddItem(akBaseItem, aiItemCount, True)
      utility.WaitMenuMode(0)
      ;MessageBox("You can only place shields on this shelf")
      ShieldRackNotAShieldMESSAGE.Show()
     endif
     
    endEvent
    Function BlockActivate()
     if Placedshield01Ref
      PlacedShield01Ref.BlockActivation(TRUE)
     endif
     if Placedshield02Ref
      PlacedShield02Ref.BlockActivation(TRUE)
     endif
     if Placedshield03Ref
      PlacedShield03Ref.BlockActivation(TRUE)
     endif
     if Placedshield04Ref
      PlacedShield04Ref.BlockActivation(TRUE)
     endif
     if Placedshield05Ref
      PlacedShield05Ref.BlockActivation(TRUE)
     endif
     if Placedshield06Ref
      PlacedShield06Ref.BlockActivation(TRUE)
     endif
     if Placedshield07Ref
      PlacedShield07Ref.BlockActivation(TRUE)
     endif
     if Placedshield08Ref
      PlacedShield08Ref.BlockActivation(TRUE)
     endif
     if Placedshield09Ref
      PlacedShield09Ref.BlockActivation(TRUE)
     endif
     if Placedshield10Ref
      PlacedShield10Ref.BlockActivation(TRUE)
     endif
     if Placedshield11Ref
      PlacedShield11Ref.BlockActivation(TRUE)
     endif
     if Placedshield12Ref
      PlacedShield12Ref.BlockActivation(TRUE)
     endif
     if Placedshield13Ref
      PlacedShield13Ref.BlockActivation(TRUE)
     endif
     if Placedshield14Ref
      PlacedShield14Ref.BlockActivation(TRUE)
     endif
     if Placedshield15Ref
      PlacedShield15Ref.BlockActivation(TRUE)
     endif
     if Placedshield16Ref
      PlacedShield16Ref.BlockActivation(TRUE)
     endif
     if Placedshield17Ref
      PlacedShield17Ref.BlockActivation(TRUE)
     endif
     if Placedshield18Ref
      PlacedShield18Ref.BlockActivation(TRUE)
     endif
     ;Trace("SHIELDCASE - All shield activation has been blocked")
    endFunction
    Function UnBlockActivate()
     if Placedshield01Ref
      PlacedShield01Ref.BlockActivation(FALSE)
     endif
     if Placedshield02Ref
      PlacedShield02Ref.BlockActivation(FALSE)
     endif
     if Placedshield03Ref
      PlacedShield03Ref.BlockActivation(FALSE)
     endif
     if Placedshield04Ref
      PlacedShield04Ref.BlockActivation(FALSE)
     endif
     if Placedshield05Ref
      PlacedShield05Ref.BlockActivation(FALSE)
     endif
     if Placedshield06Ref
      PlacedShield06Ref.BlockActivation(FALSE)
     endif
     if Placedshield07Ref
      PlacedShield07Ref.BlockActivation(FALSE)
     endif
     if Placedshield08Ref
      PlacedShield08Ref.BlockActivation(FALSE)
     endif
     if Placedshield09Ref
      PlacedShield09Ref.BlockActivation(FALSE)
     endif
     if Placedshield10Ref
      PlacedShield10Ref.BlockActivation(FALSE)
     endif
     if Placedshield11Ref
      PlacedShield11Ref.BlockActivation(FALSE)
     endif
     if Placedshield12Ref
      PlacedShield12Ref.BlockActivation(FALSE)
     endif
     if Placedshield13Ref
      PlacedShield13Ref.BlockActivation(FALSE)
     endif
     if Placedshield14Ref
      PlacedShield14Ref.BlockActivation(FALSE)
     endif
     if Placedshield15Ref
      PlacedShield15Ref.BlockActivation(FALSE)
     endif
     if Placedshield16Ref
      PlacedShield16Ref.BlockActivation(FALSE)
     endif
     if Placedshield17Ref
      PlacedShield17Ref.BlockActivation(FALSE)
     endif
     if Placedshield18Ref
      PlacedShield18Ref.BlockActivation(FALSE)
     endif
     ;Trace("SHIELDCASE - All shield activation has been UNblocked")
    endFunction
    
    Function RemoveShields(Form ShieldBase, Int ShieldAmount)
     ; Find an empty shield form and place the new shield there
     While ShieldAmount > 0
      if PlacedShield01 == ShieldBase
       ;Trace("SHIELDCASE - PlacedShield01 matches, Removing this shield")
       PlacedShield01 = EmptyForm
      elseif PlacedShield02 == ShieldBase
       ;Trace("SHIELDCASE - PlacedShield02 matches, Removing this shield")
       PlacedShield02 = EmptyForm
      elseif PlacedShield03 == ShieldBase
       ;Trace("SHIELDCASE - PlacedShield03 matches, Removing this shield")
       PlacedShield03 = EmptyForm
      elseif PlacedShield04 == ShieldBase
       ;Trace("SHIELDCASE - PlacedShield04 matches, Removing this shield")
       PlacedShield04 = EmptyForm
      elseif PlacedShield05 == ShieldBase
       ;Trace("SHIELDCASE - PlacedShield05 matches, Removing this shield")
       PlacedShield05 = EmptyForm
      elseif PlacedShield06 == ShieldBase
       ;Trace("SHIELDCASE - PlacedShield06 matches, Removing this shield")
       PlacedShield06 = EmptyForm
      elseif PlacedShield07 == ShieldBase
       ;Trace("SHIELDCASE - PlacedShield07 matches, Removing this shield")
       PlacedShield07 = EmptyForm
      elseif PlacedShield08 == ShieldBase
       ;Trace("SHIELDCASE - PlacedShield08 matches, Removing this shield")
       PlacedShield08 = EmptyForm
      elseif PlacedShield09 == ShieldBase
       ;Trace("SHIELDCASE - PlacedShield09 matches, Removing this shield")
       PlacedShield09 = EmptyForm
      elseif PlacedShield10 == ShieldBase
       ;Trace("SHIELDCASE - PlacedShield10 matches, Removing this shield")
       PlacedShield10 = EmptyForm
      elseif PlacedShield11 == ShieldBase
       ;Trace("SHIELDCASE - PlacedShield11 matches, Removing this shield")
       PlacedShield11 = EmptyForm
      elseif PlacedShield12 == ShieldBase
       ;Trace("SHIELDCASE - PlacedShield12 matches, Removing this shield")
       PlacedShield12 = EmptyForm
      elseif PlacedShield13 == ShieldBase
       ;Trace("SHIELDCASE - PlacedShield13 matches, Removing this shield")
       PlacedShield13 = EmptyForm
      elseif PlacedShield14 == ShieldBase
       ;Trace("SHIELDCASE - PlacedShield14 matches, Removing this shield")
       PlacedShield14 = EmptyForm
      elseif PlacedShield15 == ShieldBase
       ;Trace("SHIELDCASE - PlacedShield15 matches, Removing this shield")
       PlacedShield15 = EmptyForm
      elseif PlacedShield16 == ShieldBase
       ;Trace("SHIELDCASE - PlacedShield16 matches, Removing this shield")
       PlacedShield16 = EmptyForm
      elseif PlacedShield17 == ShieldBase
       ;Trace("SHIELDCASE - PlacedShield17 matches, Removing this shield")
       PlacedShield17 = EmptyForm
      elseif PlacedShield18 == ShieldBase
       ;Trace("SHIELDCASE - PlacedShield18 matches, Removing this shield")
       PlacedShield18 = EmptyForm
      endif
         ShieldAmount = ShieldAmount - 1
     endWhile
    endFunction
    Function AddShields(Form ShieldBase, Int ShieldAmount)
     ; Find an empty shield form and place the new shield there
     While ShieldAmount > 0
      if PlacedShield01 == EmptyForm
       ;Trace("SHIELDCASE - PlacedShield01 is empty, placing shield there")
       PlacedShield01 = ShieldBase
      elseif PlacedShield02 == EmptyForm
       ;Trace("SHIELDCASE - PlacedShield02 is empty, placing shield there")
       PlacedShield02 = ShieldBase
      elseif PlacedShield03 == EmptyForm
       ;Trace("SHIELDCASE - PlacedShield03 is empty, placing shield there")
       PlacedShield03 = ShieldBase
      elseif PlacedShield04 == EmptyForm
       ;Trace("SHIELDCASE - PlacedShield04 is empty, placing shield there")
       PlacedShield04 = ShieldBase
      elseif PlacedShield05 == EmptyForm
       ;Trace("SHIELDCASE - PlacedShield05 is empty, placing shield there")
       PlacedShield05 = ShieldBase
      elseif PlacedShield06 == EmptyForm
       ;Trace("SHIELDCASE - PlacedShield06 is empty, placing shield there")
       PlacedShield06 = ShieldBase
      elseif PlacedShield07 == EmptyForm
       ;Trace("SHIELDCASE - PlacedShield07 is empty, placing shield there")
       PlacedShield07 = ShieldBase
      elseif PlacedShield08 == EmptyForm
       ;Trace("SHIELDCASE - PlacedShield08 is empty, placing shield there")
       PlacedShield08 = ShieldBase
      elseif PlacedShield09 == EmptyForm
       ;Trace("SHIELDCASE - PlacedShield09 is empty, placing shield there")
       PlacedShield09 = ShieldBase
      elseif PlacedShield10 == EmptyForm
       ;Trace("SHIELDCASE - PlacedShield10 is empty, placing shield there")
       PlacedShield10 = ShieldBase
      elseif PlacedShield11 == EmptyForm
       ;Trace("SHIELDCASE - PlacedShield11 is empty, placing shield there")
       PlacedShield11 = ShieldBase
      elseif PlacedShield12 == EmptyForm
       ;Trace("SHIELDCASE - PlacedShield12 is empty, placing shield there")
       PlacedShield12 = ShieldBase
      elseif PlacedShield13 == EmptyForm
       ;Trace("SHIELDCASE - PlacedShield13 is empty, placing shield there")
       PlacedShield13 = ShieldBase
      elseif PlacedShield14 == EmptyForm
       ;Trace("SHIELDCASE - PlacedShield14 is empty, placing shield there")
       PlacedShield14 = ShieldBase
      elseif PlacedShield15 == EmptyForm
       ;Trace("SHIELDCASE - PlacedShield15 is empty, placing shield there")
       PlacedShield15 = ShieldBase
      elseif PlacedShield16 == EmptyForm
       ;Trace("SHIELDCASE - PlacedShield16 is empty, placing shield there")
       PlacedShield16 = ShieldBase
      elseif PlacedShield17 == EmptyForm
       ;Trace("SHIELDCASE - PlacedShield17 is empty, placing shield there")
       PlacedShield17 = ShieldBase
      elseif PlacedShield18 == EmptyForm
       ;Trace("SHIELDCASE - PlacedShield18 is empty, placing shield there")
       PlacedShield18 = ShieldBase
      endif
      
         ShieldAmount = ShieldAmount - 1
     endWhile
    endFunction
    
    Function CountMaxShields()
     ; Checks how many shields can be placed on this shelf
     if ShieldMarker01 == EmptyRef
      MaxShieldsAllowed = 0
     elseif ShieldMarker02 == EmptyRef
      MaxShieldsAllowed = 1
     elseif ShieldMarker03 == EmptyRef
      MaxShieldsAllowed = 2
     elseif ShieldMarker04 == EmptyRef
      MaxShieldsAllowed = 3
     elseif ShieldMarker05 == EmptyRef
      MaxShieldsAllowed = 4
     elseif ShieldMarker06 == EmptyRef
      MaxShieldsAllowed = 5
     elseif ShieldMarker07 == EmptyRef
      MaxShieldsAllowed = 6
     elseif ShieldMarker08 == EmptyRef
      MaxShieldsAllowed = 7
     elseif ShieldMarker09 == EmptyRef
      MaxShieldsAllowed = 8
     elseif ShieldMarker10 == EmptyRef
      MaxShieldsAllowed = 9
     elseif ShieldMarker11 == EmptyRef
      MaxShieldsAllowed = 10
     elseif ShieldMarker12 == EmptyRef
      MaxShieldsAllowed = 11
     elseif ShieldMarker13 == EmptyRef
      MaxShieldsAllowed = 12
     elseif ShieldMarker14 == EmptyRef
      MaxShieldsAllowed = 13
     elseif ShieldMarker15 == EmptyRef
      MaxShieldsAllowed = 14
     elseif ShieldMarker16 == EmptyRef
      MaxShieldsAllowed = 15
     elseif ShieldMarker17 == EmptyRef
      MaxShieldsAllowed = 16
     elseif ShieldMarker18 == EmptyRef
      MaxShieldsAllowed = 17
     elseif ShieldMarker18
      MaxShieldsAllowed = 18
     endif
     ;Trace("SHIELDCASE - " + MaxShieldsAllowed + " shields can be placed on this shelf")
    endFunction
    
    ObjectReference Function UpdateSingleShield(Form TargetShield, ObjectReference PlacedShieldRef, ObjectReference TargetMarker)
     ObjectReference retVal ; We return the shield we placed (or None)
     ; Note - it would be more efficient to move the shield to its home position if the desired
     ; shield matches the placed shield, but MoveTo doesn't work correctly with multi-part dynamic
     ; objects. So we sidestep the issue by always deleting and placing
     if PlacedShieldRef
      PlacedShieldRef.Disable()
      PlacedShieldRef.Delete()
     endIf
     if TargetShield
      retVal = TargetMarker.PlaceAtMe(TargetShield)
      retVal.BlockActivation()
     endIf
     return retVal
    EndFunction
    
    Function UpdateShields()
     GoToState("PlacingShields") ; Future calls should not mess with this stuff
     
     PlacedShield01Ref = UpdateSingleShield(PlacedShield01, PlacedShield01Ref, ShieldMarker01)
     PlacedShield02Ref = UpdateSingleShield(PlacedShield02, PlacedShield02Ref, ShieldMarker02)
     PlacedShield03Ref = UpdateSingleShield(PlacedShield03, PlacedShield03Ref, ShieldMarker03)
     PlacedShield04Ref = UpdateSingleShield(PlacedShield04, PlacedShield04Ref, ShieldMarker04)
     PlacedShield05Ref = UpdateSingleShield(PlacedShield05, PlacedShield05Ref, ShieldMarker05)
     
     PlacedShield06Ref = UpdateSingleShield(PlacedShield06, PlacedShield06Ref, ShieldMarker06)
     PlacedShield07Ref = UpdateSingleShield(PlacedShield07, PlacedShield07Ref, ShieldMarker07)
     PlacedShield08Ref = UpdateSingleShield(PlacedShield08, PlacedShield08Ref, ShieldMarker08)
     PlacedShield09Ref = UpdateSingleShield(PlacedShield09, PlacedShield09Ref, ShieldMarker09)
     PlacedShield10Ref = UpdateSingleShield(PlacedShield10, PlacedShield10Ref, ShieldMarker10)
     
     PlacedShield11Ref = UpdateSingleShield(PlacedShield11, PlacedShield11Ref, ShieldMarker11)
     PlacedShield12Ref = UpdateSingleShield(PlacedShield12, PlacedShield12Ref, ShieldMarker12)
     PlacedShield13Ref = UpdateSingleShield(PlacedShield13, PlacedShield13Ref, ShieldMarker13)
     PlacedShield14Ref = UpdateSingleShield(PlacedShield14, PlacedShield14Ref, ShieldMarker14)
     PlacedShield15Ref = UpdateSingleShield(PlacedShield15, PlacedShield15Ref, ShieldMarker15)
     
     PlacedShield16Ref = UpdateSingleShield(PlacedShield16, PlacedShield16Ref, ShieldMarker16)
     PlacedShield17Ref = UpdateSingleShield(PlacedShield17, PlacedShield17Ref, ShieldMarker17)
     PlacedShield18Ref = UpdateSingleShield(PlacedShield18, PlacedShield18Ref, ShieldMarker18)
     
     UnBlockActivate() ; Allow the player to mess with them
     GoToState("") ; Now allow shields to be updated again
    EndFunction
    State PlacingShields
     Function UpdateShields()
      ; Already updating shields, so ignore
     EndFunction
    EndState
    
    

×
×
  • Create New...