Limit menu of objects for use/give?

Is 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.


You 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>

That 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


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums