PDA

View Full Version : binding brushes or mdls to a gun/gernade



awesomebillfromdawsonvile
2 Aug 2009, 06:39pm
does anyone have any idea how to do this. like say bind a key to a nade that opens door. or even less than that. just bind a mdl and a trigger hurt to a gun or somthin.

ive seen stuff like it done, i just have no clue as to how to go about doing it.

thanks in advance fellas

Bob Loblaw
2 Aug 2009, 08:11pm
Okay well you are wording it really sketch.. But basically here is what I think you're looking for.

Create a gun entity. Lets call it "Gunentity". Have it set to start constrained (Flags).
Now create a trigger push near the gun (referencing how you want it to be compared to the gun itself). Set the trigger up how you want it and set it's Parent to "Gunentity".

The trigger will follow the gun around even when you pick up the gun.
For a fun time (that crashes the server) create a trigger multiple and for outputs put "Onstarttouch !activator SetParent Gunentity". This makes the players parent the gun. So if he goes towards the gun, then someone picks up the gun, the person who picked up the gun can move around the other player. When you toss the gun the player goes flying. It's good amusement for a while ;)

For nade opening door I think you mean when you pick up a grenade a door opens? Create a weapon_hegrenade and for outputs have "OnPlayerPickUp DOORNAME Open".

Basically everywhere you said bind, you meant parent :)

awesomebillfromdawsonvile
3 Aug 2009, 06:15pm
first off thanks for the response,

ok heres what i had in mind, either a pistol that has a brush shaped like a key parented to it, so that when someone picks up the gun they have a key floating over their head. if possible they could then take that key to a trigger brush and use the key to unlock a door. ive seen it done in hl2 mods, but this is css so im not sure that can be done.

what i am sure can be done and really want to know how to do is, parent a brush and a trigger hurt to a gun. so when you pick it up you are walking around with somekinda brush entity and a trigger hurt in front of your gun.

so i assume that you have told me how to parent a trigger hurt( same way you parent a trigger push?) but how bout just parenting a brush to a gun. ive tired this b4 with no successs.

so mostly i wanna know how to parent a brush to a gun or gernade. the key thing is not really that important to me, its for a future project.

Olli3
3 Aug 2009, 09:33pm
Use filters so that when the selected object goes into the trigger, then have the trigger do what you want.

Thats my guess.

Bob Loblaw
4 Aug 2009, 12:36am
For parenting a brush to a gun select the brush you want turn it into a func_movelinear and for parent put the name of the gun. Very simple, the same as a trigger, except the brush needs to be a func_movelinear in order to have the parenting option. Func_brush does not appear in game when parented to a gun for some reason, nor does func_illusionary. Func_movelinear does and in flags it has a not solid option which makes movelinear proably the best choice.

You know how to do the key thing, make a key, turn it into a func_movelinear, then parent it.

This is where it gets tricky so I'll explain it as best as I can.

Basically most things, when parented to a gun that has been picked up, lose their value in the world as being what they actually are. Therefore triggers don't recognize them as they normally would, simply because they are parented to the gun and the gun is picked up by the player. There is a way around this:

Step 1:Create your weapon. I did weapon_deagle and called it "Deag". Under flags I have start constrained set.

Step 2:Create a prop_dynamic_override (I used cs_italy/orangegib3 because it is a very small prop, that can be concealed inside the key brush, therefore it goes unseen) I named this "Orange" and set it's parent to "Deag". Under flags I have "start with collisions disabled" turned on.

Step 3:Make the key brush and make sure it conceals the prop_dynamic_override. Put this and the prop_dynamic_override above the gun because they will move in sync with the gun. So if you want the key to be overhead, make sure it starts over top of the gun to begin with. Once the brush is made make it func_movelinear. I named mine "Key" and parented it to "deag". For flags I have set "Not solid".

Step 4:Create a filter_activator_name. I called mine "namefilt". Leave filter mode as "Allow" and filter name put "Orange"(Or whatever the name of your prop_dynamic_override is if you went with something different).

Step 5:Create a trigger_once. I called mine "Once" and have it set to start disabled (explained why in a minute). Under Filter name use namefilt (or whatever your filter_activator_name's name is) and for flags check off "Everything (not including physics debris)". My output is "OnStartTouch-sc(My servercommand)-Command-say **It worked!**. Since you want a door to open have "OnStartTouch-Door-Open".

Step 6:Create a trigger_multiple. I called mine "multiple". It is start enabled and has no filter. For flags I only have "Clients" checked off. For outputs have "OnStartTouch-Once(or the name of your trigger_once)-Disable" And have "OnStartTouch-Once-Enable-Delay:0.1". You must make sure that this trigger multiple is inside the trigger_once.

Explanation:The trigger_once will not recognize the prop_dynamic_override if it moves into the trigger. Therefore the trigger needs to be enabled while the prop is already inside of it. This is why you have a trigger_multiple disabling and enabling the trigger_once. Every time someone enters the trigger_multiple the trigger_once will turn off then on. If the prop isnt in the trigger_once then it will never activate. If the person holding the key/prop is inside the trigger_once then it will be turned on when he touches the trigger_multiple and the trigger_once will recognize the prop because it is already inside when the trigger_once is turned on. Then the trigger_once will fire its output, opening up the door.

Sorry if it is confusing. If you have questions just ask.

The link to the vmf of my ridiculously pro-star map is: http://rapidshare.com/files/263507850/key.vmf.html. It's a pretty in depth map with great scenery and such and such.

But seriously if you need a reference for what I'm talking about open the vmf to follow my directions. Remember the orange is inside of the key brush :) -Hope this helps.

EDIT:If you want the key to disappear after being used, have the trigger_once's outputs with "OnStartTouch-key-kill" And "OnStartTouch-orange-kill". This will kill the key brush and the orangegib prop.

awesomebillfromdawsonvile
5 Aug 2009, 06:54pm
thankyou thank you a thousand times thankyou! this helps greatly. ive been kicking this idea around for months now and should be able to do some pretty fun shite with this info. =)

awesomebillfromdawsonvile
23 Aug 2009, 11:03pm
i just tried this out and it worked like a charm. however i noticed that it seems to glitch the physics of the game.

One round after using the key, (orange parented to a flashnade) all the props bounce around. This wouldnt be a problem if i was doing mini games but its for a prison break map, so bouncing guns would make for a crazy round.

Any ideas on how to fix this, did i do somthing wrong? mybe only parent to guns and not nades? I know that the mines of moria map had a similar problem and now those maps dont seem to have that glitch anymore, so there must be a fix.....

edit :btw new rounds do not fix the glitch, and every private server map i tired to play afterwards was glithed until i restarted css.

Bob Loblaw
24 Aug 2009, 12:06pm
I believe creating a point_servercommand and having a command setting sv_turbophysics to 1 or something fixed the problem for him. But yeah I think it does screw up the physics. Parenting things to a knife doesn't *seem* to screw it up because you can't drop your knife, and I think it is the fact you can drop it that screws up the physics so hard. So if possible try parenting to a knife.. or try the sv_turbophysics.... Talk to haggard, I don't remember what thread but hannibal was askinga bout the sv_turbophysics and the difference between why SG's was glitching and others werent was because of sv_turbophysics.

awesomebillfromdawsonvile
25 Aug 2009, 04:17am
thanks once again bob, your a saint. cant wait for xmen!