AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Ent Copying (https://forums.alliedmods.net/showthread.php?t=2809)

Ingram 06-17-2004 17:29

Ent Copying
 
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?

BAILOPAN 06-17-2004 17:38

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

Ingram 06-17-2004 18:53

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 06-22-2004 20:25

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.

Mugwump 06-22-2004 21:00

*raises hand*

I'd like to see a working version. :)


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

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