Launch console commands?

Avatar
bawng
14 Posts
Posted May 28, 2013
Hi!

I'm fairly new to Hammer modding.

I'm trying to create a custom map for Portal 2 in Hammer.

Now, one of the functions in the map will (if I can manage) be a rocket launcher (i.e. a player-wielded rocket launcher).

I've managed to create a paintgun using game_ui and info_paint_sprayer etc.
I would like to replace that info_paint_sprayer with something that fires rockets, but there seems to be no such entity in the SDK, but I know that the game supports rockets since the prop_rocket_tripwire does fire rockets, and more to the point - fire_rocket_projectile works as a console command.

Now, I figure that the easiest route would be to somehow trigger this fire_rocket_projectile command. Is this possible to to from within Hammer? For example by binding it to an output in game_ui.

If that's not possible, does anyone have any idea on how to create a rocket launcher in any other way? For example by lifting the rocket script from prop_rocket_tripwire. But I have absolutely no idea on how to do that.

Thanks for any help!

Advertisement
Registered users don’t see ads! Register now!
Avatar
FelixGriffin
2,680 Posts
Posted May 28, 2013
Replied 41 minutes later
The easy way would be to use a point_servercommand or point_clientcommand. The good way would be to use an env_entity_maker set to launch the templateat a certain speed in a certain direction with a rocket_turret_projectile (which shows up broken in Hammer but actually does work).
Avatar
bawng
14 Posts
Posted May 29, 2013
Replied 10 hours later
Thanks for the reply!

I'll try the good way first, then. I've read up on env_entity_maker and I think I understand how it works. However, where do I find the rocket_turret_projectile? It's not available as an entity in Hammer.

Do I need to import it from somewhere? Or am I misunderstanding something?

Avatar
CamBen
973 Posts
Posted May 29, 2013
Replied 2 hours later

FelixGriffin wrote:
The easy way would be to use a point_servercommand or point_clientcommand. The good way would be to use an env_entity_maker set to launch the templateat a certain speed in a certain direction with a rocket_turret_projectile (which shows up broken in Hammer but actually does work).

The entity will not show as a valid entity, just type it in and press enter a few times. It won't have any properties most likely, but give it a name and put it in a point_template, and that point template in the entity maker.

