Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Is it possible to add a func_button in mapadd?  (Read 3271 times)

0 Members and 1 Guest are viewing this topic.

Offline Zadaki_L

  • *
  • +1% chance to make useful post
  • Zadaki_L has no influence.
Is it possible to add a func_button in mapadd?
« on: October 04, 2013, 09:54:16 PM »
I've got a func_button working at the moment, but it has no world model and is invisible. I can put a prop_dynamic there, but it doesn't move when the player uses it. Is there a way to get a prop to move or rotate on a +use input?

Or maybe just get func_button to use a model? I'd be happy with either.



Also, what's the effect used in ravenhold where the gas makes a mirage before it ignites? I can't seem to find it on the valve wiki. [edit]It's the env_steam entity with ParticleType keyvalue set to 1 for "heat wave"[/edit]

Thanks!
« Last Edit: October 04, 2013, 09:59:53 PM by Zadaki_L »

Offline Rook

  • *
  • +2% chance to make useful post
  • Rook has no influence.
Re: Is it possible to add a func_button in mapadd?
« Reply #1 on: October 05, 2013, 12:00:37 AM »
It will work just fine in a mapadd. func_button isn't supposed to use a model, so nothing's broken. It usually only acts as an interface between props and the player. Things like mounted guns in the Half-Life 2 campaign are similar in that way. You're using a brush parented to the gun model, and animations are played by the model based on input given to the brush.  ;D

Anyway, I wrote up and tested an example script for you. You'll have to tweak the origin/angle values for a map of your choice if you want to see it in action, but this should give you a better idea of how to animate a prop_dynamic with other entities like func_button. Is this the kind of thing you were looking for, or are you still wanting to move/rotate the prop?  ???

Code: [Select]
"entities" {
// This first button will play a single animation when pressed, and then reset.
"func_button" {
"origin" "-8 144 72" "angle" "0 180 0"
"keyvalues" {
"spawnflags" "1025" // Brush is immobile. Is activated by +USE
"sounds" "45" // Plays buttons/combine_button_5.wav on each press
"wait" "0.5"
"OnPressed" "button_prop_simple,FireUser1,,0,-1"
}
}
"prop_dynamic" {
"origin" "-8 144 72" "angle" "0 180 0"
"keyvalues" {
"targetname" "button_prop_simple"
"model" "models/props_combine/CombineButton.mdl"
"DefaultAnim" "idle"
// Player pressed the func_button. Play the "press" animation
"OnUser1" "!self,SetAnimation,press,0,-1"
}
}
// This second button acts like a toggle switch. Pressing once will depress the button.
// A second use will raise the button. A third use will depress it again, and so on.
"func_button" {
"origin" "-8 96 72" "angle" "0 180 0"
"keyvalues" {
"spawnflags" "1061" // Brush is immobile. Toggle. Is activated by +USE
"sounds" "43" // Plays buttons/combine_button_3.wav on each toggle
"OnIn" "button_prop_toggle,FireUser1,,0,-1"
"OnOut" "button_prop_toggle,FireUser2,,0,-1"
}
}
"prop_dynamic" {
"origin" "-8 96 72" "angle" "0 180 0"
"keyvalues" {
"targetname" "button_prop_toggle"
"model" "models/props_combine/CombineButton.mdl"
"DefaultAnim" "idle"
// User1: Button is toggled on. Button is depressed.
//      "togglein" is set as the current animation to play.
//      "depressed" is set as the default animation. You
//      can think of this as the "idle" animation, played
//      and looped once other animations are done playing.
// User2: Button is toggled off. Button is raised.
//      "toggleout" is set as the current animation to play.
//      "idle" is set as the new default animation.
"OnUser1" "!self,SetAnimation,togglein,0,-1"
"OnUser1" "!self,SetDefaultAnimation,depressed,0,-1"
"OnUser2" "!self,SetAnimation,toggleout,0,-1"
"OnUser2" "!self,SetDefaultAnimation,idle,0,-1"
}
}
}
« Last Edit: October 05, 2013, 12:04:58 AM by Rook »

Offline BIZ

  • 32-Bit Hobo
  • *
  • *
  • +0% chance to make useful post
  • BIZ hides in shadows.
    • BSNOOCH.COM
Re: Is it possible to add a func_button in mapadd?
« Reply #2 on: October 05, 2013, 01:05:55 AM »
thats cool.

