AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how to create func_door_rotating triggered by func_button (https://forums.alliedmods.net/showthread.php?t=155916)

jimaway 04-28-2011 06:49

how to create func_door_rotating triggered by func_button
 
so yeah, i want a plugin to create a surf_ski_2 style jail, i got func_door_rotating and func_button to spawn but thats it

PHP Code:

iEntity create_entity"func_door_rotating" )
    if( !
is_valid_entiEntity ) ) {
        
log_amx"There was an error with creating")
        return 
0;
    }
    
entity_set_stringiEntityEV_SZ_classname"func_door_rotating")
    
entity_set_intiEntityEV_INT_movetypeMOVETYPE_FLY)
    
entity_set_intiEntityEV_INT_solidSOLID_BBOX)
    
entorigin[0] = jailLocation[0] +0.5
    entorigin
[1] = jailLocation[1] -0.5
    entorigin
[2] = jailLocation[2] -100//+0.5
    
entity_set_origin(iEntityentorigin
    
entity_set_model(iEntity,"models/fakejail/jail_floor.mdl")
    
entity_set_vector(iEntityEV_VEC_anglesFloat:{ 0.00.0 0.0  })
    
entity_set_size(iEntity,Float:{ -155.0,-155.0,-2.5}, Float:{ 155.0,155.0,2.5}  )
    
entity_set_string(iEntityEV_SZ_target"jbutton")
    
entity_set_string(iEntityEV_SZ_targetname"jdoor")
    
entity_set_float(iEntityEV_FL_speed100.0)


    
    
iEntity create_entity"func_button" )
    if( !
is_valid_entiEntity ) ) {
        
log_amx"There was an error with creating")
        return 
0;
    }
    
    
entity_set_stringiEntityEV_SZ_classname"func_button")
    
entity_set_intiEntityEV_INT_movetypeMOVETYPE_NONE)
    
entity_set_intiEntityEV_INT_solidSOLID_BBOX)
    
entorigin[0] = jailLocation[0]
    
entorigin[1] = jailLocation[1]
    
entorigin[2] = jailLocation[2] +178
    entity_set_origin
(iEntityentorigin
    
entity_set_model(iEntity,"models/fakejail/jail_button.mdl")
    
entity_set_vector(iEntityEV_VEC_anglesFloat:{ 0.00.0 0.0  })
    
entity_set_size(iEntity,Float:{ -16.0,-16.0,0.0}, Float:{ 16.0,16.0,32.0}  )
    
entity_set_string(iEntityEV_SZ_target"jdoor")
    
entity_set_string(iEntityEV_SZ_targetname"jbutton"

also id like the door to be touch activated, i found that in valve hammer theres a "flags" tab in object properties, where you could set that, but how to do that in code

pictures of flags that need to be set:
http://www.upload.ee/image/1303364/nupp.PNG
http://www.upload.ee/image/1303366/luuk.PNG

Hunter-Digital 04-28-2011 08:06

Re: how to create func_door_rotating triggered by func_button
 
Those flags listed in hammer are stored in EV_INT_spawnflags, it holds a bitsum.

Some bitsums can be found in includes/hlsdk_const.inc at the bottom, just search for func_button and func_door_rotating and you'll find what you need.

jimaway 04-28-2011 08:35

Re: how to create func_door_rotating triggered by func_button
 
thanks for that, but i still didnt get the door working

and the hlsdk_const.inc didnt have "Touch activates in it"

Hunter-Digital 04-28-2011 08:45

Re: how to create func_door_rotating triggered by func_button
 
It doesn't need to, you just don't set SF_DOOR_USE_ONLY and it's understandable that you can also touch it to open.

The rest, I never needed to create doors so I don't know.

Arkshine 04-28-2011 08:59

Re: how to create func_door_rotating triggered by func_button
 
To understand how works a door, look at the HLSDK, jimaway.

jimaway 04-28-2011 10:27

Re: how to create func_door_rotating triggered by func_button
 
more help would be appriciated, im too inexperienced to find out my problem from hlsdk, tho i tried

Arkshine 04-28-2011 11:18

Re: how to create func_door_rotating triggered by func_button
 
Using a plugin, hooking touch and using Ham_User or force_use.
Without using a plugin, not sure, I guess you will need a trigger entity so when a player touches it, this entity activates the door entity. Something like that.

jimaway 04-28-2011 14:52

Re: how to create func_door_rotating triggered by func_button
 
i havent even got the door working, how would hooking touch help me? only thing i got moving was the button that should open the door, dont ask me why it started moving (i even had entity spawnflag "SF_BUTTON_DONTMOVE")

jimaway 04-29-2011 07:41

Re: how to create func_door_rotating triggered by func_button
 
ok i got the func_door_rotating to work around Z axis ( tho i have entity_set_int(iEntity2, EV_INT_spawnflags, SF_DOOR_ROTATE_X) )

and if i use entity_set_int( iEntity2, EV_INT_movetype, MOVETYPE_PUSH) (the only movetype it works with properly) it crashes the game with fatal error when i get onto the door

the error is "Hit a func_door_rotating with no model (models/fakejail/jail_floor.mdl)" i also had same kind of error when i changed func_button to MOVETYPE_PUSH, any ideas?

edit: i got the door rotating on X axis with DispatchKeyValue(iEntity2, "spawnflags", "640") instead of setting EV_INT_spawnflags but it looks like only the model is rotating and the solid part is still in the same place, maby thats why i get the error when i touch the top part of the solid, any ideas?


more edit:
this is what i have now:
PHP Code:

    iEntity create_entity"func_button" )
    if( !
is_valid_entiEntity ) ) {
        
log_amx"There was an error with creating")
        return 
