AlliedModders

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

Unidentified 12-12-2005 20:19

Copy Ent?
 
Okay, let's say I want to copy an existing door on the map, but give It a new entid(If cannot do, nvm then). Anyways, I want to copy an existing door entity to a new origin. How would I do this?

Ingram 12-13-2005 01:38

copying doors might be a little tricky, basically they use more keyvalues than engine can get (to my knowledge), so if you wanted the door to rotate, you'd have to record them on map start. You could just make a wall (not rotating door) with the size and model of the door by copying the keyvalues that engine allows from the original door to the new door.

atomic 12-13-2005 09:00

That would be like copying a ladder, that is impossible!

Cheap_Suit 12-13-2005 11:58

Look at the code in Plant Anywhere by KRoTaL. I remember seeing something like this but with the bombsite.

Twilight Suzuka 12-13-2005 14:48

It is, in theory, possible to copy any entity.
What I would do is this:

Create a global dynamic array using Array module.
Hook create_entity in FM, both of them.

On each create_entity, make a dynamic keytable, and store its index into the global dynamic array, at the index which is its ent ID.

Use engine or FM to hook when key/values are initialized, and store all entity key/values into the dynamic keytable represented by their entID's.

Now you have a massive table of all the entities, and all of their key/values. From this, you can completely copy an entity.

XxAvalanchexX 12-13-2005 14:49

Quote:

Originally Posted by atomic
That would be like copying a ladder, that is impossible!

Copying doors is very possible...

Ingram 12-13-2005 15:11

Twilight Suzuka, i did that using ur ArrayX plugin, but i haven't really tested it, kinda stopped running a server. I'm now thinking i change it to nvault. You took over entmoving anyway (well not really, but u said u did), so i guess it doesn't really matter

atomic copying a ladder is possible, the part you actually climb is called func_ladder. When you just copy the model thats on top of func_ladder, there is just nothing for you to climb

Twilight Suzuka 12-13-2005 15:16

Array module is now part of default lineup ^^

Unidentified 12-13-2005 18:35

I'm confused. Would someone help?

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <engine> #define PLUGIN "New Plugin" #define VERSION "1.0" #define AUTHOR "Author" new entity = create_entity("func_door") public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     } public newdoor(){     find_ent_by_class("entid, classname")     entity_get_string(" ) // this part confuses me         // bah...

:/ entities confuse me

Unidentified 12-13-2005 21:08

Okay, I think I understand It a little better. Would this work?

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <engine> #define PLUGIN "New Plugin" #define VERSION "1.0" #define AUTHOR "Author" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)                 // Would I need a set_task here?     } public newdoor(){     new entity = create_entity("func_door")     entity_set_origin("604 477 -155")         entity_set_int(ent,EV_INT_solid, 2)         entity_set_string(ent,EV_SZ_classname,"model");     entity_set_model(ent,"models/mymodel.mdl");         return PLUGIN_HANDLED }

If It would work, would there be any strange affects or anything?


All times are GMT -4. The time now is 15:48.

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