Pretty much any prop can be used as a button with spawnflag 256 (i think), generate output on +use.
I used a chunk of debris in OUTBREAK for this function :P

take a peek @ OUTBREAK mapadd d2_prion_08 for another example.

Offline Zadaki_L

  • *
  • +1% chance to make useful post
  • Zadaki_L has no influence.
Re: Is it possible to add a func_button in mapadd?
« Reply #3 on: October 05, 2013, 07:25:28 AM »
I must examine this later, when I am sober.

Offline Zadaki_L

  • *
  • +1% chance to make useful post
  • Zadaki_L has no influence.
Re: Is it possible to add a func_button in mapadd?
« Reply #4 on: October 07, 2013, 03:25:19 AM »
It will work just fine in a mapadd. func_button isn't supposed to use a model, so nothing's broken. It usually only acts as an interface between props and the player. Things like mounted guns in the Half-Life 2 campaign are similar in that way. You're using a brush parented to the gun model, and animations are played by the model based on input given to the brush.  ;D

Anyway, I wrote up and tested an example script for you. You'll have to tweak the origin/angle values for a map of your choice if you want to see it in action, but this should give you a better idea of how to animate a prop_dynamic with other entities like func_button. Is this the kind of thing you were looking for, or are you still wanting to move/rotate the prop?  ???

Code: [Select]
"entities" {
// This first button will play a single animation when pressed, and then reset.
"func_button" {
"origin" "-8 144 72" "angle" "0 180 0"
"keyvalues" {
"spawnflags" "1025" // Brush is immobile. Is activated by +USE
"sounds" "45" // Plays buttons/combine_button_5.wav on each press
"wait" "0.5"
"OnPressed" "button_prop_simple,FireUser1,,0,-1"
}
}
"prop_dynamic" {
"origin" "-8 144 72" "angle" "0 180 0"
"keyvalues" {
"targetname" "button_prop_simple"
"model" "models/props_combine/CombineButton.mdl"
"DefaultAnim" "idle"
// Player pressed the func_button. Play the "press" animation
"OnUser1" "!self,SetAnimation,press,0,-1"
}
}
// This second button acts like a toggle switch. Pressing once will depress the button.
// A second use will raise the button. A third use will depress it again, and so on.
"func_button" {
"origin" "-8 96 72" "angle" "0 180 0"
"keyvalues" {
"spawnflags" "1061" // Brush is immobile. Toggle. Is activated by +USE
"sounds" "43" // Plays buttons/combine_button_3.wav on each toggle
"OnIn" "button_prop_toggle,FireUser1,,0,-1"
"OnOut" "button_prop_toggle,FireUser2,,0,-1"
}
}
"prop_dynamic" {
"origin" "-8 96 72" "angle" "0 180 0"
"keyvalues" {
"targetname" "button_prop_toggle"
"model" "models/props_combine/CombineButton.mdl"
"DefaultAnim" "idle"
// User1: Button is toggled on. Button is depressed.
//      "togglein" is set as the current animation to play.
//      "depressed" is set as the default animation. You
//      can think of this as the "idle" animation, played
//      and looped once other animations are done playing.
// User2: Button is toggled off. Button is raised.
//      "toggleout" is set as the current animation to play.
//      "idle" is set as the new default animation.
"OnUser1" "!self,SetAnimation,togglein,0,-1"
"OnUser1" "!self,SetDefaultAnimation,depressed,0,-1"
"OnUser2" "!self,SetAnimation,toggleout,0,-1"
"OnUser2" "!self,SetDefaultAnimation,idle,0,-1"
}
}
}

It doesn't seem to work as-is, but if you parent the prop_dynamic to the func_button, it will work.

However, I would prefer a func_rot_button, which always seems to crash hl2.exe. Any ideas there?

Thanks!

Offline Rook

  • *
  • +2% chance to make useful post
  • Rook has no influence.
Re: Is it possible to add a func_button in mapadd?
« Reply #5 on: October 08, 2013, 02:13:01 AM »
That's odd because the scripted worked dandy for me, at least. Perhaps I got lucky with the geometry of the map I was using. It would make sense if the prop's bounding box or VPhysics' collision kept you from using the func_button, since I never needed to set its bounds in my test. That's what your workaround would suggest; entities that have been parented to another have their collision disabled. My fault for not thinking about that issue. Sorry!

