Why is there no way to get the name of an ObjectReference?

Post » Wed Jun 20, 2012 3:16 pm

How come you can get the name of a quest alias, but not an actual object? Seriously, you HAVE to create a quest just to display the name of every Iron Dagger, Bucket, etc in the game?

Dangit, there SHOULD be a

String Function GetName()

function or something to get the name...every time I try to do a Debug.Notification() on an NPC, I get the name of a script running on the NPC or some other weird thing and not the NPC's name.
User avatar
stevie trent
 
Posts: 3460
Joined: Thu Oct 11, 2007 3:33 pm

Post » Wed Jun 20, 2012 7:53 am

I didn't even realise you could get the name of an alias. What function do you use to do that?

Like with other native functions that don't exist, this is probably just because Bethesda never needed to do this in Papyrus. It looks like it'll have to be SKSE to the rescue, as with so many other missing native functions, particularly ones to do with strings.

Cipscis
User avatar
Pete Schmitzer
 
Posts: 3387
Joined: Fri Sep 14, 2007 8:20 am

Post » Wed Jun 20, 2012 4:47 am

I didn't even realise you could get the name of an alias. What function do you use to do that?

Like with other native functions that don't exist, this is probably just because Bethesda never needed to do this in Papyrus. It looks like it'll have to be SKSE to the rescue, as with so many other missing native functions, particularly ones to do with strings.

Cipscis

Technically it's http://www.creationkit.com/Text_Replacement - but if you can get the name into an objective field, why did they never make it so you could get it into a string dynamically, so you could use something like this "Scavenger Hunt" script to assign arbitrary Formlists of stuff to fetch:

Scriptname ScavengerHuntScript extends Quest  	ObjectReference[] property Items Auto ; Maximum of 100 different item types	int[] property Number Auto ; Quantity needed of each item type.	int count	int Num	int property TotalItemTypes = 0 Auto	Bool Property HaveAllItems = False AutoEvent OnInit() ; Set up the array lists of items and quantity needed.	Items =  new ObjectReference[100]	Number =  new int[100]	count = 0	while Count < ItemList.GetSize()		Num = 0		While Num >= 0			if Items[Num] && ItemList.GetAt(Count) == Items[Num] ; Found a matching item in the list before getting to the end.				Number[Num] = Number[Num] + 1 ; Need one more of this item.				Num = -1			elseif Items[Num] ; There's an item, but it doesn't match.				Num += 1			else ; End of the list without finding the item.				Items[Num] = (ItemList.GetAt(Count) as ObjectReference)				Number[Num] = 1 ; New item, and we've found one so far.				TotalItemTypes += 1 ; Need to remember this so we can efficiently go through the list later.				Num = -1			endif		EndWhile	EndWhileEndEventEvent OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)	if ItemList.HasForm(akBaseItem)		CheckIfAllDone()	EndifEndEventFunction CheckIfAllDone()	bool Value = http://forums.bethsoft.com/topic/1360183-why-is-there-no-way-to-get-the-name-of-an-objectreference/True	String StillNeedList ="Still Need: "	count = 0 ; Which item are we checking	while Value && Items[Count] ; while there are more items to check and we haven't hit something we still need		If Game.GetPlayer().GetItemCount(Items[Count]) < Number[Count]			Value = http://forums.bethsoft.com/topic/1360183-why-is-there-no-way-to-get-the-name-of-an-objectreference/False			StillNeedList = StillNeedList + (Number[Count] - Game.GetPlayer().GetItemCount(Items[Count]) as int) +" " + Items[Count] + ","		Endif		count += 1	endWhile	if Value		QuestNeedingHunt.SetStage(StageToSetOnCompletion)	else		Debug.MessageBox(StillNeedList)	endifendFunctionFormList Property ItemList  Auto  Quest Property QuestNeedingHunt Autoint Property StageToSetOnCompletion Auto

That probably needs some tweaking...you would probably need to actually make an instance of each item type in the Formlist in order to make an Objectreference for it...and then you would have to compare base forms, not the objectreference.
User avatar
Bee Baby
 
Posts: 3450
Joined: Sun Jun 18, 2006 4:47 am


Return to V - Skyrim