This article's documentation is for anything that uses the Source engine. Click here for more information.

Weapon cubemap: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Replaced screenshot with one from HL2 (with new engine), this one is higher resolution and only features official map.)
m (Classifying as model entity)
 
(23 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{langsp}}
{{LanguageBar}}
It is also available in some newer games through mods or natively:<br>
{{Ent not in fgd}}
* {{csgo|4}}: Not natively supported
[[File:weapon_cubemap_Demonstration.png|thumb|300px|right|weapon_cubemap in {{hl2|4}}.]]
* {{l4d2|4}}: Not natively supported
{{CD|CWeaponCubemap|base=CBaseCombatWeapon|file1=1}}
* {{p2|4}}: Does have it in a working condition but needs the model from another game
{{This is a|model entity|name=weapon_cubemap|engine=Source|game=Half-Life 2 series|game1=Portal series|game2=Portal 2: Community Edition}}  
* {{p2ce|4}}: Implemented natively
 
This entity gives the player a set of spheres {{file|preset=2|models/shadertest/envballs|mdl}}, each with different reflective surfaces. It is used for checking [[cubemaps]].


{{note|This entity is not available in {{bms|4}}, aswell as newer version of {{css|4}}. For {{bms|4}}, use {{ent|weapon_crossbow}} for checking [[cubemaps]] (look at the scope).}}
The commands to get it (typed into the console) are either {{cmd|impulse|81}} or {{cmd|give|weapon_cubemap}}.
==Implementation==
These commands are considered cheats, meaning that {{cmd|sv_cheats}} must be enabled for them to work.<br>
You can switch to this weapon (after having received it) by typing {{code|preset=1|use weapon_cubemap}}.


