Having items create other items...?

Hi. I'm new with TextAdventures, and I am making a game for a school project. I am trying to make an object create a new object once used with a different object. If that makes sense. Like, if I have a can-shaped object, and I take it to a can opener, I want to make a new object come from the can. I've messed around with the settings a little bit, but nothing seems to be working. Please help if you can.


here's some links:

http://docs.textadventures.co.uk/quest/tutorial/more_things_to_do_with_objects.html

http://docs.textadventures.co.uk/quest/upgrade_notes.html (if you don't see any 'use/give' Tabs, then you need to toggle them to be shown/visible, see this link, and if need help ask if the link isn't clear: 'game' Game Settings Object -> 'Features' Tab -> toggle on the 'use/give Tab' GUI/Editor option)


http://docs.textadventures.co.uk/quest/
http://docs.textadventures.co.uk/quest/tutorial/

http://docs.textadventures.co.uk/quest/scripts/create.html


if you don't want to use the built-in 'use/give', you can manually create your own design too, for example:

basic scripting:

http://docs.textadventures.co.uk/quest/functions/contains.html
http://docs.textadventures.co.uk/quest/functions/corelibrary/removeobject.html
http://docs.textadventures.co.uk/quest/attributes/parent.html

// scripting (within a: 'Verb / Object's Script Attribute, Function, Turnscript, Timer, Command, etc' Element):

if (Contains (player, "pot") and Contains (player, "frog")) {
  create (potion, "potion_type")
  potion.parent = player
  RemoveObject (frog)
}

<object name="room">
</object>

<object name="player">
  <attr name="parent" type="object">room</attr>
  <attr name="invisibility_boolean_attribute" type="boolean">false</attr>
</object>

<object name="pot">
  <attr name="parent" type="object">player</attr>
</object>

<object name="frog">
  <attr name="parent" type="object">player</attr>
</object>

<type name="potion_type">
  <attr name="consume" type="script">
    player.invisible_boolean_attribute = true
    RemoveObject (this)
  </attr>
</type>

<verb>
  <property>consume</property>
  <pattern>property</pattern>
  <defaultexpression>You can't consume that!</defaultexpression>
</verb>

using the 'Command' Element:

<command name="mix_command">
  <pattern>mix #object_parameter_1# and #object_parameter_2#</pattern> // keeping this simple, so only showing example of mixing two items, but we can have it handle any quantity (2 and more) of items being mixed too
  <script>
    if ((object_parameter_1 = pot and object_parameter_2 = frog and Contains (player, pot) and Contains (player, frog)) or (object_parameter_1 = frog and object_parameter_2 = pot and Contains (player, pot) and Contains (player, frog))) {
      create (potion, "potion_type")
      potion.parent = player
      RemoveObject (frog)
    }
  </script>
</command>

<object name="room">
</object>

<object name="player">
  <attr name="parent" type="object">room</attr>
  <attr name="invisibility_boolean_attribute" type="boolean">false</attr>
</object>

<object name="pot">
  <attr name="parent" type="object">player</attr>
</object>

<object name="frog">
  <attr name="parent" type="object">player</attr>
</object>

<type name="potion_type">
  <attr name="consume" type="script">
    player.invisible_boolean_attribute = true
    RemoveObject (this)
  </attr>
</type>

Thank you!


Easy "trick":

  1. Create object can.
  2. Create object can opener.
  3. Tick the Use/Give box under features for the can object.
  4. In use the on other object box, select can opener.
  5. Create "new object" and make it invisible.
  6. For the script for step #4, remove the can (and possibly can opener?) and make "new object" visible (and maybe add "new object" to inventory )

Done. Good luck.


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

Support

Forums