Pick up the crowbar of research scientist Gordon Freeman, who finds himself on an alien-infested Earth being picked to the bone, its resources depleted, its populace dwindling. Freeman is thrust into the unenviable role of rescuing the world from the wrong he unleashed back at Black Mesa. And a lot of people, people he cares about, are counting on him.
It was hard for me to make a laser for our game (Cubic Life) so I tought, I'll make my own tutorial and promote our game a bit ;p If u want to put a laser in ur mod just follow this tutorial.
Posted by Speedlly on Nov 8th, 2009 digg this super bookmark
Intermediate Server Side Coding.
How to make a the pistol shoot with a laser: Laser Pistol!
Just follow this tutorial and ur pistol is going to shoot laserbeams
1 Open pistol.cpp
add this under includes "gamestat.h":
beam_shared.h defines alot about beams
ammodef.h is needed for the trace of the laser
the PHYSCANNON_BEAM_SPRITE defines what sprite is used, if u change the vmt u can make the laser have another color
add in public (under DECLARE_SERVERCLASS();):
DrawBeam and DoImpactEffect are new parts that we will put in the script
Add in private (under DECLARE_ACTTABLE();):
m_nBulletType is a variable that we will use in the script
Add under BEGIN_DATADESC( CWeaponPistol ):
an extra define for m_nBulletType
We will need trace_t &tr, int nDamageType, CBaseCombatCharacter *pOperator in the Primaryattack part
Go to
Add:
Scroll down to the end of the script, add there:
We define the beam
2 Open hl2_gamerules.cpp
Change
to
If the enemy dies, he will dissolve and there dont draw a line after the bullet
3 Open \Steam\steamapps\SourceMods\MyMod\scripts\weapon_pistol.txt
Change
to
We change the name in the bucket
If u know how u can change the SoundData so it will make a better noise
4 Open \Steam\steamapps\SourceMods\MyMod\cfg\skill.cfg
Change
to
This weapon doesn't shoot with normal bullets but with a laser so it will do a bigger damage to the enemy.
END
I hope this helps u a bit
Speedlly (Scubic)
=> this weapon (or a part of it) is going to play a role in the game that were maken (Cubic Life)
This works... i tested it myself
Only registered members can share their thoughts. So come on! Join the community today (totally free) and do things you never thought possible.
GAH D:
That much work for a single laser pistol?
That's normal.
too much to read,
why dont you upload pre-made files?
its just an idea though.
that takes all the fun ;D nice tutorial guys, this is going to be amazing :D
lol thats epic
Just wondering how long it took you to find the code to extend as well as tweek it to your liking? Nice work!
could be useful for my mod i will pass it forward, thanks!