Creating Weapons

Avatar
Katloverr
23 Posts
Posted Mar 25, 2014
I'm trying to create a custom gun for a mod I'm making; one that doesn't use the portal gun base model. I have absolutely no idea how I would go about doing it, although I'm working on mapping out the skin for it. Is it possible to import a custom 3d model, apply a skin to it, and use it instead of the portal gun? thanks
Advertisement
Registered users don't see ads! Register now!
Avatar
srs bsnss
552 Posts
Posted Mar 26, 2014
Replied 10 hours later
It's completely possible to make something in the place of the portal gun - I've seen CamBen make a cat instead of a portal gun, and there's Lamarr's underground style gun from Repercussions. I'm not sure how to model myself, but that shows that it's quite possible. In terms of firing something other than portals, I'm not sure. You could "fake" a weapon by using entities, but once again, I don't know.
Avatar
Katloverr
23 Posts
Posted Mar 26, 2014
Replied 12 hours later

srs bsnss wrote:
It's completely possible to make something in the place of the portal gun - I've seen CamBen make a cat instead of a portal gun, and there's Lamarr's underground style gun from Repercussions. I'm not sure how to model myself, but that shows that it's quite possible. In terms of firing something other than portals, I'm not sure. You could "fake" a weapon by using entities, but once again, I don't know.

Okay, thank you for at least confirming my hopes that it's possible I just need to find out if you can import 3d models cuz then I could Blender it or something...

Avatar
RustyDios
154 Posts
Posted Mar 27, 2014
Replied 11 hours later
This topic should help with that... Search function people... start using it;
http://forums.thinking.withportals.com/mapping-help/solved-importing-new-models-t9178.html?hilit=importing%203d%20models
Avatar
Katloverr
23 Posts
Posted Mar 27, 2014
Replied 10 hours later
I did actually find this a little while ago; thank you for the link though
Avatar
Katloverr
23 Posts
Posted Mar 30, 2014
Replied 3 days later
I have no clue how to make a .qc file or whatever the crap it's called that the game uses to call the texture
Avatar
boctroy
51 Posts
Posted Jun 02, 2014
Replied 2 months later
If you use the compiler in the portal2 bin file then you can have it make the .qc file fore you. I seem to have troubles with that compiler so what i do is take that .qc file and use it in the "crowbar" compiler that i downloaded.

If anyone knows how to set a model to a weapon i would really like to know.

Avatar
CamBen
973 Posts
Posted Jun 02, 2014
Replied 17 minutes later

boctroy wrote:
If you use the compiler in the portal2 bin file then you can have it make the .qc file fore you. I seem to have troubles with that compiler so what i do is take that .qc file and use it in the "crowbar" compiler that i downloaded.

If anyone knows how to set a model to a weapon i would really like to know.

You have to modify the weapon_portalgun.txt file in the portal 2/portal2/scripts/ folder

Avatar
boctroy
51 Posts
Posted Jun 02, 2014
Replied 7 minutes later
Thanks i will look into that when i get home.
Avatar
boctroy
51 Posts
Posted Jun 03, 2014
Replied 17 hours later
Ok thatnks, that worked. now however my costum weapon is on the ground. I am guessing this has somthing to do with "$attachment" does someone know the format for adding these to the .qc file, i'm not sure how this works, how do i give the smd an attachment point.

Also, is there a way to dynamiclly change that file. so i can change weapons mid game?

Avatar
boctroy
51 Posts
Posted Jun 04, 2014
Replied 1 day later

Never mind i figured it out

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

Avatar
boctroy
51 Posts
Posted Jun 09, 2014
Replied 5 days later
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.

Avatar
TeamSpen210
608 Posts
Posted Jun 09, 2014
Replied 2 hours later
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.
Avatar
boctroy
51 Posts
Posted Jun 10, 2014
Replied 14 hours later

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

Avatar
FelixGriffin
2,680 Posts
Posted Jun 15, 2014
Replied 4 days later
Unfortunately there's no real way. Trying to mess with the viewmodel entity via scripting generally leads to either no effect or crashes.
Avatar
CamBen
973 Posts
Posted Jun 15, 2014
Replied 4 hours later
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.
Advertisement
Registered users don't see ads! Register now!
Avatar
FelixGriffin
2,680 Posts
Posted Jun 16, 2014
Replied 15 hours later
That's brilliant, I'll have to try that.