is there a possibility to clone objects or characters??

Started by Rocco, Sat 04/02/2006 23:38:13

Previous topic - Next topic

Rocco

anything like this:
Code: ags

new object[MAX_OBJECTS];
x = 0;
while(x < MAX_OBJECTS)
{
 object[x] = oWifeshoes;
 x++;
}


thanks for suggestions

monkey0506

There is no "new" keyword in AGS, so, no...Objects, Characters, and all the other managed types cannot be created from the script.  You could, if you needed it, create a pointer to an Object:

Code: ags
Object* pObjAtXY = Object.GetAtScreenXY(mouse.x, mouse.y);


(This would create a pointer to the object under the mouse (at that point)).

Why, might I ask, do you need this (what are you trying to do)?

Gilbert


Pumaman

The reason this hasn't been implemented is because of the difficulty in dealing with the object's interactions. Since the object wouldn't have been set up in the editor, how would you specify what happens when the player clicks on it?

There are various possible solutions, but none of them leap out as seeming like the way to go.

Akumayo

What about making the new objects interactions identical to another objects interactions?  This way you could clone existing objects to different places in the room.
"Power is not a means - it is an end."

Rocco

Quote from: monkey_05_06 on Sun 05/02/2006 00:27:28

Why, might I ask, do you need this (what are you trying to do)?

Here i have an example, im not unhappy with the result so far.
http://s6.simpleupload.de/fc8f78bc9/Arcade.zip.html
But i need advice with the text.
Cause i want to display the score and player stats, but i cant use overlays.
(CJ - PLEASE We need more overlays :)
and the non blocking text functions that i know, have no functionality to display %d values.
i dont want to use the standard gui, cause the whole thing should fits to the module.

Khris

Why don't you use a custom GUI?
A label on a transparent GUI should be exactly what you're looking for.

You could even use the default statusbar, just set its foreground and background color to 0 and add a textlabel.
To display graphical stuff, use the GUIs background pic for static stuff and buttons for the rest.

strazer

Quote from: Rocco on Wed 08/02/2006 00:26:15
and the non blocking text functions that i know, have no functionality to display %d values.

Don't know what functions you're referring to exactly, but you could always construct the string beforehand using the StrFormat/String.Format function.

But I think it's totally okay to require the module user to create and name a GUI label. This way he can easily place it where he wants it.

Rocco

thanks strazer, this is exactly what im searching for.
maybe the best way, is to provide both possibilities.

SMF spam blocked by CleanTalk