If your game does not have {{code|preset=2|weapon_cubemap}}, rifle scopes could be used, such as the hunting rifle in {{l4d2|4}} or the AWP in {{csgo|4|nt=1}}, as alternatives.<br>
{{tip|To equip and draw the weapon for quick work, developers can bind this command to a specific key. For instance, typing {{cmd|bind|"X" "impulse 81"; "use weapon_cubemap"}} will bind it to the X key. (You may need to press it twice the first time you use it in a map.)}}
Community mods have been made to implement {{code|preset=2|weapon_cubemap}} into games that do not support it natively:<br>
{{tip|Changing weapon_cubemap's viewmodel to an invisible model (such as blackout.mdl) can be an easy method of hiding the players HUD and weapon at the same time without needing {{ent|player_speedmod}}.}}
* {{csgo}} [https://www.youtube.com/watch?v=TsGp9t9kYk4 Counter-Strike: Global Offensive]: Tutorial by TopHattWaffle and Zool Smith
{{note|{{p2}} does have it in a working condition but needs the model from another game}}
* {{l4d2}} [https://steamcommunity.com/sharedfiles/filedetails/?id=1832861982 Left 4 Dead 2]: Tutorial by MrFunreal


==Entity Description==
== Workarounds ==
[[File:weapon_cubemap_Demonstration.png|thumb|300px|right|weapon_cubemap in {{hl2|4}}.]]
If your game does not have <code>weapon_cubemap</code>, rifle scopes could be used, such as the [[weapon hunting rifle spawn|hunting rifle]] in {{l4d2|4}}, the [[weapon awp|AWP]] in {{csgo|4|nt=1}} or the [[weapon_crossbow|crossbow]] in {{bms|4}}, as alternatives.
This entity gives the player a set of spheres {{code|preset=2|models/shadertest/envballs.mdl}}, each with different reflective surfaces. It is used for checking [[cubemaps]].


The commands to receive the {{code|preset=2|weapon_cubemap}} (typed into the console) is either {{code|preset=3|[[impulse]] 81}} or {{code|preset=3|give weapon_cubemap}}.
Community mods have been made to implement it into games that do not support it natively:
These commands are considered cheats, meaning that {{code|preset=3|[[sv_cheats]]}} or developer mode must be enabled for them to work.<br>
* {{tf2|2}}: Create a [[VScript]] file named {{file|weapon_cubemap|nut}} inside {{path|tf/scripts/vscripts/}}, paste in the following code and then type <code>script_execute weapon_cubemap</code> and switch to melee.
You can switch to this weapon (after having received it) by typing {{code|preset=3|use weapon_cubemap}}.
::<source lang=js>
local player = GetListenServerHost()
local cubemap = "models/shadertest/envballs.mdl"
PrecacheModel(cubemap)
for (local i = 0; i < 8; i++)
{
    local weapon = NetProps.GetPropEntityArray(player, "m_hMyWeapons", i)
    if (weapon && weapon.GetSlot() == 2)
weapon.SetCustomViewModel(cubemap)
}
</source>


{{tip|To equip and draw the weapon for quick work, developers can bind this command to a specific key. For instance, typing {{code|preset=3|bind "X" "[[impulse]] 81"; "use weapon_cubemap"}} will bind it to the X key. (You may need to press it twice the first time you use it in a map.)}}
* {{csgo}} [https://www.youtube.com/watch?v=TsGp9t9kYk4 Counter-Strike: Global Offensive]: Tutorial by TopHattWaffle and Zool Smith
* {{l4d2}} [https://steamcommunity.com/sharedfiles/filedetails/?id=1832861982 Left 4 Dead 2]: Tutorial by MrFunreal
* {{bms}} [https://steamcommunity.com/sharedfiles/filedetails/?id=3342667300 Weapon_Cubemap (Dev Tool)]: A simple replacement for the [[weapon_assassin_glock|assassin glock]] by Jofoyo


==FGD Code==
== FGD Code ==
<pre>
<pre>
@PointClass base(Weapon,Targetname, Parentname) studio("models/shadertest/envballs.mdl") = weapon_cubemap : "Cubemap"[]
@PointClass base(Weapon,Targetname, Parentname) studio("models/shadertest/envballs.mdl") = weapon_cubemap : "Cubemap preview spheres"[]
</pre>
</pre>
[[Category:Cubemaps]]
[[Category:Level Design]]
[[Category:Weapons]]

Latest revision as of 04:36, 19 May 2025

English (en)한국어 (ko)Translate (Translate)
Icon-NotInFGD.png
This entity is not in the FGD by default.
See below for instructions on making it available.
weapon_cubemap in Half-Life 2 Half-Life 2.
C++ Class hierarchy
CWeaponCubemap
CBaseCombatWeapon
CBaseAnimating
CBaseEntity
C++ weapon_cubemap.cpp

weapon_cubemap is a model entity available in Half-Life 2 series Half-Life 2 series, Portal series Portal series, and Portal 2: Community Edition Portal 2: Community Edition.

This entity gives the player a set of spheres 🖿models/shadertest/envballs.mdl, each with different reflective surfaces. It is used for checking cubemaps.

The commands to get it (typed into the console) are either impulse 81 or give weapon_cubemap. These commands are considered cheats, meaning that sv_cheats must be enabled for them to work.
You can switch to this weapon (after having received it) by typing use weapon_cubemap.

Tip.pngTip:To equip and draw the weapon for quick work, developers can bind this command to a specific key. For instance, typing bind "X" "impulse 81"; "use weapon_cubemap" will bind it to the X key. (You may need to press it twice the first time you use it in a map.)
Tip.pngTip:Changing weapon_cubemap's viewmodel to an invisible model (such as blackout.mdl) can be an easy method of hiding the players HUD and weapon at the same time without needing player_speedmod.
Note.pngNote:Portal 2 does have it in a working condition but needs the model from another game

Workarounds

If your game does not have weapon_cubemap, rifle scopes could be used, such as the hunting rifle in Left 4 Dead 2 Left 4 Dead 2, the AWP in Counter-Strike: Global Offensive CS:GO or the crossbow in Black Mesa Black Mesa, as alternatives.

Community mods have been made to implement it into games that do not support it natively:

  • Team Fortress 2 Team Fortress 2: Create a VScript file named 🖿weapon_cubemap.nut inside 🖿tf/scripts/vscripts/, paste in the following code and then type script_execute weapon_cubemap and switch to melee.
local player = GetListenServerHost()
local cubemap = "models/shadertest/envballs.mdl"
PrecacheModel(cubemap)
for (local i = 0; i < 8; i++)
{
    local weapon = NetProps.GetPropEntityArray(player, "m_hMyWeapons", i)
    if (weapon && weapon.GetSlot() == 2)
		weapon.SetCustomViewModel(cubemap)
}

FGD Code

@PointClass base(Weapon,Targetname, Parentname) studio("models/shadertest/envballs.mdl") = weapon_cubemap : "Cubemap preview spheres"[]