Weapon portal base

From Valve Developer Community
< Hr
Revision as of 05:36, 18 January 2024 by MarvinG (talk | contribs) (Created Croatian translation (not completed))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
English (en)Hrvatski (hr)Translate (Translate)

Kod klasa je u Portal Portal i Portal 2 Portal 2 što je osnovna klasa za sva oružna entiteta.
Po funkcionalnosti je slično baseportalcombatweapon-u i basehlcombatweapon-u, ali ne potpuno. Dok njihov klasime entitet je skroz neiskorišten mogu ga koristiti niveli i modovi za izradu jednostavnih oružja.

Icon-Bug.pngGreška:Iz nepoznatih razloga oružje koje ima tip municije postavljenim, može se samo koristit jednom  [to-do: testirano u ?]

Creation

Ako ispravan oružni skript s imenom weapon_portal_base.txt je stavljen u 🖿/scripts/ mapu, igra će koristit tu skriput da definira model oružja, tip municije itd (ovo radi i ako je skript pakiran u nivel). Ako skript dopuštava oružju da puca metke, pucat će kao mitraljez niske točnosti, slično kako AR2 puca.

Note.pngBilješka:Oružja napravljeni koristeći weapon_portal_base nemaju sekundarni mod pucanja

Ako mu je tip municije ispravan, dodjeljivat će štetu kao bilo koje drugo oružje, dopuštavajući za pravljenje potpuno prilagođenim mitraljezom bez potrebe za novim oružnim kodom.

Fixing the damage

U Portal 2 Portal 2, svi Half-Life 2 Half-Life 2 tipovi municije postoju, ali konvari za štetu i maksimalni kapacitet municije su svi kao 0 but the convars for damage and max ammo capacity are all set to 0 by default. Copying 🖿hl2/cfg/skill.cfg over from Half-Life 2 Half-Life 2 into 🖿portal2/cfg/skill_portal2.cfg or setting the convars directly allows the Half-Life 2 Half-Life 2 ammotypes to be used to create damaging weapons in Portal 2 Portal 2.
Paired in conjunction with Portal 2 Portal 2's coop mode this allows for the creation of deathmatch style maps.

Note.pngBilješka:This does not need to be done in Portal 2: Community Edition, as Half-Life 2 weapons are implemented by default.

Custom "weapons"

If the script is one that doesn't shoot bullets (for example, if the gravity gun script is copied over), it will still act as a viewmodel and play firing animations, which is perfect for making new mechanically distinct weapons via entities like game_ui (for getting player left and right clicks) and logic_measure_movement (to move entities to the players eye position, for spawning projectiles or other weapon effects).

If the player doesn't have an item_suit, the command use weapon_portal_base can be used to switch to this weapon, and use weapon_portalgun can be used to switch back to the portal gun.

Note.pngBilješka:item_suit doesn't function in Portal 2 Portal 2, so use method is required.
Icon-Bug.pngGreška:Going through a trigger_portal_cleanser after the player has placed portals will show the portal gun's fizzle animation, even if the player is not holding the portal gun. This can be worked around by setting up a trigger_multiple and a game_ui to hide the player's held weapon while they walk through the fizzler.  [to-do: testirano u ?]

FGD Code

@PointClass base(Weapon,Targetname, Parentname) studio("models/weapons/w_portalgun.mdl") = weapon_portal_base : "Custom Weapon"[]

See also

Credits

This article has been copied from the Source Entities Wiki.

Original article by Pinsplash: https://srcents.miraheze.org/wiki/CWeaponPortalBase