IsharaMeradin Posted May 9, 2021 Share Posted May 9, 2021 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 More sharing options...
TheWanderer001 Posted May 9, 2021 Author Share Posted May 9, 2021 (edited) Ah... that make sense :smile: You are both being so helpfulI'm eternally grateful Edited May 9, 2021 by TheWanderer001 Link to comment Share on other sites More sharing options...
TheWanderer001 Posted May 9, 2021 Author Share Posted May 9, 2021 Is there a list of those items that can be used in 'as' anywhere? Happy days :dance: Script is finally doing what I want it to.... Will be releasing the mod soon... Link to comment Share on other sites More sharing options...
dylbill Posted May 9, 2021 Share Posted May 9, 2021 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 More sharing options...
TheWanderer001 Posted May 9, 2021 Author Share Posted May 9, 2021 Okay good to know.... Is there a way to know what is valid and what's not though? i.e. 'arrow' is not valid but 'ammo' is or is it just a case of trial'n'error :D Link to comment Share on other sites More sharing options...
IsharaMeradin Posted May 9, 2021 Share Posted May 9, 2021 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 More sharing options...
TheWanderer001 Posted May 9, 2021 Author Share Posted May 9, 2021 (edited) 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 May 9, 2021 by TheWanderer001 Link to comment Share on other sites More sharing options...
TheWanderer001 Posted May 9, 2021 Author Share Posted May 9, 2021 I guess it was to much to hope that 'item as quest' would identify quest items :D I just tested that and it didn't work... Link to comment Share on other sites More sharing options...
dylbill Posted May 9, 2021 Share Posted May 9, 2021 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 nativeAgain 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 More sharing options...
TheWanderer001 Posted May 9, 2021 Author Share Posted May 9, 2021 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 itemEndif Compiler error IsQuestItem is not a function or does not exist ??? Link to comment Share on other sites More sharing options...
Recommended Posts