Elemental shots, how?


I’m attempting to make some sweps,most of them inspired by borderlands.

Now, I made this fire-themed gun with clavus’ swep construction kit, and i got it working with mad cow’s base. BUT, I have no idea how I’m supposed to make it shoot fire-bullets. How should I do it? Any tips, guys?

You most likely have to use entity.
There are some other workarounds but entity is the best way to do it.

So I should create a whole new entity for each elemental type, right?

Or one if you know how to make template entities.

Uh, an entity isn’t really needed, you can just make a new tracer effect to look like an elemental bullet and then use bullet.Callback function to do the on elemental bullet hit ignite/freeze/whatever stuff.

Where should I be using bullet.Callback? the swep’s shared.lua?

Whereever you fire your bullet via Player:FireBullets. You might need to override this hook: http://wiki.garrysmod.com/page/WEAPON/ShootBullet if you haven’t already.

Hrm, I’m curious.

Mad Cow’s base file has a function called ShootFire, which, apparently, shoots fire bullets. Take a look HERE and search for ShootFire.

Apparently I need… fuel?

Well, you got all your leads, you can either override that function in your specific SWEP to do the stuff you need, or go for the fuel thingy.

Heh, it’s working fine now :v

Just had to change that fuel thingy. Now it checks for a boolean SWEP.IncBullets ( if not self.Owner:IsNPC() and self.IncBullets == true then ) and, if that’s true, then it just spews out awesome fiery bullets.

Thanks for your help!