Limit menu of objects for use/give?
solea
22 Feb 2019, 05:16Is there a way to limit what is shown by the "display menu of objects this can be given to" in the Use/Give tab? I would like to only display NPCs when prompting for who to give something to (i.e. not silly stuff like giving things to a window, a door, a chair...) Thanks in advance.
mrangel
22 Feb 2019, 11:19You could override the function CreateGiveMenuList
, I think.
If your NPCs inherit a type named "NpcType" (which they will if you're using NPCLib) I'd suggest something like:
<function name="CreateGiveMenuList" parameters="object" type="objectlist">
candidates = FilterByType (ScopeReachableNotHeld(), "NpcType")
if (ListContains (candidates, object)) {
list remove (candidates, object)
}
if (ListContains (candidates, game.pov)) {
list remove (candidates, game.pov)
}
return (candidates)
</function>
solea
26 Feb 2019, 20:24That worked, thanks.
In case anyone else has the same question and isn't sure how to override functions (I hadn't done it before) here's the documentation for it: http://docs.textadventures.co.uk/quest/overriding.html