Help modding/custom weapons
EggOfAwesome
Join Date: 2015-01-31 Member: 201139Members
in Modding
I was following some modding tutorials and found a cool one about adding effects to weapons. It taught how to make a shotgun light things on fire, but out of curiousity wanted to try to do it with an axe. Unfortunely it seems to have got messed up. I'm not sure if the naming is wrong, but where I put "axe" was originally shotgun, in hopes of well, getting an axe that lights things on fire. This is what I put below. (In the lua folder of the source of my "mod" from LaunchPad, a.k.a in mymodname.lua
function Axe:ApplyBulletGameplayEffects(player, hitEnt, impactPoint, Direction, damage, surface, showTracer)
if HasMixin(hitEnt, "Fire") then
hitEnt:SetOnFire(player, self)
end
end
Any ideas onto how to get it working?
Comments
The ApplyBulletGameplayEffects method is part of the BulletMixin which is inherited by the ClipWeapon class. And the Riftle class is a child of the ClipWeapon class.
If the previous sentence doesn't make sense to you best read up about the OOP concept (http://en.wikipedia.org/wiki/Object-oriented_programming).
You need to know and be used to it to really work with the ns2 code or any kind of modern coding language.
But the Axe is just a simple child of the Weapon class. So declaring the given method there won't make any difference.
So how to apply "fire blade" to the axe:
Let's simple use the DamageMixin:DoDamage(damage, target, point, direction, surface, altMode, showtracer) function. ( http://ns2docs.bplaced.net/ns2docs/tables/DamageMixin/index.html )
So it's
Here the link to the gist as the code block is making it so ugly and hard to read: https://gist.github.com/anonymous/ebc42f37261f3b6bd007
I once started a mod guide but never ever worked again at it but it might help you to sort out the basics: https://goo.gl/ipxtYQ
One additional question though, my rifle and pistol don't do any damage, was that my computer glitching out or did the code do that? (my computer loves to do stuff like that on occasion.)
Edit: The "fixed" version:
Gist: https://gist.github.com/GhoulofGSG9/5aaa5e8ebf2d899964d9
I'm having fun burning and axing hives and harvesters with this. I wonder what'd happen if I kill a hive in pregame...