Copy entity

Grab your favourite IDE and tinker with the innards of game engines

Copy entity

Postby gladers on Tue Jun 28, 2011 12:34 pm

I have all the code ready to point at an entity and get the entity i am pointing at.

I would like to make a copy of it and place it on the map so i can make duplicates. I just need it to be a new entity with the same model, it doesnt have to copy all of the properties, health ect.

Thx,

Gladers
gladers
Member
Member
 
Joined: Sat Feb 27, 2010 2:53 pm

Re: Copy entity

Postby Surfa on Tue Jun 28, 2011 1:52 pm

Not sure if I get the problem you are having.

I am guessing you have fired out a trace and hit an entity then you can just cast this entity to a new point and grab all the data you need to create a new entity with all the right properties. Surely that should be quite simple.
Surfa
May Contain Skills
May Contain Skills
 
Joined: Sun Dec 30, 2007 3:04 pm

Re: Copy entity

Postby gladers on Tue Jun 28, 2011 7:30 pm

Just want to make a clone of it. i.e. point at an object and then it creates a duplicate of it on the map. So you then have 2 of them on the map.
gladers
Member
Member
 
Joined: Sat Feb 27, 2010 2:53 pm

Re: Copy entity

Postby zombie@computer on Tue Jun 28, 2011 7:57 pm

youll have to create a new entity using CreateEntityByName(char* entclass) using the pointed ents GetClassName(), then iterate all the important members and copy them.
When you are up to your neck in shit, keep your head up high
zombie@computer
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Fri Dec 31, 2004 5:58 pm
Location: Lent, Netherlands

Re: Copy entity

Postby gladers on Tue Jun 28, 2011 9:33 pm

Perfect, thanks!
gladers
Member
Member
 
Joined: Sat Feb 27, 2010 2:53 pm

Return to Programming

Who is online

Users browsing this forum: No registered users