Difference between revisions of "How to give an NPC random but persistent clothing"

From the Fallout3 GECK Wiki
Jump to navigation Jump to search
imported>Haama
imported>Qazaaq
(End GameMode...? even if that works, let's not give the confusing examples)
Line 42: Line 42:
set doOnceGetClothes to 1
set doOnceGetClothes to 1
     endif
     endif
End GameMode
End
</pre>
</pre>


[[Category:Solutions]]
[[Category:Solutions]]

Revision as of 07:34, 24 December 2008

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 == 0
		
          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
     endif	
End