FireFusorf wrote:
The problem is that I have no idea on how to texture it, animate it, and use it as a viewmodel in the Portal 2 engine.
Well, about texturing or animating your custom portalgun, I'm afraid you'll have to learn it within your modelling program. There are many good tutorials about this for almost any modelling program, search for UV mapping and creating model animations.
I could try to help you out on how to implement your custom model in Portal2 though, but there are a couple of things you should be aware of before continuing:
-
"Portal Stories: Mel" is a mod, and it even got greenlit so it's on Steam. This means that they can ship whatever custom portalgun model within the mod so that players can see it and use it.
-
Unless you make a mod, you'll only manage to get a working portalgun for your screen :p, thus you won't be able to pack it in your BSP and make the rest to play with it in the workshop.
That said, this is how it works:
- There's a script file called weapon_portalgun.txt located into your "portal 2/portal/scripts" folder. Take a look to it:
// Portalgun
WeaponData
{
// Weapon data is loaded by both the Game and Client DLLs.
"printname" "#Portal_Portalgun"
"viewmodel" "models/weapons/v_portalgun.mdl"
"playermodel" "models/weapons/w_portalgun.mdl"
"anim_prefix" "portalgun"
"bucket" "0"
"bucket_position" "2"
"clip_size" "1"
"primary_ammo" "None"
"secondary_ammo" "None"
"weight" "4"
"item_flags" "0"
"damage" "9"
"autoswitchto" "1"
// Sounds for the weapon. There is a max of 16 sounds per category (i.e. max 16 "single_shot" sounds)
SoundData
{
"single_shot" "Weapon_Portalgun.fire_blue"
"double_shot" "Weapon_Portalgun.fire_red"
// NPC SECTION
"single_shot_npc" "Weapon_Portalgun.fire_blue_npc"
"double_shot_npc" "Weapon_Portalgun.fire_red_npc"
}
// Weapon Sprite data is loaded by the Client DLL.
TextureData
{
"weapon"
{
"font" "WeaponIcons"
"character" "C"
}
"weapon_s"
{
"font" "WeaponIconsSelected"
"character" "C"
}
"ammo"
{
"font" "WeaponIcons"
"character" "M"
}
"crosshair"
{
"font" "Crosshairs"
"character" "."
}
"autoaim"
{
"file" "sprites/crosshairs"
"x" "0"
"y" "48"
"width" "24"
"height" "24"
}
}
}
As you can see this file controls many things about the portalgun, the models the game uses for the viewmodel and for the worldmodel, its sounds, etc. You could just edit this file and change the paths to your own portalgun files. However, as you could imagine, if you ever use the "verify local files" tool from your game properties on the Steam library, this file will be replaced by the old one.
In order to make this slightly more permanent, you could use the "dlc3 method". You already fiddled with it, so I assume you know what I mean
Apart from the pak01_dir.VPK inside the dlc3 folder, create a "common/portal 2/portal2_dlc3/scripts/" folder and put your custom "weapon_portalgun.txt" file inside it... that should make the game to load your custom portalgun script file that is pointing to your custom model portalgun files.
Hehe.... and by the way... did you notice that last part of the script file where it says this:
"crosshair"
{
"font" "Crosshairs"
"character" "."
}
"autoaim"
{
"file" "sprites/crosshairs"
"x" "0"
"y" "48"
"width" "24"
"height" "24"
}
I totally forgot that part was there. You can change the file that the game loads to make the crosshair in the HUD by editting the "file" path within the "autoaim" parameter putting the path to your custom crosshair file, as an alternate method to have your custom crosshairs 