Jump to content

Scripting issues (rather lack of knowledge issues)


yetibear

Recommended Posts

OK, Tried putting keywords onto formlists for a whole bunch of my boxes and it did not work, also tried putting a trigger box around container but it would not open the container at all.

 

I did think of using a separate switch but I have around 30 containers and the idea was to make the process of putting all the catagories of stuff away quicker and the switches ended up making it slower.

 

Thanks for the suggestion however any and all advice welcome, I think for now i'll just have to accept my shortcomings and keep working on the problem.

Link to comment
Share on other sites

Yeah, I mentioned in my edit on my last post that I tried using keywords in a formlist but it didn't work. For everything else, leave it as it is since the formlists will be a LOT faster. But for the potions try this.

Scriptname _TestAlchemyRemoverScript extends ObjectReference  

Container  Property _TestBarrel Auto
Message Property _TestMessage Auto
Formlist Property _PotionList Auto

Event OnActivate (ObjectReference AkActionRef)
     Int aiButton = _TestMessage.show()
     If ( aiButton == 0 )
          _TestBarrel.Activate(akActionRef)
     ElseIf ( aiButton == 1 )
          AkActionRef.RemoveItem(_PotionList, 999, true, _testBarrel)
          Int i = akActionRef.GetNumItems()
          While ( i > 0 )
               i -= 1
               If ( AkActionRef.GetNthForm(i).GetType() == 46 )
                    AkActionRef.RemoveItem(AkActionRef.GetNthForm(i), AkActionRef.GetItemCount(akActionRef.GetNthForm(i)), True, _TestBarrel)
               EndIf
          EndWhile
          Debug.Notification("Finished")
     EndIf
EndEvent

It'll remove all the standard potions (to make things faster), then it'll cycle through all items checking to see if they're type 46. GetType() is an SKSE function. You'll need the source files from SKSE (they come with it) in order for it to compile. As for putting a box around it, like I said, I've had nothing but problems trying that in the past. The buttons really are much easier to work with. You just drop one in, attach the script, set the properties, and you're done. The boxes seem to only work if they're exactly right. As for making it faster, if it's the size of the buttons, you can simply enlarge the buttons by holding s and dragging. If it's the speed at which they operate, use a dwemer button, not a lever. Lever have to move, buttons just activate (they do move, but not much).

 

As a final note, if you're just wanting to make putting things away easier, you could skip all of this and just use SJogga's scripts that you get from his mods page. I've already used them and they worked perfectly.

Link to comment
Share on other sites

Tried the keywords and it didn't work unfortunately,

 

Also tried to use a trigger, its removes the items from my inventory but doesn't add them to the box, they just vanish.

 

I have to confess this particular problem is beginning to rattle me a little.

 

The script only seems to work if it is put directly on the base object. which for some of my containers is a bit of a problem, things like cooked food has been made up to look like a buffet table but works like a container.

 

I'll keep working on it and hopefully i'll stumble onto the answer.

 

I have to confess I don't know what the while function is but I will give it a go and update as to weather or not it works.

 

 

 

Just added the script, it automatically stored all potions and food before selecting an option but still no crafted potions. I'm afraid it did not work.

Edited by yetibear
Link to comment
Share on other sites

The While function does this:

While (this is true)
   do this again and again
EndWhile

When it gets to the While in the code, it'll check if it's true just like an If. If it is, it'll run the inside section. The only difference between a While and an If is that when it's done with the enclosed section, it'll check again if it's true. If it is, it'll run it again. So, I set i to the number if items in the inventory of whoever activated it (it'll be the player). Then, as long as it's greater than 0 it'll keep running that section. But each time it runs, i is reduced by one. Each iteration, it checks the item in that slot of the inventory (which changes every time, since i is changing) to see if it's a potion. If it is, it removes the item in that slot, and the number it removes is however many of that item the person has.

 

If it's removing the items but not putting them in the right container, double-check that you've actually set the container property. That seems like the most likely reason that would happen.

Link to comment
Share on other sites

I have tried all of your suggestions and they all seem to leave crafted potions out and a few other bits and pieces iv'e come to notice, I suspect its just glitching out to be honest.

 

But You got me to thinking.. !!!!!!

 

Rather than a button to activate the box which seems a little immersion breaking I was thinking of using Sjogga's auto sort and loot script but rather than putting it on a button, putting it on a butler (give the goods to the butler he puts them away for you).

 

The only problem is that I don't know how to put the commands onto an NPC with a dialogue option to trigger it. I don't surpose you could help could you??

 

The auto store script I have at the moment is going to stay on the boxes in my little test house ( Diddy ) which I will be posting soon. In no small part to the help of yourself and a few others as kind and helpful. so thanks again,

 

And again ny help is greatly appreciated.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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