If you're interested, you can set a brush's bounds using AddOutput to change its mins/maxs values. brush_1,AddOutput,mins -3 -3 0,0,-1 and brush_1,AddOutput,maxs 3 3 6,0,-1 would give you a 6x6x6 unit bounding box with its bottom base at the origin.  :)

As for func_rot_button, I'm not sure. I've never tried messing with that one before, and working with brushes in mapadds is always tricky. Some of them just don't function correctly if they're inserted. For example, it's quite possible to get a func_tank "functioning" but the turret model will not yaw and pitch correctly as you aim, and the result looks very unnatural. I'll just have to play around with func_rot_button tomorrow night and see what I can do.  :-\

Offline BIZ

  • 32-Bit Hobo
  • *
  • *
  • +0% chance to make useful post
  • BIZ hides in shadows.
    • BSNOOCH.COM
Re: Is it possible to add a func_button in mapadd?
« Reply #6 on: October 08, 2013, 04:22:00 AM »
just gonna throw it out there...
that we have messed with this before and haven't had any luck with injecting brushes through the mapadd.

hopefully though you will find a way because it would be very handy to be able to use brush based entities :D

Offline Rook

  • *
  • +2% chance to make useful post
  • Rook has no influence.
Re: Is it possible to add a func_button in mapadd?
« Reply #7 on: October 08, 2013, 05:46:09 AM »
just gonna throw it out there...
that we have messed with this before and haven't had any luck with injecting brushes through the mapadd.

hopefully though you will find a way because it would be very handy to be able to use brush based entities :D

I've already used func_button, func_brush, func_tankairboatgun, func_tankmortar, func_wall, func_wall_toggle, trigger_look, trigger_once, trigger_multiple and... well, you get the idea.

The triggers are probably the easier ones to set up. Give them an origin, an appropriate spawnflag (like "1" for the player), use AddOutput to tweak their bounding box as I described, and also use AddOutput to change their "solid" key to "2" so it does collision checks. I wish I could set the material used by func_brush/func_wall but other than that, it all seems to work fine.  ;)

Feel free to test it for yourself. I'm hoping it isn't just some anomaly created by my SMOD folder. I didn't think I messed with it that much!  ;D

Offline Rook

  • *
  • +2% chance to make useful post
  • Rook has no influence.
Re: Is it possible to add a func_button in mapadd?
« Reply #8 on: October 10, 2013, 10:29:53 PM »
Sorry it took me longer than expected to get around to it, Zadaki. Sure enough, I had a crashing problem but it seemed to go away after I turned the button's "Not solid" flag on. This means I've got a working example built for you! :D

For fun, I put together a small fire trap like the ones seen in Ravenholm. Both the gas valve and the big red button use func_rot_button to rotate their child props. I didn't bother setting up the microphones, so you can't spark the fire by attacking. Other than that, you can expect the same behavior. Here's a link to the example script and the map I built it on. You shouldn't have to fiddle with it this time. Fingers crossed!  ;D



Edit
Mm. I didn't think about it but I hope I'm not messing with any rules doing this double-post. I just wanted to be sure Zadaki saw this. Is that okay, Mister BIZ?  :-X
« Last Edit: October 10, 2013, 10:33:48 PM by Rook »

Offline BIZ

  • 32-Bit Hobo
  • *
  • *
  • +0% chance to make useful post
  • BIZ hides in shadows.
    • BSNOOCH.COM
Re: Is it possible to add a func_button in mapadd?
« Reply #9 on: October 10, 2013, 11:29:27 PM »
you can read the rules here. if it aint on there your ok

http://bsnooch.com/forums/index.php?page=rules

Offline Rook

  • *
  • +2% chance to make useful post
  • Rook has no influence.
Re: Is it possible to add a func_button in mapadd?
« Reply #10 on: October 11, 2013, 04:04:31 AM »
Oh, good. My thanks again, sir!  :)

Offline Zadaki_L

  • *
  • +1% chance to make useful post
  • Zadaki_L has no influence.
Re: Is it possible to add a func_button in mapadd?
« Reply #11 on: October 14, 2013, 02:41:02 AM »
Thanks! I'd been working on it on and off but spending a lot of time out of town and away from the computer. I'm certainly not in a rush, just messing around for my own amusement, and apparently to advance the state of SMOD mapadd technology.

Thanks again.

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal