Jump to content

[LE] Create simple pop-up message in creation kit


Recommended Posts

Is there a simple way to create a pop-up box that tells you found a certain item? Example: "You just found Grimsever, Rejoice!"

Also, so it only pops up the first time you pick it up. Thanks in advance

Link to comment
Share on other sites

Hey, yes you can use a script messagebox. Make a new quest, then make a new reference alias on said quest pointing at the player. Choose Specific Reference, Cell Any, Player.

 

Then put this script on the reference alias:

Scriptname DetectGrimsever extends ReferenceAlias 

Weapon Property FFRiften09Grimsever Auto

Event OnInit() 
    AddInventoryEventFilter(FFRiften09Grimsever)
EndEvent 

Event OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
    If akBaseItem == FFRiften09Grimsever
        Debug.MessageBox("You just found Grimsever, Rejoice!")
        Utility.Wait(1) 
        Self.GetOwningQuest().Stop() ;stops the quest this alias is on
    Endif 
EndEvent
Name the script something more unique, and don't forget to fill properties in the Creation Kit after compiling it.
If you want to do this for more than one item, the script would need to be a little more complex.
Edited by dylbill
Link to comment
Share on other sites

It wouldn't have to be much more complex for multiple items.

 

Create a quest which will be used to manage the system. This quest will be start game enabled and run once. Apply a script to this quest which will start all the individual quests each outlined as above but with a different object.

 

Management quest script could be as follows:

 

 

Scriptname FTPN_HandlerScript Extends Quest
{First Time Pickup Notice handler script}

FormList Property myQuestList Auto
{This is a list of quests}

Event OnInit()
  Int index = myQuestList.GetSize()
  While index >= 0
    index -= 1 
    Quest Entry = myQuestList.GetAt(index) as Quest
    Entry.Start()
  EndWhile
EndEvent

 

 

 

Modifying dylbill's script a bit to make it more generic so that it can be reused as many times as necessary

 

Scriptname FTPN_WeaponScript extends ReferenceAlias 
{First Time Pickup Notice weapon script}

Weapon Property myWeapon Auto
String Property myText Auto

Event OnInit() 
    AddInventoryEventFilter(myWeapon)
EndEvent 

Event OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
    If akBaseItem == myWeapon
        Debug.MessageBox(myText)
        Utility.Wait(1) 
        Self.GetOwningQuest().Stop() ;stops the quest this alias is on
    Endif 
EndEvent

 

 

Link to comment
Share on other sites

I was thinking of doing it all with one script / alias. I'm not sure if having a bunch of quests running at once is bad for performance or not, but it does make me wary. Instead you could put all items you want messages for in a formlist, and use a string array for the messages:

 

 

 

Scriptname MyModItemMessagesScript extends ReferenceAlias 

Formlist Property MyModMessageItems Auto ;put all items you want messages for in this list 
String[] Property MyModMessages Auto ;Set message strings in the CK
{Make sure MyModMessages string positions line up with the MyModMessageItems}

Int Count = 0

Event OnInit() 
    Int M = MyModMessageItems.GetSize()
    While M > 0 
        M -= 1
        AddInventoryEventFilter(MyModMessageItems.GetAt(M))
    EndWhile
EndEvent 

Event OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
    If MyModMessageItems.HasForm(akBaseItem)
        Count += 1
        Int Index = MyModMessageItems.Find(akBaseItem) 
        Debug.MessageBox(MyModMessages[Index]) ;show message associated with item
        RemoveInventoryEventFilter(akBaseItem)
        
        If count >= MyModMessageItems.GetSize() ;if all the messages have been shown
            Self.GetOwningQuest().Stop() ;stops the quest this alias is on
        Endif
    Endif 
EndEvent 

Edited by dylbill
Link to comment
Share on other sites

There are always multiple ways of approaching the same thing. Each can be tested for performance if necessary.

 

Another method:

A single quest where each target item is placed in its own alias. The quest would have objectives to find each of the items. Objective text can be displayed on screen when each object is found. Once all objects are found, shut the quest down. Very minimal scripting.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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