creating objects through script

scottskeptic
Hello! I was wondering how creating an object works when using a script and clicking create an object. I am attempting to make it so that giving an npc an object creates another object.

Pertex
If you only want to create one new object you can do it like this:

create ("new")
new.alias="new one"
new.look="This is a new object"

XanMag
Or... if you don't know where to put Pertex's suggestion in your code...

1. Make an "item room" - that is one that has no entrances or exits and cannot be accessed by the player.
2. Put your "new" item in that room. When you give your item to the NPC, simply use the move object script to move your new object to the NPC or to your inventory (or where ever you want your new object to end up).
3. Depending on what you want to have happen to the item you initially gave to the NPC, you probably will want to also use the remove object script on that object you gave.

Either works. One is GUI, one is code.

Father thyme
If the object is to appear in a particular room I usually put it in that room and make it invisible until needed.

The Pixie
Father thyme wrote:If the object is to appear in a particular room I usually put it in that room and make it invisible until needed.

Yes, generally it is easier to create the object in the editor, and just have it appear when required (personally I have a room called "nowhere" and move it from there).

Marzipan
I have a 'Hidden' room for this and swap things out constantly. Makes for a nice, quick and dirty solution when I don't feel like messing around with object states too.

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

Support

Forums