Raised This Month: $ Target: $400
 0% 

copying an entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 09-09-2005 , 15:46   copying an entity
Reply With Quote #1

hi,
im trying to copy an info_player_start with this code:

Code:
public copyspawns() {     new entnum     while((entnum = find_ent_by_class(entnum, "info_player_start")))         entity_copy(entnum) } stock entity_copy(entid) {     new newent = create_entity("info_target")     if(!newent) return 0     new Float:vecs[3], strings[128], i     for(i = 0; i <= 36; i++) entity_set_int(newent, i, entity_get_int(entid, i))     for(i = 0; i <= 36; i++) entity_set_float(newent, i, entity_get_float(entid, i))     for(i = 0; i <= 22; i++) {         entity_get_vector(entid, i, vecs)         entity_set_vector(newent, i, vecs)     }     for(i = 0; i <= 10; i++) entity_set_edict(newent, i, entity_get_edict(entid, i))     for(i = 0; i <= 12; i++) {         entity_get_string(entid, i, strings,127)         entity_set_string(newent, i, strings)     }     for(i = 0; i <= 5; i++) entity_set_byte(newent, i, entity_get_byte(entid, i))     new Float:maxs[3]     entity_get_vector(entid, EV_VEC_mins, vecs)     entity_get_vector(entid, EV_VEC_maxs, maxs)     entity_set_size(newent, vecs, maxs)     entity_get_string(entid, EV_SZ_model, strings)     entity_set_model(newent, strings)     entity_get_origin(entid, vecs)     entity_set_origin(newent, vecs)     DispatchSpawn(newent)     return newent } stock entity_get_origin(entid, Float:orig[3]) {     if(entity_get_int(entid, EV_INT_solid) == SOLID_BSP) get_brush_entity_origin(entid, orig)     else entity_get_vector(entid, EV_VEC_origin, orig)     return orig[0] && orig[1] && orig[2] }

its just that the entity is often placed somewhere it shouldnt be in (like outside the map)
__________________
plop
p3tsin is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 09-12-2005 , 14:54  
Reply With Quote #2

any ideas ?
__________________
plop
p3tsin is offline
LynX
Veteran Member
Join Date: Oct 2004
Old 09-12-2005 , 15:45  
Reply With Quote #3

Code:
    new Float:Origin[3]     pev(index, pev_origin, Origin)     engfunc(EngFunc_SetOrigin, index, Origin)

pev is used for getting origin, engfunc for setting it.
This way doesn't have any bugs
__________________
Current plugin : SoulPunisher anti-cheat
Percentage done : {||--------} 20%

If you think v3x is a PIMP, paste this into your sig!

If you think Bailopan is DA BOMB, paste this into your sig
LynX is offline
Send a message via ICQ to LynX
Ingram
Veteran Member
Join Date: May 2004
Old 09-13-2005 , 02:55  
Reply With Quote #4

creating/changing player spawns after the map is running has never worked for me. Players will begin spawning at the origin, which sounds like what is happening to you
Ingram is offline
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 09-13-2005 , 03:04  
Reply With Quote #5

Code:
entity_get_origin(entid, vecs)     entity_set_origin(newent, vecs)
use this
Code:
if(entity_get_int(entid, EV_INT_solid) == SOLID_BSP)      get_brush_entity_origin(entid, orig); else      entity_get_vector(entid,EV_VEC_origin,vecs); entity_set_origin(newent,vecs)
Freecode is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 09-22-2005 , 10:39  
Reply With Quote #6

oh, that sounds about right JJkiller
what would be the best forward thats called before server activation in this case, if any ?
__________________
plop
p3tsin is offline
Ingram
Veteran Member
Join Date: May 2004
Old 09-23-2005 , 09:56  
Reply With Quote #7

if freecode's idea doesn't work and you just want to move them, you might wanna try
pfn_keyvalue (just change the origin)
if you are trying to add extra spawns, maybe just using ripent to add them to the map will work

i haven't tried either way, so i don't know if they will work. Also, i don't really think you need to copy all those variables. I think spawns only need classname, origin, and angle. (maybe something like "team" as well, depending on the mod.
Ingram 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:27.


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