Copies of an Object

Started by SilverSpook, Wed 06/05/2015 22:59:49

Previous topic - Next topic

SilverSpook

So I need many copies of a certain object, in this case a screw, which the player will use.  Is there a way to instance an object multiple times so that all the properties (image, description, etc) of each instance are identical?  If that's not possible, is there a way to copy an object?

Thanks

Mathias

I'm not sure if I understand what you mean, but perhaps this link might be of use to you despite it being old:

http://www.adventuregamestudio.co.uk/forums/index.php?topic=37701.0

If you want several screws but in separate inventory slots I'm pretty sure you have to give each screw a separate object id.

Khris

An object as in a room object? Or an inventory item?
You need to be more specific.

Monsieur OUXX

I've you're talking inventory objects, yes, there are solutions -- if I recall, the object virtually exists only once but there's a count on how many of it the player carries)
 

SilverSpook

I'm talking about creating a room object, "oScrew" for example, and then duplicating that object so there are multiple copies of it lying around a room.  For example, on a table.

Is that possible?

Mandle

If you mean multiple objects but counted as a single object with a single object name then I think the answer is no.

If you mean to be able to copy objects for your own convienience when making the room: I believe there is a template option you can use...

If your problem is that you want to put so many screws that you are exceeding the room object limit then one solution might be to create three graphics (or more) for your "oScrews" object:

Many screws, half that amount, and just a few left (if that makes sense) and then change the object image as a variable counts down whenever a player takes one. You could also include the counter in the text when a character looks at the screws like:

"There are 123 screws left on the table."

SilverSpook

@Mandle: I was mostly thinking of the convenience of making several identical objects without having to re-input all of their properties each time I create a new one.  I'd be interested in such a template option!

Snarky

Unless I'm misremembering, can't you just right-click on an object in the room view to duplicate it?

SilverSpook

According to my AGS 3.4 on right-clicking an object in a room you can "Delete", "Place new object here", or "Copy coordinates to clipboard".

Snarky

Ctrl-C Ctrl-V, then? I'm pretty sure there is a way to copy an object.

SilverSpook

#10
That would make sense, but Ctrl-C, Ctrl-V doesn't work.

Snarky

Hmm, how about having an object selected, and then right-clicking somewhere else on the background?

(If that doesn't work, I give up and leave it to someone else who either know this stuff better or have the editor in front of them. I wonder if I might be thinking of GUI controls, which can definitely be copied.)

Though honestly, there aren't that many things you need to set for an object, so it shouldn't really be a ton of work to do it manually. It's really just graphic, script name and label in most cases; then of course you have to set the event handlers (but those probably wouldn't be copied in any case).

Crimson Wizard

There is a copy/paste command for GUI elements, but not for Room objects. Idk why, but it was never added.

SilverSpook

Ah, that makes sense.  Thanks.

I think what I was really thinking of is a method of instantiating objects from a template.  Which provides 1.) Time savings on placement of objects 2.) in the case that you modify a parameter of the template, changes would propagate to all instantiated objects.  (As in Object-Oriented-Programming C++/C#/Javascript objects). 

Perhaps it's not really extant/feasible/reasonable in the context of AGS.

Crimson Wizard

Quote from: SilverSpook on Sun 10/05/2015 23:20:55
Perhaps it's not really extant/feasible/reasonable in the context of AGS.
I think its feasible in the AGS Editor. The engine would require an overhaul to do this at runtime, though.

SMF spam blocked by CleanTalk