Jump to content

GetItemCount function is broken?


Recommended Posts

I have been trying to create a little mod for Fallout 3 but I don't seem to make any progress since I can't even get the simplest of scripts to run. I wrote this little code and attached it to an container :

scn aaMyContainerScript

begin onactivate
    if ( getitemcount aaMyItem > 0 )
        showmessage aaMyMessage
    else
        return
    endif
end

I just want to check if the corresponding container got a certain amount of items and if it does, show my message. But for the love of god it shows up no matter the item count. Doesn't it keep track of the item count because of the onactivate function? Do I need a reference to be called? What am I doing wrong?

 

Link to comment
Share on other sites

Just tested in game and works ...

But I realized maybe you don't want to open the box "Activate" it ?

 

So just don't use the "Activate" call for the scenario that the box won't open.

Link to comment
Share on other sites

Just tested in game and works ...

But I realized maybe you don't want to open the box "Activate" it ?

 

So just don't use the "Activate" call for the scenario that the box won't open.

Yes it is a leveled list item. And I don't don't want the player to open the container ever. I just want to manage the content inside the container with my messagebox.

Link to comment
Share on other sites

https://geckwiki.com/index.php/GetItemCount

 

  • Sometimes returns a non 0 value for items that are not in fact in the container because of items added via leveled lists. Fixed in JIP LN 55.41.

 

But by the way ... I don't think Return works for a single frame block , which OnActivate is ... which means it only reads from top to bottom once.

Link to comment
Share on other sites

https://geckwiki.com/index.php/GetItemCount

 

  • Sometimes returns a non 0 value for items that are not in fact in the container because of items added via leveled lists. Fixed in JIP LN 55.41.

 

But by the way ... I don't think Return works for a single frame block , which OnActivate is ... which means it only reads from top to bottom once.

Oh shoot, so it's not possible in F3 I guess since the JIP LN plugin is only available for New Vegas. Thank you for your advice.

Link to comment
Share on other sites

 

https://geckwiki.com/index.php/GetItemCount

 

  • Sometimes returns a non 0 value for items that are not in fact in the container because of items added via leveled lists. Fixed in JIP LN 55.41.

 

But by the way ... I don't think Return works for a single frame block , which OnActivate is ... which means it only reads from top to bottom once.

Oh shoot, so it's not possible in F3 I guess since the JIP LN plugin is only available for New Vegas. Thank you for your advice.

 

 

Well you could make your own leveled list out of a script using "GetRandomPercent" Which I am guessing you are trying to make a crafting container , that gets restocked from a leveled list ?

Something like this ...

 

;Float ftimer .... however want to check time passed if wanted

Int MyVar

 

Begin Onload

 

If ; Check Time passed however , and any other checks wanted

Set MyVar to GetRandomPercent

If MyVar > 80

MyContainerRef.AddItem MyItem01 1

elseif (MyVar <= 80 && MyVar > 60)

MyContainerRef.AddItem Myitem02 1

elseif (MyVar <= 60 && MyVar > 40)

MyContainerRef.Additem MyItem03 1

elseif (MyVar <= 40 && MyVar > 20)

MyContainerRef.Additem MyItem04 1

elseif MyVar <= 20

MyContainerRef.Additem MyItem05 1

 

endif

endif

End

 

~~~~~~~~~~~~~~~~~~

 

Just an example to give you an idea ... Which this particular script would be in its own block on the container you use the OnActivate block in , but could have an area trigger for walking into the place that runs this script or even a quest ... hope that helps.

 

Add edit : Actually sorry ... this example would be for a script not on the container ... since you wouldn't need to use "MyContainerRef" if it was in the container script. But the "OnLoad" block is what I would use if it was on the container.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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