Jump to content

Question on Scripting: Are there any tutorials for form lists?


ZeroCore

Recommended Posts

To make a long story short, back in Skyrim, with a lot of help, I made a mod that used form lists to store the ID's of items that were placed into a container.

 

I want to make a similar thing for Fallout 4.

 

The thing is that the page I made for this was made so long ago that for some reason it's not on the forums anymore, and doesn't even show up in the lists of pages that I've started anymore.

 

To make a long story short, the old page is gone, and so is the help that I got on form lists before.

 

If anyone could help me out here, I'd appreciate it if someone could explain to me, or link me to a tutorial on, how to get the ID's of a container's contents, pass the ID's to a form list, and then call the form list later (the idea was to use a debug box to display the ID's of the form list).

 

I already know how to make a new form list. What I need to know now is this:

 

1: How do I get the ID's of items inside a container

 

2: Once gotten, how do I pass the ID's to a form list

 

If anyone could help me with this, I'd appreciate it.

 

 

Also, I know the wiki has basic info on them, but it's not specific enough for me. I'd really appreciate a more in-depth, practical look at how form lists work (best way to learn something is to watch someone do it, and then, with help and guidance, do it yourself over and over until you get it, if you ask me; practical is better than theoretical, IMO, when it comes to any skill, coding included).

Edited by ZeroCore
Link to comment
Share on other sites

For getting items this is what I got : ( keep in mind Im no pro so this is just something to go off of :tongue: )

 

Formlist Property FormlistToAddobjectsto auto

FormList Property YOURLISTOFOBJECTSTOCHECK auto

 

Container PlayerContainer = Game.getplayer().GetContainer()

 

int Zeroint = 0

 

While YOURLISTOFOBJECTSTOCHECK.getsize() > ZeroInt

 

if PlayerContainer.GetiTemCount( YOURLISTOFOBJECTSTOCHECK.getat(ZeroInt)) >= 1

 

FormlistToAddobjectsto.addform( YOURLISTOFOBJECTSTOCHECK.getat(ZeroInt))

 

 

Endif

Zeroint += 1

EndWhile

 

 

So this gets the item count of a object and if its greater than or equal to 1 it gets the form and adds it to the formlist.

There might be a better way to do this but as far as Im aware its the only way(in my opinion this way is over complicated) gl

Edited by ajs52698
Link to comment
Share on other sites

For getting items this is what I got : ( keep in mind Im no pro so this is just something to go off of :tongue: )

 

Formlist Property FormlistToAddobjectsto auto

FormList Property YOURLISTOFOBJECTSTOCHECK auto

 

Container PlayerContainer = Game.getplayer().GetContainer()

 

int Zeroint = 0

 

While YOURLISTOFOBJECTSTOCHECK.getsize() > ZeroInt

 

if PlayerContainer.GetiTemCount( YOURLISTOFOBJECTSTOCHECK.getat(ZeroInt)) >= 1

 

FormlistToAddobjectsto.addform( YOURLISTOFOBJECTSTOCHECK.getat(ZeroInt))

 

 

Endif

Zeroint += 1

EndWhile

 

 

So this gets the item count of a object and if its greater than or equal to 1 it gets the form and adds it to the formlist.

There might be a better way to do this but as far as Im aware its the only way(in my opinion this way is over complicated) gl

 

 

I see you have two form list property references. Are they both filled by the same thing, or have I misread something?

 

Whilst I'm on that; why do you need a second form list in this at all (namely "YOURLISTOFOBJECTSTOCHECK")? I don't see anything being added to it other than you using it as a stand in for an array that gets the size of the player's inventory and then cycles through each address.

 

Also, here's my question; your loop skips address zero in the conditional statement. What's at address zero that you don't want counted?

 

Depends on what kind of ID you want.

 

Getting the EditorID or the name of the form is not possible(maybe never) right now. You can get the FormID though.

 

 

Not entirely sure then, now that you mention it (I always get these ID identities confused). What I really plan on doing is to make essentially a replicator of sorts, the same thing that I did in that skyrim mod I mentioned before; you put an item into a locker, box, or other container, flip a lever which triggers an attached script, the script then gets the ID's of the contents of the box, adds another item of the same kind to the box for each item that's in there (IE; put 2 shotgun shells in the box, pull the lever, open the box again only to find 4 shotgun shells), and then clears the form list so that it doesn't keep giving you more of the same thing.

 

In short; items go in box, lever is pulled, script sticks contents' IDs into a form list, game adds more items to the box based on what's in the form list, form list gets cleared, you take items from box, repeat.

 

The idea is that this is the preliminary prototype of a script that I want to make for a sort of star-trek style matter replicator that I thought of putting as an item to build at settlements. It would consume a ridiculous amount of power and would only work once per day (I'll take care of that much of the scripting myself), but it would, as a late-game item, allow you to produce your own resources from nothing but power and the device itself.

 

It would be big, it would be costly to build (extremely), and would require a god-awful amount of power, but it would let you essentially make something from nothing using the good old law of the conservation of mass and energy, E=MC^2.

Edited by ZeroCore
Link to comment
Share on other sites

 

For getting items this is what I got : ( keep in mind Im no pro so this is just something to go off of :tongue: )

 

Formlist Property FormlistToAddobjectsto auto

FormList Property YOURLISTOFOBJECTSTOCHECK auto

 

Container PlayerContainer = Game.getplayer().GetContainer()

 

int Zeroint = 0

 

While YOURLISTOFOBJECTSTOCHECK.getsize() > ZeroInt

 

if PlayerContainer.GetiTemCount( YOURLISTOFOBJECTSTOCHECK.getat(ZeroInt)) >= 1

 

FormlistToAddobjectsto.addform( YOURLISTOFOBJECTSTOCHECK.getat(ZeroInt))

 

 

Endif

Zeroint += 1

EndWhile

 

 

So this gets the item count of a object and if its greater than or equal to 1 it gets the form and adds it to the formlist.

There might be a better way to do this but as far as Im aware its the only way(in my opinion this way is over complicated) gl

 

 

I see you have two form list property references. Are they both filled by the same thing, or have I misread something?

 

Whilst I'm on that; why do you need a second form list in this at all (namely "YOURLISTOFOBJECTSTOCHECK")? I don't see anything being added to it other than you using it as a stand in for an array that gets the size of the player's inventory and then cycles through each address.

 

Also, here's my question; your loop skips address zero in the conditional statement. What's at address zero that you don't want counted?

 

Depends on what kind of ID you want.

 

Getting the EditorID or the name of the form is not possible(maybe never) right now. You can get the FormID though.

 

 

Not entirely sure then, now that you mention it (I always get these ID identities confused). What I really plan on doing is to make essentially a replicator of sorts, the same thing that I did in that skyrim mod I mentioned before; you put an item into a locker, box, or other container, flip a lever which triggers an attached script, the script then gets the ID's of the contents of the box, adds another item of the same kind to the box for each item that's in there (IE; put 2 shotgun shells in the box, pull the lever, open the box again only to find 4 shotgun shells), and then clears the form list so that it doesn't keep giving you more of the same thing.

 

In short; items go in box, lever is pulled, script sticks contents' IDs into a form list, game adds more items to the box based on what's in the form list, form list gets cleared, you take items from box, repeat.

 

The idea is that this is the preliminary prototype of a script that I want to make for a sort of star-trek style matter replicator that I thought of putting as an item to build at settlements. It would consume a ridiculous amount of power and would only work once per day (I'll take care of that much of the scripting myself), but it would, as a late-game item, allow you to produce your own resources from nothing but power and the device itself.

 

It would be big, it would be costly to build (extremely), and would require a god-awful amount of power, but it would let you essentially make something from nothing using the good old law of the conservation of mass and energy, E=MC^2.

 

The First formlist is of all objects that you want to check if there in the chest, the second one is when you want to put these objects into a formlist.

 

and as for the address zero thing Im not sure what you mean.

Link to comment
Share on other sites

and as for what you want to do with your mod, ill add that to the script.



Container Property yourcontainer auto ; this is if you want to use something other than the player container

Formlist Property FormlistToAddobjectsto auto ; this is where you store the objects if they are in the chest

FormList Property YOURLISTOFOBJECTSTOCHECK auto ; this is a formlist of objects to check for if there in the chest


Container PlayerContainer = Game.getplayer().GetContainer() ; get players container, probably not neccessary but whatevs :tongue:


int Zeroint = 0 ; this is just as the name says


While YOURLISTOFOBJECTSTOCHECK.getsize() > ZeroInt ; while the object list which holds object you want to check for(aka YOURLISTOFOBJECTSTOCHECK) is less than Zeroint


if PlayerContainer.GetiTemCount( YOURLISTOFOBJECTSTOCHECK.getat(ZeroInt)) >= 1 ; if the container has a object from the formlist aka using >= 1


;FormlistToAddobjectsto.addform( YOURLISTOFOBJECTSTOCHECK.getat(ZeroInt)) ; add the object to the storage formlist, ill leave it here for reference.


PlayerContainer.AddItem(FormlistToAddObjectsto.getat(ZeroInt) ,PlayerContainer.GetItemCount(( YOURLISTOFOBJECTSTOCHECK.getat(ZeroInt) * 2 ) ; this gets the amount of items that are in the inventory then multiplies it by 2 and adds it back


Endif

Zeroint += 1

EndWhile


Hopefully this works :tongue:


Oh and I like your idea! :D

Edited by ajs52698
Link to comment
Share on other sites

 

and as for what you want to do with your mod, ill add that to the script.
Container Property yourcontainer auto ; this is if you want to use something other than the player container
Formlist Property FormlistToAddobjectsto auto ; this is where you store the objects if they are in the chest
FormList Property YOURLISTOFOBJECTSTOCHECK auto ; this is a formlist of objects to check for if there in the chest
Container PlayerContainer = Game.getplayer().GetContainer() ; get players container, probably not neccessary but whatevs :tongue:
int Zeroint = 0 ; this is just as the name says
While YOURLISTOFOBJECTSTOCHECK.getsize() > ZeroInt ; while the object list which holds object you want to check for(aka YOURLISTOFOBJECTSTOCHECK) is less than Zeroint
if PlayerContainer.GetiTemCount( YOURLISTOFOBJECTSTOCHECK.getat(ZeroInt)) >= 1 ; if the container has a object from the formlist aka using >= 1
;FormlistToAddobjectsto.addform( YOURLISTOFOBJECTSTOCHECK.getat(ZeroInt)) ; add the object to the storage formlist, ill leave it here for reference.
PlayerContainer.AddItem(FormlistToAddObjectsto.getat(ZeroInt) ,PlayerContainer.GetItemCount(( YOURLISTOFOBJECTSTOCHECK.getat(ZeroInt) * 2 ) ; this gets the amount of items that are in the inventory then multiplies it by 2 and adds it back
Endif
Zeroint += 1
EndWhile
Hopefully this works :tongue:
Oh and I like your idea! :D

 

 

First off, you put the "greater than" carrot instead of "less than" in your pre-test (in the while).

 

Secondly, I'm not too certain what you mean by "store the objects if they are in the chest". Can you explain, in detail, what this form list is for? I never needed more than one form list for the replicator I made for Skyrim a few years back. Also, does this second form list need to be attached to anything, such as the container that you're using for the replicator?

Link to comment
Share on other sites

you sure the > is wrong? This is greater than > that? and the store objects was what you wanted in the first post : 2: Once gotten, how do I pass the ID's to a form list , also the script isnt perfect its just a example on how I know how to do what you want to do :tongue: you will have to adjust it for your self.

 

YOURLISTOFOBJECTSTOCHECK.getsize() returns as size which will be large, exp 1000 > zero

 

maybe im having a brain fart, dunno

Edited by ajs52698
Link to comment
Share on other sites

To make a long story short, back in Skyrim, with a lot of help, I made a mod that used form lists to store the ID's of items that were placed into a container.

 

I want to make a similar thing for Fallout 4.

 

The thing is that the page I made for this was made so long ago that for some reason it's not on the forums anymore, and doesn't even show up in the lists of pages that I've started anymore.

 

https://forums.nexusmods.com/index.php?/topic/1007225-return-the-ids-of-container-contents-is-it-possible/&do=findComment&comment=8174810

 

:whistling:

Link to comment
Share on other sites

  • Recently Browsing   0 members

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