Jpianist Posted August 25, 2016 Share Posted August 25, 2016 Hey everyone. I was wondering if anyone knows the code to make a lightning attack to be attached to when i use an ítem. Several mod characters have lightning attack to the press of a key, but i wanna attach the lightning to an object instead of a key (ítem), since i'm thinking on being 100% controller suport. Just to clarify, the ítem is an useable, so the idea is that when i use it a lightning strikes my enemies (monsters mainly, will have to add tags so that it doesn't work on everyone, specially not players) Thanks guys, i really appreciate your help Link to comment Share on other sites More sharing options...
Zer000 Posted September 3, 2016 Share Posted September 3, 2016 local function onattack(inst) if inst ~= nil and inst.fire ~= nil and inst:IsValid() and inst.fire:IsValid() then local x, y, z = inst.fire.Transform:GetWorldPosition() SpawnPrefab("sparks").Transform:SetPosition(x, y - .5, z) end end inst:AddComponent("weapon") inst.components.weapon:SetDamage(666) inst.components.weapon:SetOnAttack(onattack) inst.components.weapon:SetElectric() It will probably work like Morning Star Or you can use caster component actually Link to comment Share on other sites More sharing options...
. . . Posted September 3, 2016 Share Posted September 3, 2016 22 minutes ago, Zer000 said: inst.components.weapon:SetDamage(666) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now