Jump to content

[LE] How to remove formlist of items from.... everywhere?


corrado33

Recommended Posts

I have a formlist of items. These items are likely in various containers throughout the skyrim world. (Not necessarily in the same cell as the player.)

 

How can I remove all of those items from all of those chests?

 

Is there an easy way?

 

I COULD write a script that uses the quest aliases that I made with all of those items (each item makes a quest alias for the container it's stored in (provided it's not the player.). But that's.... annoying because I'd have to fill all those references manually cause I can't figure out how to fill quest alias properties automatically. (And there are.... a lot... of references and I'm feeling lazy.)

 

Would "Delete" work?

 

The objects themselves aren't in an alias.... and aren't ever a script property... I don't think.

 

This is what I've tried.

formlist Property RASUtilityStones auto
quest property RadoAutoSortMasterQuest auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
	int aliasLength = RadoAutoSortMasterQuest.GetNumAliases()
	alias tempAlias

	while (aliasLength >= 0)
		tempAlias = RadoAutoSortMasterQuest.GetNthAlias(aliasLength) as alias
		tempAlias.getref().removeitem(RASUtilityStones)
		aliasLength -= 1
	endwhile

EndEvent

Doesn't work, unfortunately :(

Edited by corrado33
Link to comment
Share on other sites

One route is to take an empty formlist and add each of the containers that are used at run time to that formlist. Then when you want to do a mass removal, go through that formlist and remove from each entry.

 

And I think your code above doesn't work because you assigned tempAlias as an Alias rather than a ReferenceAlias. GetRef only works on ReferenceAlias rather than plain Alias.

Link to comment
Share on other sites

One route is to take an empty formlist and add each of the containers that are used at run time to that formlist. Then when you want to do a mass removal, go through that formlist and remove from each entry.

 

And I think your code above doesn't work because you assigned tempAlias as an Alias rather than a ReferenceAlias. GetRef only works on ReferenceAlias rather than plain Alias.

 

Yep, you're right.

 

I fixed that and it worked :smile: Luckily all of the chests are contained in the same quest (Even the player!) so I just looped through those aliases and it worked great.

 

BTW: Are you the only one on here? :wink:

 

Sorting script is nearing completion. It works 100% now, I just need to figure out a way to give the players the 3 spell tomes. (Give sorting indicators, remove sorting indicators, and select crafting stations.) Debating creating a lore friendly quest for it. (3 dungeons to find all 3 spell tomes)

Edited by corrado33
Link to comment
Share on other sites

I don't think I am the only one on here. If you click the big Nexus Forums link at the top left, you'll go to the forums' homepage where at the bottom it lists all the people currently signed in....

 

It was a joke :) You always seem to respond to my posts and I'm very thankful! :)

Link to comment
Share on other sites

For speed/performance purposes, you generally should avoid "convenience" functions like getref in loops which have speed in mind. GetRef will just call GetReference() first, then GetReference() will return the reference. Doing this for every iteration of the loop. As you will convert your loop to work with formlists, which are known to be slow, you want things to be as efficient as possible.

Edited by Rasikko
Link to comment
Share on other sites

For speed/performance purposes, you generally should avoid "convenience" functions like getref in loops which have speed in mind. GetRef will just call GetReference() first, then GetReference() will return the reference. Doing this for every iteration of the loop. As you will convert your loop to work with formlists, which are known to be slow, you want things to be as efficient as possible.

 

So you're saying I should replace all of my "getref()" statements with "getreference()" statements?

 

Easy enough. I always wondered why they had two different things do the same thing...

 

Thanks!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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