Avatar
FelixGriffin
2,680 Posts
Posted May 29, 2013
Replied 28 minutes later
It was left out of the FGD (Hammer's entity list), but still works. Just type it in the classname box.
Avatar
bawng
14 Posts
Posted May 30, 2013
Replied 18 hours later
Thanks for the replies!

Just creating an entity rocket_turret_projectile did indeed work! If I place it in the air it just hangs there :smile:

However, I am having trouble pointing the point_template to it.
In my rocket_turret_projectile I created a property "Name" and named it "rocket_projectile".

However, when I try to point Template 1 in my point_template to it, it doesn't work. I can't use the dropper-thingy and simply click on "rocket_projectile"; Template 1 just remains empty. I can, however, manually write "rocket_projectile" but the text is red, indicating that it doesn't exist.

Also, I get an error message when trying the map, "CreateInstance called on a point_template that has no templates: rockettemplate1" where rockettemplate1 is my point_template.

I trigger it from an env_entity_maker.

Any ideas?

Thanks again!

Avatar
bawng
14 Posts
Posted May 30, 2013
Replied 4 minutes later
Never mind! I got it to work!

I didn't realize that the name property was supposed to be "targetname", not "Name". Smartedit fooled me :smile:

Thank you for your help!

One final question: I don't get any sound while the rocket is moving, and console gives me an error message saying that the sound files "weapons\rocket\rocket_fly_loop1.wav" and "weapons\rocket\rocket_fire1.wav" is missing. However, the client command fire_rocket_projectile has these sounds. Do I need to manually include these sounds in my map somehow?

Avatar
josepezdj
2,386 Posts
Posted May 30, 2013
Replied 53 minutes later

bawng wrote:
One final question: I don't get any sound while the rocket is moving, and console gives me an error message saying that the sound files "weapons\rocket\rocket_fly_loop1.wav" and "weapons\rocket\rocket_fire1.wav" is missing. However, the client command fire_rocket_projectile has these sounds. Do I need to manually include these sounds in my map somehow?

Yes, if the entity wasn't finally included into the game, maybe those sounds weren't either... Maybe you can get them from HL2 or any other game (I don't know where that entity was used), then pack them with pakrat: place them in the path you posted inside the sounds folder, then use pakrat to add them manually... the game should locate the sounds from inside the .bsp.

Avatar
FelixGriffin
2,680 Posts
Posted May 30, 2013
Replied 4 hours later
The files should be in both HL2 and Portal 1, so you can get them from the SDK base. Otherwise they're in Skotty's Fixed Rocket Turret instance.
Avatar
bawng
14 Posts
Posted Jun 03, 2013
Replied 4 days later
Thanks, I'll try this!
Avatar
bawng
14 Posts
Posted Jun 03, 2013
Replied 15 minutes later
A related question: Is it possible to intercept when a player uses the +Use button? Similar to how game_ui allows us to intercept fire1 and fire2?

Thanks again!

Avatar
FelixGriffin
2,680 Posts
Posted Jun 03, 2013
Replied 25 minutes later
Parent a func_button to the player, SetParentAttachmentMaintainOffset it just in front of the "eyes," lock it to stop intercepting +use.
Avatar
bawng
14 Posts
Posted Jun 05, 2013
Replied 1 day later
Thanks again!

I'm having a bit of trouble with parenting to the player. I thought the parent should be "!player" but apparently that doesn't work. The button works, but it doesn't follow the player. How do I do this? Also, how do I solve this for multiplayer?

Avatar
josepezdj
2,386 Posts
Posted Jun 05, 2013
Replied 20 minutes later
In coop you can refer to each player by red* and blue*. In order to attach something to them use for example a logic_auto with similar outputs to these:
*
- OnMapSpawn > [func_button_name_here] > SetParent > red
- OnMapSpawn > [func_button_name_here] > SetParentattachmentMaintainOffset > eyes*

Same for the blue player.

Avatar
bawng
14 Posts
Posted Jun 05, 2013
Replied 41 minutes later
Thank's for the quick reply!

I tried using a trigger to parent my func_button to red but that didn't work. Neither to blue.
I get this error in console: "Entity func_button(pl1_button) has bad parent blue". I'm guessing it's a syntax error?

Avatar
josepezdj
2,386 Posts
Posted Jun 05, 2013
Replied 1 hour later
Oh perhaps I forgot to add the exclamation mark before the "red"? :biggrin:

!red

Avatar
bawng
14 Posts
Posted Jun 05, 2013
Replied 12 minutes later
Yeah, well I tried with the exclamation mark, but the error was the fact that I didn't realize that I couldn't use !red and !blue while testing the map as single player :smile: For now I parented it to !player and it works.

However, I'm having trouble with the attachment part. When Using SetParentAttachment to "eyes" the button hovers "in" the eyes and the player get stuck in it. When using SetParentAttachmentMaintainOffset to "eyes", the button hovers a bit above the player instead.

In neither case is it usable.

Does this have to do with where I place the brush entity in Hammer?

Avatar
josepezdj
2,386 Posts
Posted Jun 05, 2013
Replied 32 minutes later
I don't think it has to do with where you placed the entity in hammer, but more with the place the player was in the moment the output was fired. Try to keep the player stuck or something while the attachment is being fixed in order to discard this possibility :wink:

However, in order to find a better attachment point for the players, you can use the model viewer and load whatever player model, then go to the "attachment" tab and check their names and locations easily in the model.

Avatar
bawng
14 Posts
Posted Jun 05, 2013
Replied 31 minutes later
It seems that "eyes" is the best attachment point.

The problem remains, though. I found that by moving the button's Origin point I could get it a bit away from the player, so I won't get stuck. However, if I move to quickly, or if I jump, the button doesn't move quick enough so I get temporarily stuck until the button catches up.

And still, it's no longer usable.

I really appreciate that you try to help me though! :smile: Thanks!

Advertisement
Registered users don’t see ads! Register now!
Avatar
bawng
14 Posts
Posted Jun 05, 2013
Replied 4 minutes later
Oh, and this is by using SetParentAttachment. If I use SetParentAttachmentMaintainOffset, the button ends up at a distance equal to the distance between the button and the info_player_start in Hammer.