Beginner's questions!!

Hi sorry I'm making my first game and I'm reeeallly stuck...
1. I want to make an object so that when the player moves it, it will reveal another object/exit.
2. Using the use/give feature, how do I make it so that you can use/give on or to a specific object or character?
3. How do I make it so that you can take something or go through an exit only when you have a certain object or talked to a certain character?

   Thank you!!!!!!

1) The most simple way I can think of is creating a verb on the object, then using a script to make the new object appear in the room. For example...

original.object
Verb tab, add verb
Poof (or whatever you want the verb to be)
Script:

msg ("You activate the switch or open the box and a new object appears!")
MoveObjectHere (newobject) 

But there are a lot of other ways to do this and make it cleaner. But for a beginner I suggest the most basic.

2) On the object make sure you go to the Features Tab and then check the Use/Give Box. After that, go to the Use/Give Tab and on the first category Use (on it's own), click "Run Script". This will be assuming the player already has the object as this script is on that object.
Script:

if (ListContains(ScopeVisible(), )) {
  msg ("You give the random thing to whatsherface.") 
  RemoveObject (objectnamehere)
}
else {
 msg ("This isn't the right person/There is no one around.")
}

Again, this is a very simplistic way to handle this. If the person is in the room with the player the first message will appear, if they are not, then the second message will appear.

3) So start with the room.object that has the exit (this means you need to create an exit with the Exit Tab as well into another room). On the Exit Tab you'll see a grid of boxes that turn blue when you click them (these represent the physical exits of your room). Look below those boxes and you'll see "Add" etc and your room's exit. Double click the name of your exit (not the box) or you can find the exit on your tree of stuff below your room name. You should see three tabs: Exit Options Attributes

Scroll down and find the Locked Box. Check it. After that, write the message you want that will run when the player tries to exit without the item in question. Next, check "Run A Script" which is right below it.
Script to Add.

if (Got (itemnamehere)) {
  MoveObject (player, newroomnamehere)
} 
else {
  msg ("You need to find that darn item first.")
}

Hope this helps! If you need anymore help just ask :)

Anonynn


Thank you so much!!!!! Also It keeps telling me "Error running script: No parameters passed to AddToInventory function - expected 1 parameters" how do I change this?


The function needs to be told what you want to add to the inventory.


a Function's Argument(s)/Parameter(s) is/are an input of data that the Function requires for its scripting, for example:

MoveObject (NAME_OF_MOVING_OBJECT, NAME_OF_DESTINATION_OBJECT)

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

<object name="room2">
</object>

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

the 'player' Player Object is in the 'room' Room Object (it's the built-in 'parent' Object Attribute, which actually does the controlling of containment: underneath, the 'MoveObject' Function is using the 'parent' Object Attribute for you), and this scripting (such as being put within an Object's Verb or whatever Element/source for where-ever/when-ever within your game) will move the 'player' Player Object from the 'room' Room Object to the 'room2' Room Object:

MoveObject (player, room2)


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

Support

Forums