0;
    }
    
DispatchKeyValue(iEntity,"speed","5")
    
DispatchKeyValue(iEntity,"wait","3")
    
DispatchKeyValue(iEntity,"rendercolor","0 0 0")
    
DispatchKeyValue(iEntity,"renderamt","0")
    
DispatchKeyValue(iEntity,"targetname","jbutton")
    
DispatchKeyValue(iEntity,"angles","0 0 0")
    
DispatchKeyValue(iEntity,"target","jdoor")
    
DispatchKeyValue(iEntity,"health","0")
    
DispatchKeyValue(iEntity"lip""0")
    
DispatchKeyValue(iEntity"sounds""2")
    
DispatchKeyValue(iEntity"delay""0")
    
DispatchKeyValue(iEntity"locked_sound""0")
    
DispatchKeyValue(iEntity"unlocked_sound""0")
    
DispatchKeyValue(iEntity"locked_sentence""0")
    
DispatchKeyValue(iEntity"unlocked_sentence""0")
    
DispatchKeyValue(iEntity"spawnflags""319")
    
DispatchKeyValue(iEntity"classname""func_button")
    
DispatchKeyValue(iEntity"model""models/fakejail/jail_button.mdl")
    
DispatchSpawn(iEntity)
    
    
entity_set_intiEntityEV_INT_movetypeMOVETYPE_NONE)
    
entity_set_intiEntityEV_INT_solidSOLID_BBOX)
    
entorigin[0] = jailLocation[0]
    
entorigin[1] = jailLocation[1]
    
entorigin[2] = jailLocation[2] +178
    entity_set_origin
(iEntityentorigin
    
entity_set_size(iEntity,Float:{ -16.0,-16.0,0.0}, Float:{ 16.0,16.0,32.0}  )
    
    new 
iEntity2 create_entity"func_door_rotating" )
    if( !
is_valid_entiEntity2 ) ) {
        
log_amx"There was an error with creating")
        return 
0;
    }
    
entity_set_size(iEntity2,Float:{ -155.0,-155.0,-4.5}, Float:{ 155.0,155.0,4.5}  )
    
entorigin[0] = jailLocation[0//+0.5
    
entorigin[1] = jailLocation[1//-0.5
    
entorigin[2] = jailLocation[2] -100//+0.5

    
DispatchKeyValue(iEntity2"angles""0 0 0")
    
DispatchKeyValue(iEntity2,"movesnd","3")
    
DispatchKeyValue(iEntity2,"stopsnd","4")
    
DispatchKeyValue(iEntity2,"wait","3")
    
DispatchKeyValue(iEntity2,"rendermode","2")
    
DispatchKeyValue(iEntity2,"renderamt","255")
    
DispatchKeyValue(iEntity2,"rendercolor","0 0 0")
    
DispatchKeyValue(iEntity2,"distance","90")
    
DispatchKeyValue(iEntity2,"dmg","0")
    
DispatchKeyValue(iEntity2"targetname""jdoor")
    
DispatchKeyValue(iEntity2"speed""100")
    
DispatchKeyValue(iEntity2"lip""0")
    
DispatchKeyValue(iEntity2"dmg""0")
    
DispatchKeyValue(iEntity2"target""jbutton")
    
DispatchKeyValue(iEntity2"delay""0")
    
DispatchKeyValue(iEntity2"health""0")
    
DispatchKeyValue(iEntity2"locked_sound""0")
    
DispatchKeyValue(iEntity2"unlocked_sound""0")
    
DispatchKeyValue(iEntity2"locked_sentence""0")
    
DispatchKeyValue(iEntity2"unlocked_sentence""0")
    
DispatchKeyValue(iEntity2"renderfx""0")
    
DispatchKeyValue(iEntity2"model""models/fakejail/jail_floor.mdl")
    
DispatchKeyValue(iEntity2"classname""func_door_rotating")
    
DispatchKeyValue(iEntity2"spawnflags""640")
    
DispatchSpawn(iEntity2)
    
entity_set_intiEntity2EV_INT_movetypeMOVETYPE_PUSH)
    
entity_set_intiEntity2EV_INT_solidSOLID_BBOX)
    
entity_set_origin(iEntity2entorigin
    
entity_set_size(iEntity2,Float:{ -155.0,-155.0,-4.5}, Float:{ 155.0,155.0,4.5}  ) 

only had a little improvement, button triggers the door now (for some reason it takes ages tho... like ~15+ minutes or so :mrgreen:) and i still get that fatal error when i stand on the door when it moves + the solid part still doesent move

id really like to get this to work so please, anyone whos experienced enough HELP meee :3

jimaway 04-30-2011 10:01

Re: how to create func_door_rotating triggered by func_button
 
is it possible to make the door and button in valve hammer and just import the .bsp somehow?


All times are GMT -4. The time now is 04:23.

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