Jump to content

Given 'Form' or 'ObjectReference': how to test if it's a particular object like a Stimpak?


Recommended Posts

Hope you're all doing well out there in the Wasteland...

 

Pretty simple question: how to test for a particular type of item given a 'Form' or 'ObjectReference' like a Stimpak?

 

Probably has a pretty simple answer that is eluding me right now.

 

For Stimpak I tried: form.HasKeyword(ObjectTypeStimpak) which didn't work. Seems awkward, but maybe I need to do something like: form.GetFormID() == Stimpak.GetFormID() ?

 

I'll let the experts chime in.

-louisthird

 

Link to comment
Share on other sites

For a specific base object test the condition system offers GetIsID, but in script you have to provide a property for each base object:
Potion Property pStimpak Auto Const Mandatory

Function IsStimpak(ObjectReference ThisREF)
   If (ThisREF.GetBaseObject() == pStimpak) 
      ; yes
   Else
      ;no
   EndIf
EndFunction

 

Form type logical "IS" tests are built in;

Function IsPotion(ObjectReference ThisREF)
   If (ThisREF.GetBaseObject() is Potion) 
      ; yes
   Else
      ;no
   EndIf
EndFunction
Link to comment
Share on other sites

  • Recently Browsing   0 members

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