Jump to content

Looking for some script help :)


Korodic

Recommended Posts

So I usually am creative/handy when it comes to scripts. However I'm not sure how to go about this one...

 

At one point within my mod, I want to copy everything the player has equipped, and dump it into another actor who will then equip it.

 

Any leads/proposed code is appreciated.

Link to comment
Share on other sites

That woodelf that helps you at the Thalmor Embassy during the mainquest got something that takes the items from you momentarily, maybe that could give you a kickstart for some of the script you want to make? I mean he also let you choose what gear you want to remove. :)
Link to comment
Share on other sites

It does not need to be during dialogue, I was just going to do it very briefly upon the last stage in a quest. I think I may have a solution, but I do not know how reliable it would be... It would function somewhat like my werewolf equip mod. I guess I'll have to give that a go...
Link to comment
Share on other sites

If you plan to use it more than a single time in your quest, you could add a new quest script.

 

This script will contain a custom function that does all you need. Then you would be able to call it in stages (kmyquest.myFunction()), dialogues, other scripts, whateva.

Link to comment
Share on other sites

The following script is from FG109's profile on the CK wiki. It's a set of scripts for "getting/saving" the actors worn items. Requires SKSE.

 

 

;A function returning a 32 element array containing an actor's equipped (base) items. Requires SKSE. 

Form[] Function SaveOutfit(Actor akActor)
Form[] SavedOutfit = new Form[32]
int slot = 1
int i
int j
while (i < 32)
	Form TempForm = akActor.GetWornForm(slot)
	if (TempForm)
		SavedOutfit[j] = TempForm
		j += 1
	endif
	slot *= 2
	i += 1
endwhile
Return SavedOutfit
EndFunction

;There will probably be empty elements, since the actor probably is not wearing an item in every single slot. Automatically sorted so that empty elements are at the end of the array. 

;Also some functions to remove duplicate entries if needed. 

Form[] Function RemoveDuplicates(Form[] InputArray, Int Size)
Form[] OutputArray = new Form[32]
int i = 0
int j = 0
while (i < Size)
	if (ArrayHasForm(OutputArray, InputArray[i]) < 0)
		OutputArray[j] = InputArray[i]
		j += 1
	endif
	i += 1
endwhile
Return OutputArray
EndFunction

Int Function ArrayhasForm(Form[] MyArray, Form MyForm)
int i = 0
while (i < MyArray.Length)
	if (MyArray[i] == MyForm)
		Return i
	endif
	i += 1
endwhile
Return -1
EndFunction

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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