Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
2 registered members (Grant, AndrewAMD), 911 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 4 1 2 3 4
Perfect copy of an entity #328154
06/10/10 18:58
06/10/10 18:58
Joined: Sep 2009
Posts: 987
Budapest
Aku_Aku Offline OP
User
Aku_Aku  Offline OP
User

Joined: Sep 2009
Posts: 987
Budapest
I browsed the manual + forum, but i wasn't able to find any function, method or workaround for making a perfect copy of an entity.
Is it possible this? I would use that, really.

Re: Perfect copy of an entity [Re: Aku_Aku] #328160
06/10/10 19:16
06/10/10 19:16
Joined: Apr 2010
Posts: 265
V
Vinous_Beret Offline
Member
Vinous_Beret  Offline
Member
V

Joined: Apr 2010
Posts: 265
what do you mean by perfetct?
please explain exactly why you want it.

Re: Perfect copy of an entity [Re: Vinous_Beret] #328165
06/10/10 19:36
06/10/10 19:36
Joined: Sep 2009
Posts: 987
Budapest
Aku_Aku Offline OP
User
Aku_Aku  Offline OP
User

Joined: Sep 2009
Posts: 987
Budapest
The new copy inherits all the attributes, functions, skins, etc. with other words everything from its predecessor. Perfectly.

Re: Perfect copy of an entity [Re: Aku_Aku] #328166
06/10/10 19:39
06/10/10 19:39
Joined: Apr 2010
Posts: 265
V
Vinous_Beret Offline
Member
Vinous_Beret  Offline
Member
V

Joined: Apr 2010
Posts: 265
it looks like you need some thing like:

ent_clone();

Re: Perfect copy of an entity [Re: Vinous_Beret] #328168
06/10/10 19:52
06/10/10 19:52
Joined: Sep 2009
Posts: 987
Budapest
Aku_Aku Offline OP
User
Aku_Aku  Offline OP
User

Joined: Sep 2009
Posts: 987
Budapest
The manual doesn't write this function duplicates the entity.
Will be good to do that for?
What/Where will be the pointer of the new entity?

Last edited by Aku_Aku; 06/10/10 19:56. Reason: one more question
Re: Perfect copy of an entity [Re: Aku_Aku] #328171
06/10/10 20:10
06/10/10 20:10
Joined: Apr 2010
Posts: 265
V
Vinous_Beret Offline
Member
Vinous_Beret  Offline
Member
V

Joined: Apr 2010
Posts: 265
OK then,why you don't ent_creat() the new entity and assign the old entiy's function to it?

Re: Perfect copy of an entity [Re: Aku_Aku] #328172
06/10/10 20:12
06/10/10 20:12
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
You are not looking for ent_clone. ent_clone allocates new memory for the mesh (and skin) so you can manipulate it without affecting all other instances of the same file.

I don't think there is an instruction that does what you are trying to do, but you can code it yourself of course. Don't think too complicated, f.i. you could set some skill to a specified value that indicates its action (then there is ent_for_filename or how it is called, ent_create,...).


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Perfect copy of an entity [Re: Vinous_Beret] #328173
06/10/10 20:21
06/10/10 20:21
Joined: Sep 2009
Posts: 987
Budapest
Aku_Aku Offline OP
User
Aku_Aku  Offline OP
User

Joined: Sep 2009
Posts: 987
Budapest
You know, i have my own solution.
I create the entity, set its attributes etc.
Later, when it needs, i create a new one, with loading from disk again and set everything again.
And, i change those attributes what i need.

But i am searching for an elegant way to do this process.
Perhaps no loading again from disk, no copying all the attributes and so on...

Last edited by Aku_Aku; 06/10/10 20:21.
Re: Perfect copy of an entity [Re: Aku_Aku] #328175
06/10/10 20:24
06/10/10 20:24
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
As you want to have two unique objects with the same attributes, there is always going to be some process of copying.
When you use ent_create and the entity is already in your level, ent_create does not load from hard disk.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Perfect copy of an entity [Re: Aku_Aku] #328176
06/10/10 20:26
06/10/10 20:26
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Beret, ent_clone is needed, but it doesnt actually DO the cloning process.

Aku,
there is no built-in function for duplicating an entity, you'll need to write your own.
This SHOULD do the job though... (Untested Lite-C, Im typing out of my head here... I cant help with c-script though.)
Code:
...
// duplicates entity called "me" into a new entity stored in "you"
// duplicates EVERYTHING except the source entities action
you = ent_create(me.type, nullvector, NULL);
memcpy(&you.scale_x, &me.scale_x, sizeof(ENTITY)-(sizeof(C_LINK)+sizeof(var)));
ent_clone(you);
...




"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Page 1 of 4 1 2 3 4

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1