Jump to content

Help with a script on container


0ogieBoogie

Recommended Posts

I'm new to scripting and have a lot to learn. Just started teaching myself a few months ago :happy: . I'm trying to inject a leveled list into a container based on the location of the container. I added the script to the container. When I use IsInLocation() and the specific location, it works fine. However, if i use GetCurrentLocation and a formlist with the locations it does not. I'm sure it's something easy that I just don't know yet. Was hoping someone could point me in the right direction. Here's what I did.

Scriptname OB_LootFilter extends ObjectReference

FormList Property LocationHousing Auto
LeveledItem Property OB_LLC_ToolBox_Default Auto
LeveledItem Property OB_LLC_ToolBox_Housing Auto

Auto State StartFilter
    Event OnLoad()
        If LocationHousing.HasForm(Self.GetCurrentLocation())
            Self.AddItem(OB_LLC_ToolBox_Housing)
        Else
            Self.AddItem(OB_LLC_ToolBox_Default)
        EndIf
        GoToState("DoNothing")
    EndEvent
EndState

State DoNothing
    Event OnLoad()
    EndEvent
EndState
Link to comment
Share on other sites

To see what is going on enable debugg logging and become friendly with the Debug.Trace command:

Event OnLoad()

Debug.Trace("OB_LootFilter.OnLoad " + Self + " " + Self.GetCurrentLocation())
		
Int iIndex = 0
  While (iIndex < LocationHousing.GetSize())
  Debug.Trace("OB_LootFilter.LocationHousing " + iIndex + " " + LocationHousing.GetAt(iIndex) as Location)
  iIndex +=1
EndWhile 
		
;your original stuff here 

EndEvent
Link to comment
Share on other sites

Sweet thanks man! I've read so many posts with help you gave other people. Feel like you're a celebrity lol. I have a lot to learn and haven't really been checking myself with debug. That will help tremendously. I made some pretty awesome leveled lists that I want to dynamically place in containers based on the location. My ultimate goal is a mod that overhauls leveled lists and sorts items and and adds my own def_ui icons that I made.

Link to comment
Share on other sites

If your goiong to start moinitoring runtime debug logs I recommend free Mtail log monitor.

 

As long as your script names (for errors) and Debug.Trace always have a unique string (like SKK) it will fiter 'em out so you can watch it fly by rather than trying to pick it out of the base game detritus.

Link to comment
Share on other sites

Awesome! I'll check it out. Now that this thing works, I gotta figure out what the most efficient way is to distribute it. Not sure if I should place a variation of this on every base container or if I could do something else. My original idea was to use a quest and put a global on each leveled list that would pass depending on the location but I couldn't figure out how to use a quest script to tell a container to give me its location and set the value of the global accordingly. So I figured I would have to place it on each container.

Link to comment
Share on other sites

But then you miss the context of other errors in the compund log that may be relevant to a problem invetigation.

 

And time sorting/interleaving them back together is a bastard. Done that plenty, dont do that no more.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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