Random But Persistent Objects

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search

You can also use these strategies for other types of items, not just for clothing.


To give non-persistent random clothing:

You can put clothing in a leveled list, and then add that leveled list to an NPC's inventory in the editor. Everytime that NPC refreshes his inventory (if you haven't visited him for a few days), he will have new clothes from the list. This is usually what you want to do because it gives an NPC the appearance of changing clothes every once in a while.


To give static but persistent clothing:

Simply add the base clothing object to the NPC's inventory in the editor.


To give random but persistent clothing:
You can write a script which, based on a random percent, assigns a particular base clothing object to the NPC. See the example script below for inspiration which is attached to the NPC.

short doOnceGetClothes

short pantsPercent
short shirtPercent
short shoesPercent

Begin GameMode
	
	if doOnceGetClothes == 1
		return
	endif

	set pantsPercent to GetRandomPercent
	set shirtPercent to GetRandomPercent
	set shoesPercent to GetRandomPercent

	if pantsPercent < 25
		AddItem LowerPants04 1
		EquipItem LowerPants04
	elseif pantsPercent < 50
		AddItem LowerPants05 1
		EquipItem LowerPants05
	elseif pantsPercent < 75
		AddItem LowerPants07 1
		EquipItem LowerPants07
	else
		AddItem LowerPants08 1
		EquipItem LowerPants08
	endif

;and so on for shirt and shoes

	set doOnceGetClothes to 1
	
End GameMode