Jump to content

Items stolen flag


Recommended Posts

Assuming checkItem is the variable referencing the item that needs to be checked...

 

Pick the one that best fits your needs

If checkItem as Ammo  ;if it is ammo (arrow or bolt) do something
If !(checkItem as Ammo) ;if it is not ammo (arrow or bolt) do something
Link to comment
Share on other sites

  • Replies 44
  • Created
  • Last Reply

Top Posters In This Topic

For casting as it checks type which is actually a source script. You can even use your own scripts this way.

If someform as mycustomscript
;is mycustomscript attached to someform?

So you can use base scripts such as actor or quest or miscobject etc

 

Edit: Glad it's working!

Link to comment
Share on other sites

You can use this as a guide: https://www.creationkit.com/index.php?title=Category:Script_Objects

 

If you've got a passed in parameter of the type Form and you want to know if it is part of a specific subset of Form, you can cast it into the desired script object that extends Form.

 

Example: Assume you want to know if items that cannot be equipped are added to a mannequin so that they can be returned. You could take the akBaseItem parameter from the OnItemAdded event and cast it into the various equip-able types.

If !(akBaseItem as Armor) && !(akBaseItem as Weapon) && !(akBaseItem as Ammo)  ;if not armor and not weapon and not ammo then do something
Link to comment
Share on other sites

Is there a way to test for a quest item?

 

From reading other post on various forums they say not... but I've done thing in the past that they say you can't... so I take those with a pinch of salt :wink:

 

But I'd be inclined to accept it from you both (IsHara,dylbill) :)

Edited by TheWanderer001
Link to comment
Share on other sites

casting As Quest would check if the form is a quest, not check if a form is a quest item.

 

Example:

 

Quest Property MyQuest Auto

 

If Myquest as Quest

;this will be true

 

Papyrus Extender does have the function

bool Function IsQuestItem(ObjectReference akRef) global native

Again this only works on ObjectReferences, so you'd have to drop the object from an inventory first to check if it's a quest item.

Link to comment
Share on other sites

hmm... that could work for me off to test it now :)

 

Okay a quick test

 

ObjectReference DroppedObject = ContRef.DropObject(checkItem, 1)
If IsQuestItem(DroppedObject)
; This is a quest item
Endif

 

Compiler error IsQuestItem is not a function or does not exist ???

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...