Raised This Month: $ Target: $400
 0% 

Ent Copying


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ingram
Veteran Member
Join Date: May 2004
Old 06-17-2004 , 17:29   Ent Copying
Reply With Quote #1

I made a plugin that should allow me to copy an ent (at least i think so)

Code:
public copyent (id,level,cid){     if (!cmd_access(id,level,cid,1))             return PLUGIN_HANDLED                 new target,bodypart, arg [64]     get_user_aiming (id,target,bodypart)     entity_get_string(target,EV_SZ_model,arg,63)     if (equal(arg,"models/player.mdl"))         return PLUGIN_HANDLED                 new entnum         new Float:arg2 [3]                 entity_get_string(target,EV_SZ_classname,arg,63)         entnum=create_entity(arg)                 entity_set_edict(entnum, EV_ENT_pContainingEntity, entity_get_edict(target, EV_ENT_pContainingEntity))                 entity_get_vector(target,EV_VEC_absmin,arg2)     entity_set_vector(entnum, EV_VEC_absmin, arg2)     entity_get_vector(target,EV_VEC_absmax,arg2)     entity_set_vector(entnum, EV_VEC_absmax, arg2)     entity_get_vector(target,EV_VEC_mins,arg2)     entity_set_vector(entnum, EV_VEC_mins, arg2)     entity_get_vector(target,EV_VEC_maxs,arg2)     entity_set_vector(entnum, EV_VEC_maxs, arg2)     entity_get_vector(target,EV_VEC_size,arg2)         entity_set_vector(entnum, EV_VEC_size, arg2)                 entity_set_int(entnum, EV_INT_movetype, entity_get_int(target, EV_INT_movetype))     entity_set_int(entnum, EV_INT_solid, entity_get_int(target, EV_INT_solid))     entity_set_int(entnum, EV_INT_modelindex, entity_get_int(target, EV_INT_modelindex))     entity_set_int(entnum, EV_INT_spawnflags, entity_get_int(target, EV_INT_spawnflags))         entity_set_int(entnum, EV_INT_flags, entity_get_int(target, EV_INT_flags))                 entity_get_string(target,EV_SZ_model,arg,63)         entity_set_string(entnum, EV_SZ_model, arg);                                 return PLUGIN_HANDLED }

the problem is it copies everything but the fact that the ent in the world (i can't move it around, also made, and u can walk through it). Anyone know the problem?
Ingram is offline
BAILOPAN
Join Date: Jan 2004
Old 06-17-2004 , 17:38  
Reply With Quote #2

there's like 100 vars that entities have, so undoubtedly you're missing some - also for some entities they may need to have DispatchKeys set and all entities should be DispatchSpawn'd after creation
__________________
egg
BAILOPAN is offline
Ingram
Veteran Member
Join Date: May 2004
Old 06-17-2004 , 18:53  
Reply With Quote #3

yeah i know, its so many, i created a plugin to output the vars of a box and found that func_walls (pretty much anything u'd want to copy) have basically the same stuff. (spawnflags may or may not have). I used this output and the output of a created ent, compared all the values. Every var that should have a value had one.

i will figure out the DispatchKeyValue, thx
Ingram is offline
Ingram
Veteran Member
Join Date: May 2004
Old 06-22-2004 , 20:25  
Reply With Quote #4

i did it

i'm not sure if dispatchspawn helped (leaving it in there anyway), but the problem was pContainingEntity. I started commenting out parts to see what was not needed and as soon as i commented it out it began to work.

I'm sure some people have plugins for moving ents and stuff, but if anyone this plugin to move and copy ents(i couldn't find another ent moving/copying in the plguins forum), reply to this and i will work on the plugin a bit and post it in the plugins forum, since i must be the only one here without a plugin posted.
Ingram is offline
Mugwump
Senior Member
Join Date: May 2004
Old 06-22-2004 , 21:00  
Reply With Quote #5

*raises hand*

I'd like to see a working version.
Mugwump is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:45.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode