Raised This Month: $51 Target: $400
 12% 

Creating a func_door


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
FatalisDK
Senior Member
Join Date: Mar 2006
Location: bacon
Old 04-12-2006 , 00:03   Creating a func_door
Reply With Quote #1

If you ever played a bhop map, you'll know what I'm trying to do in this plugin. Basically trying to make a func_door, when you touch it it goes down into the ground (the keyvalues I have are correct).

Code:
#include <amxmodx> #include <amxmisc> #include <engine> #define PLUGIN "bhop box maker" #define VERSION "0.1" #define AUTHOR "FatalisDK" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("say /bhopbox","bhop")     //register_clcmd("finddoor","doorfind") } /*public doorfind(id) {     new door = find_ent_by_class(-1,"func_door")     client_print(0,print_chat,"Movetype - %i",entity_get_int(door,EV_INT_movetype))     client_print(0,print_chat,"Solid - %i",entity_get_int(door,EV_INT_solid)) }*/ public bhop(id) {     new ent = create_entity("info_target")     if (!is_valid_ent(ent)) return PLUGIN_HANDLED         DispatchKeyValue(ent,"classname","func_door")     DispatchKeyValue(ent,"rendercolor","0 0 0")     DispatchKeyValue(ent,"angles","90 0 0")     DispatchKeyValue(ent,"speed","100")     DispatchKeyValue(ent,"wait","1")     DispatchSpawn(ent)         entity_set_string(ent,EV_SZ_classname,"func_door")     entity_set_model(ent,"models/bhopbox.mdl")     entity_set_size(ent,Float:{-32.0,-32.0,-32.0},Float:{32.0,32.0,32.0})     entity_set_int(ent,EV_INT_solid,SOLID_BSP) //finddoor returned 4 (SOLID_BSP)     entity_set_int(ent,EV_INT_movetype,MOVETYPE_PUSH) //finddoor returned 7 (MOVETYPE_PUSH)         new origin[3]     get_user_origin(id,origin)         new Float:flOrigin[3]     IVecFVec(origin,flOrigin)         entity_set_origin(ent,flOrigin)     flOrigin[2] += 72.0     entity_set_origin(id,flOrigin)         return PLUGIN_HANDLED } public plugin_precache() {     precache_model("models/bhopbox.mdl") }
__________________
FatalisDK is offline
Ingram
Veteran Member
Join Date: May 2004
Old 04-12-2006 , 01:56  
Reply With Quote #2

i don't know if you mean to create a func_door_rotating or not, but heres the keyvalues it used:
classname
model
origin
axes
distance
wait
speed
onoffmode
immediatemode
angles
rendercolor

its been a long time since i've done anything with ents, but try setting all these before spawning it. Most importantly, set origin before spawning it. i believe a door returns to the 0,0,0 origin for the ent, so i'm basically hoping that setting origin before spawning will set the mins/maxs and absmins/absmaxs. If that doesn't work, try setting the mins/maxs and absmins/absmaxs yourself instead of origin.
Ingram is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 04-12-2006 , 05:45  
Reply With Quote #3

change
Code:
new ent = create_entity("info_target")
to
Code:
new ent = create_entity("func_door")
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
FatalisDK
Senior Member
Join Date: Mar 2006
Location: bacon
Old 04-12-2006 , 11:07  
Reply With Quote #4

Dispatching model and origin seem to work, but I can't get the thing to be solid or act like a func_door. I tried set_size, movetype fly, sold bbox and it sorta worked. When I touch it, it moves up and down about 1 unit really fast, even if it's in the middle of the air. Key value "speed" doesn't affect how fast it goes.

Code:
#include <amxmodx> #include <amxmisc> #include <engine> #define PLUGIN "bhop box maker" #define VERSION "0.1" #define AUTHOR "FatalisDK" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("say /bhopbox","bhop")     register_clcmd("finddoor","doorfind") } public doorfind(id) {     new door = find_ent_by_class(-1,"func_door")     client_print(0,print_chat,"Movetype - %i",entity_get_int(door,EV_INT_movetype))     client_print(0,print_chat,"Solid - %i",entity_get_int(door,EV_INT_solid)) } public bhop(id) {     new ent = create_entity("func_door")     if (!is_valid_ent(ent)) return PLUGIN_HANDLED         new origin[3]     get_user_origin(id,origin)         new szOrigin[45]     format(szOrigin,44,"%i %i %i",origin[0],origin[1],origin[2])         DispatchKeyValue(ent,"classname","func_door")     DispatchKeyValue(ent,"origin",szOrigin)     DispatchKeyValue(ent,"model","models/bhopbox.mdl")         //I got all the keyvalues from Hammer     DispatchKeyValue(ent,"rendercolor","0 0 0")     DispatchKeyValue(ent,"angles","90 0 0")     DispatchKeyValue(ent,"delay","0")     DispatchKeyValue(ent,"speed","100")     DispatchKeyValue(ent,"movesnd","0")     DispatchKeyValue(ent,"stopsnd","0")     DispatchKeyValue(ent,"wait","1")     DispatchKeyValue(ent,"lip","0")     DispatchKeyValue(ent,"dmg","0")     DispatchKeyValue(ent,"health","0")     DispatchKeyValue(ent,"locked_sound","0")     DispatchKeyValue(ent,"unlocked_sound","0")     DispatchKeyValue(ent,"locked_sentence","0")     DispatchKeyValue(ent,"unlocked_sentence","0")     DispatchKeyValue(ent,"renderfx","0")     DispatchKeyValue(ent,"rendermode","0")     DispatchKeyValue(ent,"renderamt","0")         //movetype and solid are set to PUSH and BSP upon spawn automatically     DispatchSpawn(ent)         //entity_set_size(ent,Float:{-32.0,-32.0,-32.0},Float:{32.0,32.0,32.0})     //entity_set_int(ent,EV_INT_solid,SOLID_BBOX)     //entity_set_int(ent,EV_INT_movetype,MOVETYPE_FLY)         new Float:flOrigin[3]     IVecFVec(origin,flOrigin)     flOrigin[2] += 72.0     entity_set_origin(id,flOrigin)         return PLUGIN_HANDLED } public plugin_precache() {     precache_model("models/bhopbox.mdl") }
__________________
FatalisDK is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 04-12-2006 , 11:20  
Reply With Quote #5

