Jump to content

How to get NPC Actors by CK and/or script?


nosdregamon

Recommended Posts

I wanted to make a little mod for "Hydra's Slave Girls". Basically I want to clothe them in prisoners rags and/or revealing outifts. "Just nude" seems a bit boring. However Hydra put out a LOT of different NPCs out there, so it would never be little, unless...

 

Basically in CK I created "Miscallenous->FormList" of suitable NPCs (dragged from Actors->Actors), set up a treasure chest (filled with prison rags and whatever the players puts inside) and a lever. Said lever should start a little script, equipping said NPCs with a copy of a random piece in the treasure chest. In theory, it would take some time to run (something like 200 NPCs take their time), but then you'd be good for the near future (I guess a cell reset could rever the whole thing).

 

Trouble is (among other things): "Actors->Actors" just gives not Actors, but ActorBases (that don't have "EquipItem" as a method).

 

Anybody got a clue, how to get Actors out of ActorBases? Or a better idea how to get a whole bunch of NPCs (say by Faction, or...). Or is the whole Idea doomed to begin with and I would have to edit every single NPC by hand?

 

 

Scriptname hydx_applySlaveOutfit extends ObjectReference  

FormList Property hydx_SlaveList  Auto  ; in CK defined FormList, dragged from Actors

ObjectReference Property hydx_SlaveOutfitChest  Auto  ; in CK create/defined chest, filled with rags

import debug
import utility

Bool bToggle = false;

Event OnActivate(ObjectReference akActionRef)
	bToggle = !bToggle
	Int iIndex = hydx_SlaveList.GetSize();
	Debug.Trace("Slaves: "+(iIndex as String))
	If bToggle
		Debug.Trace("Checking Chest")
		Int iOutfits = hydx_SlaveOutfitChest.GetNumItems();
		Debug.Trace("Outfits: "+(iOutfits as String))
		While iIndex
			Actor akSlave = hydx_SlaveList.GetAt(iIndex) as Actor;
			Debug.Trace("Working on Slave: "+akSlave.GetBaseObject().GetName())
			int iRandomOutfit=Utility.RandomInt(0,iOutfits)
			if iRandomOutfit ; If 0 shows up: Stay naked else...
				Form fSlaveOutfitBase=hydx_SlaveOutfitChest.GetNthForm(iRandomOutfit);
				debug.trace(fSlaveOutfitBase as String);
				ObjectReference oNewOutfit=akSlave.PlaceAtMe(fSlaveOutfitBase);
				akSlave.AddItem(oNewOutfit);
				akSlave.equipItem(oNewOutfit);
			endif
		EndWhile
	Else 
		Debug.Trace("Stripping Slaves")
                ;to be implemented
	Endif
	Debug.Trace("Done")
EndEvent

 

 

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use