Jump to content

Inventory


Ashenfire

Recommended Posts

Careful with "ObjectReference" Properties, as they are persistent. Plus GetItemCount expects a Form. That should only be used when you need a specific reference.

 

ObjectReference Property ItemRef auto ; persistent

If (Game.GetPlayer().GetItemCount(ItemRef.GetBaseObject()) > 0)
  ; do stuff
EndIf

If you don't need the specific reference, better to use the actual form (and a player ref property for a speed boost)

 

Actor Property PlayerRef Auto
Form Property ItemForm auto ; not persistent

 

If (PlayerRef.GetItemCount(ItemForm) > 0)
  ; do stuff
EndIf

Sometimes it must be more specific, but I'm not sure off hand what an amulet would fall under. Using a book instead:

 

Actor Property PlayerRef Auto
Book Property ItemBook Auto ; not persistent

 

If (PlayerRef.GetItemCount(ItemBook as Form) > 0)
  ; do stuff
EndIf

Edited by Ez0n3
Link to comment
Share on other sites

The form was a problem for me.

 

I never got Aliases to work for me. I found a work around by naming them in the fragment script

or using the properties button in the fragment script area. So far it works for me.

 

I did this for the amulet and the book I wrote so I know it works. The problem is when the characters in

my mod try to detect the amulet and book they don't do it. In fact the scrtipts from wiki like the one you

gave, never compile.

 

I have an amulet aliased in the fragment script called ANAngisHeirloom. I already created the property.

Amulets are listed as ARMOR property. I can't seem to get the form to work.

 

I am still going over what you posted, I couldn't get the script to compile because the form and other parts of the code

are causing errors on compiling.

 

I was hoping that there was another way without the form. The wiki site has 2 references on how to detect inventory items

but I am having difficulty making them work.

 

I am very old school (d.o.s, basica, turbopascal) and all this new programming stuff is greek to me.

 

I was planning to detect the amulet on a person's inventory during dialogue with an NPC, they would then at that time

take it and set a stage. I already accomplished this part, the problem is that the dialogue has an alternate option the character

can do and its still needed to check the players inventory for the amulet and set the stage to a different number if the amulet was

not acquired when asked to get it.

Edited by Ashenfire
Link to comment
Share on other sites

If it's an alias, then maybe something like this:

Actor Property PlayerRef Auto
ReferenceAlias Property TheAmuletAlias Auto

If (PlayerRef.GetItemCount(TheAmuletAlias.GetReference().GetBaseObject()) > 0)
  ; do stuff
EndIf

Might want to post the script if that doesn't help.

Link to comment
Share on other sites

The following code works, but it is too ' linear '.

 

A lot of my items are one of a kind unique items. They only exists 1 time in the world.

So am I right to believe they need a form?

 

I want Angi to detect if the player got her amulet THEN set the stage or give

the player a reward. I don't want to anticipate every dialogue and stage for the quest.

It is a bit redundent giving 3 to 5 dialogue routines just for 1 reward to take in

account different probabilities like when certain npc is dead, another is alive,

out of 3 amulets how many did you find....too much to keep track of.

 

I want to be more flexible when characters find unique items it will give new

spontaneous dialogue with many characters.

 

 

GetOwningQuest().Setstage(20) ; Angi now likes character

Game.GetPlayer().Additem(Gold001,1000)

Game.GetPlayer().RemoveItem(ANAngisHeirloom,1)

 

;rem define gold001 in properties as MISCOBJECT

;rem define ANAngisHeirloom in properties as ARMOR

 

As you see above, the script ASSUMES player has the amulet.

Also, what if player wants to keep the amulet? I want to detect the amulet

and give the player the choice to keep it, etc.

Edited by Ashenfire
Link to comment
Share on other sites

Persistence (Papyrus)

 

I haven't set up quest dialogue yet, so I can only refer you to the tutorials:

Radiant Quests

Planning the Quest

 

Can't you just put a condition on the dialogue that offers a reward? If you have multiple items and the dialogue is the same for all, you could add them to a form list and check that instead.

 

Forms:

  • Items
    • Armor

      • Amulet01
        Amulet02
        Amulet03

    [*]Miscellaneous

    • FormList

      • AmuletList

        • Amulet01
          Amulet02
          Amulet03

The dialogue condition would be "GetItemCount | AmuletList | > | 0 | (run on PlayerRef)". Or in a script:

Actor Property PlayerRef Auto
FormList Property AmuletList Auto
;...
If (PlayerRef.GetItemCount(AmuletList) > 0)
  ; do stuff
EndIf

But this should also work:

Actor Property PlayerRef Auto
Armor Property ANAngisHeirloom Auto
;...
If (PlayerRef.GetItemCount(ANAngisHeirloom as Form) > 0)
  ; do stuff
EndIf

Assuming you have something like this:

Forms:

  • Items
    • Armor

      • ANAngisHeirloom

Or you are manually assigning them.

 

I think you need one dialogue for the reward and another if the player decides to keep it. Might want to check out Calixto Corrium's quest Blood on the Ice, it sounds similar.

Edited by Ez0n3
Link to comment
Share on other sites

I don't know how to make a form list.

 

I will check out Calixto though.

 

 

I'm trying to make the characters more smart so when a player starts talking to certain npcs, they will generate new dialogue not offered otherwise.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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