Please or Register to create posts and topics.

Creating Weapons

PreviousPage 2 of 2

Never mind i figured it out

https://developer.valvesoftware.com/wik ... ng_Weapons

Hey Fellows,

Sorry to bother you again. I really like changing the weapon_portalgun.txt file to change my weapon, however i was wondering if there is a way to dynamically change this in mid-game. I want to have about 5 different weapons in the level so if anyone knows how to get this done i would be grateful.

I don't mind scripting so if you know a way to do it that way its okay.

I don't think it's possible to actually change weapons in Portal 2 (Valve removed a lot of code for features they weren't using). You might be able to fake it by parenting a weapon model to the player, or using a logic_measure_movement (can't remember which works better). Perhaps you can set the weapon_portalgun model to be an invisible model, and parent to the same attachment it uses. Then you can make logic to enable/disable draw of custom weapons, probably using an animation first to make them drop down offscreen like the portalgun has.

My stuff:
[spoiler]- BEE2 Addons | (BEE2)
- Hammer Addons
Maps:
- Crushed Gel
- Gel is Not Always Helpful[/spoiler]
TeamSpen210 wrote:
You might be able to fake it by parenting a weapon model to the player, or using a logic_measure_movement (can't remember which works better).

This is what i have already done in the past, and i do agree it is a sure way to do it. I would just be alot smoother and cooler (i think) if i could add actual weapons instead of parenting models.
Please if anyone has anyother ideas don't be afraid to post :thumbup:

Unfortunately there's no real way. Trying to mess with the viewmodel entity via scripting generally leads to either no effect or crashes.

Falsi sumus crusto!

To get a very smooth moving effect on custom viewmodels, you can technically parent models to the portalgun viewmodel, turned invisible, but it is incredibly unreliable and generally not a good method for weapons, as it requires tons of console commands and perfect positioning. I don't recommend it. However, if you are making a sourcemod, then you can edit the portalgun model and change the potatOS bodygroup to look completely different, such as a paint gun, and then swap between those using a logic_playerproxy.

My YouTube Channel: https://www.youtube.com/user/Camben24
Aperture Science: We do our science asbestos we can!

That's brilliant, I'll have to try that.

Falsi sumus crusto!
PreviousPage 2 of 2