Checking to see if an item exists in the world

Post » Mon Aug 23, 2010 12:22 am

I need to figure out a way to check if an item exists in the world but this is turning out to not be nearly as straight forward as I thought it would be.

To be specific I am trying to write a script that would let me know if the skill books are in the game or if a player actually used them (obviously if the function would return 0 etc)

I am assuming I would have to convert all the skill books into a persistent REF that is not a problem but I cannot figure t how to detect if they exist.

Exists only accepts an ActorREF
GetItemCount will only work using a container REF
GetIsReference is only good for comparing to the calling object
etc etc

Any suggestions on the best way to tackle this?
User avatar
gemma
 
Posts: 3441
Joined: Tue Jul 25, 2006 7:10 am

Post » Mon Aug 23, 2010 12:11 pm

IsEnabled?
User avatar
Robert Garcia
 
Posts: 3323
Joined: Thu Oct 11, 2007 5:26 pm

Post » Mon Aug 23, 2010 2:14 am

IsEnabled?


That's not a function is it? I don't see it on the GECK wiki Unless you mean Enable giving that a shot to see if it will pick up.
User avatar
Chantel Hopkin
 
Posts: 3533
Joined: Sun Dec 03, 2006 9:41 am

Post » Mon Aug 23, 2010 1:44 pm

There's the NVSE function IsFormValid, if the book's been taken and read BookRef.IsFormValid will return 0. If the skill books are in an inventory though the reference to them will be invalid, so...
User avatar
Wayne W
 
Posts: 3482
Joined: Sun Jun 17, 2007 5:49 am

Post » Mon Aug 23, 2010 2:53 pm

There's the NVSE function IsFormValid, if the book's been taken and read BookRef.IsFormValid will return 0. If the skill books are in an inventory though the reference to them will be invalid, so...


Thank you I will look into that, as for being in the player's possesion that should be easy enough to check via GetItemCount as the player REF is considered a container.
User avatar
carly mcdonough
 
Posts: 3402
Joined: Fri Jul 28, 2006 3:23 am

Post » Mon Aug 23, 2010 3:39 pm

I don't know about you, but I stockpiled all the skill books in my room at Novac until I got the +1 SP/book perk, so that's unlikely to be much help.
User avatar
Isabell Hoffmann
 
Posts: 3463
Joined: Wed Apr 18, 2007 11:34 pm

Post » Mon Aug 23, 2010 12:51 am

I don't know about you, but I stockpiled all the skill books in my room at Novac until I got the +1 SP/book perk, so that's unlikely to be much help.


So the isFormValid would not pick those up?

i just got NVSE installed got sidetracked playing Tech support and taking care of a live event for my mod so going to play with it now
User avatar
Guinevere Wood
 
Posts: 3368
Joined: Mon Dec 04, 2006 3:06 pm

Post » Mon Aug 23, 2010 1:48 pm

There's the NVSE function IsFormValid, if the book's been taken and read BookRef.IsFormValid will return 0. If the skill books are in an inventory though the reference to them will be invalid, so...


This doesn't seem to be working, I haven't even gotten to worrying about if it is in the player's inventory, This function seems to be returning 1 no matter what, even when the book has been used.

To test i have an activate script set up on a static object with an OnActivate block. All this does is simply
scn aaTestSCRIPTint Boolbegin OnActivate	set Bool to aaTestBook.IsFormValid	ShowMessage aaReturn Boolend


aaTestBook is the reference name I assigned to the stealth book located in good springs and aaReturn is a message box I set up to display the return value of the function.

I tried setting the skill book up as both a persistent and non persistent reference and either way same result
User avatar
Baby K(:
 
Posts: 3395
Joined: Thu Nov 09, 2006 9:07 pm


Return to Fallout: New Vegas