got these values from kz_hop:
Code:
movedir: -0.00, 0.00, -1.00
also, are u having problems with the origin?
coz brushentities dont have it like pointentities do.. but right now i cant remember how to set it for them
__________________
plop
p3tsin is offline
FatalisDK
Senior Member
Join Date: Mar 2006
Location: bacon
Old 04-12-2006 , 11:25  
Reply With Quote #6

Origin is working fine, it's spawning where I want it.

Here's what a func_door looks like in cg_coldbhop. What's movedir?

Code:
{
"model" "*49"
"wait" "1"
"speed" "150"
"rendercolor" "0 0 0"
"angles" "90 0 0"
"classname" "func_door"
}
{
"model" "*50"
"wait" "1"
"speed" "150"
"rendercolor" "0 0 0"
"angles" "90 0 0"
"classname" "func_door"
}
__________________
FatalisDK is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 04-12-2006 , 11:32  
Reply With Quote #7

movedir should be the direction and distance to move..
so if the block's height was say 100 units, and movedir was 0 0 -1, it would move 100 units down
__________________
plop
p3tsin is offline
FatalisDK
Senior Member
Join Date: Mar 2006
Location: bacon
Old 04-12-2006 , 11:39  
Reply With Quote #8

I'm pretty sure
Code:
direction = angles
how far to move = size of brush + lip
I tried this but it didn't work.
Code:
DispatchKeyValue(ent,"movedir","0 0 -1")
Also tried
Code:
DispatchKeyValue(ent,"movedir","90 0 0")
EDIT: I got it to work..sorta
It all works fine, except when I jump onto it. I can touch it and it goes down like I want it, but when I jump onto it, it gives fatal error "Hit func_door with no model (models/bhopbox.mdl)"

Code:
#include <amxmodx> #include <amxmisc> #include <engine> #define PLUGIN "bhop box maker" #define VERSION "0.1" #define AUTHOR "FatalisDK" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("say /bhopbox","bhop") } public bhop(id) {     new ent = create_entity("func_door")     if (!is_valid_ent(ent)) return PLUGIN_HANDLED         new origin[3]     get_user_origin(id,origin)         new szOrigin[45]     format(szOrigin,44,"%i %i %i",origin[0],origin[1],origin[2] - 5)         DispatchKeyValue(ent,"origin",szOrigin)     DispatchKeyValue(ent,"model","models/bhopbox.mdl")         DispatchKeyValue(ent,"rendercolor","0 0 0")     DispatchKeyValue(ent,"angles","-90 0 0")     DispatchKeyValue(ent,"delay","0")     DispatchKeyValue(ent,"speed","150")     DispatchKeyValue(ent,"movesnd","0")     DispatchKeyValue(ent,"stopsnd","0")     DispatchKeyValue(ent,"wait","1")     DispatchKeyValue(ent,"lip","64")     DispatchKeyValue(ent,"dmg","0")     DispatchKeyValue(ent,"health","0")     DispatchKeyValue(ent,"locked_sound","0")     DispatchKeyValue(ent,"unlocked_sound","0")     DispatchKeyValue(ent,"locked_sentence","0")     DispatchKeyValue(ent,"unlocked_sentence","0")     DispatchKeyValue(ent,"renderfx","0")     DispatchKeyValue(ent,"rendermode","0")     DispatchKeyValue(ent,"renderamt","0")     DispatchSpawn(ent)         //entity_set_model(ent,"models/bhopbox.mdl")         entity_set_size(ent,Float:{-32.0,-32.0,-32.0},Float:{32.0,32.0,32.0})     entity_set_int(ent,EV_INT_solid,SOLID_BBOX)     entity_set_int(ent,EV_INT_movetype,MOVETYPE_PUSH)         new Float:flOrigin[3]     IVecFVec(origin,flOrigin)     flOrigin[1] += 72.0     entity_set_origin(id,flOrigin)         return PLUGIN_HANDLED } public plugin_precache() {     precache_model("models/bhopbox.mdl") }
__________________
FatalisDK is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 04-12-2006 , 14:23  
Reply With Quote #9

if angles set the moving direction, how would u spin & flip it around?

sry, but i cant help with that error.. never seen anything like that
__________________
plop
p3tsin 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 00:45.


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