Jump to content

[LE] Help with RefAlias, text replacement, SetDisplayName please!


irswat

Recommended Posts

I'm trying to help watcherzero add a dynamic treasure hunting book to his oblivion artifacts mod. The book lists all items and clues as to the location. When one of the unique items is found a check mark should appear in the book next to the item name to let the player know this item is found. To accomplish this, following a suggestion by cdcooley, I am trying to use text replacement and dummy ref aliases. I created a quest, start enabled, and in the quest I have a ref alias for the book, a ref alias for the player, and a ref alias for just 1 of the items. The item I checked stores text and selected the base object for battle axe of hatred, which is the item in question. I then put together a simple OnItemAdded script with an AddInventoryEventFilter. I pass the filter a formlist with all the items in the oblivion artifacts mod. I then check at what index the item added is in the formlist and change the display name for the corresponding dummy ref alias to "[X]". I attach this script to the player ref alias.

the text of the oblivion artifact guide is this: <Alias=OblivionArtifactRefAlias63> - Battleaxe of Hatred: Embershard Mine on a shelf.

Scriptname OblivionArtifactsAliasFilter extends ReferenceAlias

FormList Property OblivionArtifactsItemsFormList Auto
ReferenceAlias Property OblivionArtifactRefAlias63 Auto

Event OnInit()   
    AddInventoryEventFilter(OblivionArtifactsItemsFormList)  
endEvent   
  
Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)   
        int i
	i=OblivionArtifactsItemsFormList.Find(akBaseItem)
	i+=1 ;formlist starts at index 0
	
	if i==63	;Battleaxe of Hatred
		akItemReference.SetDisplayName("[X]")
	endif
endEvent

the two properties are filled properly I think. Yet when I try to compile the above script I'm getting this message: SetDisplayName is not a function or does not exist.

Any ideas what I'm doing wrong here?

Edited by irswat
Link to comment
Share on other sites

I do have SKSE and I extracted the scripts to the scripts folder. Is there a special way to open creation kit with SKSE?

EDIT: Solved. I must have missed something. I recopied the scripts from the SKSE zip to data and now the script compiles! thanks

Edited by irswat
Link to comment
Share on other sites

OK, I attached the script to the player refalias and add both the book and the battleaxe via console. The Book reads "Battleaxe of Hatred: Embershard Mine on a shelf." Unfortunately even though the battleaxe has been added to the player container I'm not getting an [X]. The addinventoryeventfilter is being added (debug message), with a formlist containing the base forms of all the items. For some reason adding battleaxe of hatred via console doesn't trigger the onitemadded event (no debug message). Any ideas?

edit: the formlist has base objects, but the item added is an object reference and I think it has something to do with this. In that case how does one capture object references being added to inventory?

Edited by irswat
Link to comment
Share on other sites

That weapon is probably non-persistent, meaning akitemreference will return none.

 

So instead you can try using akBaseItem as weapon to catch that weapon, maybe even using a filter, or further coding to narrow down the exact weapon.

 

i actually fixed the addinventoryeventfilter, there were several things wrong, including needing optional checked, filling the alias correctly, and the i+1 logic was wrong. the last problem i have is figuring out how to get SetDisplayName to work for the refalias. So far no luck.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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