Jump to content

Silly question(Special Effects on 'Default' Attacks)


Recommended Posts

So I've asked similar things like this before and they all worked great.

 

Special effects on crafting items

Special effects on weapons

Special effects when opponents are attacked

Special effects when just moving around

 

but I haven't a single idea how to give special effects just by regularly punching things with your fist.

Someone toss me a bone here? Would appreciate it very much!

 

Example: When my character punches the target I want the "mossling_spin_fx" on the target that's being hit.

 

I hate asking for more but is it also possible for my character to do ZERO damage when using anything on his hand-slot(Aka all hand-equippable items that cause damage)

Edited by rons0n
Link to comment
Share on other sites

Try "onattackother" event/callback-function, then test for whether the player holds something in the hands slot (inventory component).

 

As for the second question, maybe you could set the default damage to negative weapon damage upon switching gear? Or the multiplier to zero? You'd have to listen for changes from the inventory component.

Link to comment
Share on other sites

-- Effect on naked attack

inst:ListenForEvent("onattackother", function(inst, data)

if data.target ~= nil and data.weapon == nil then

local pos = data.target:GetPosition()

local fx = SpawnPrefab("mossling_spin_fx")

fx.Transform:SetPosition(pos.x, pos.y, pos.z)

end

end)

-- No damage with weapons

local _od = inst.components.combat.CalcDamage

inst.components.combat.CalcDamage = function(self, target, weapon, multiplier)

if weapon ~= nil then

multiplier = 0

end

return _od(self, target, weapon, multiplier)

end

Link to comment
Share on other sites

@Mobbstar, Thanks Mobbstar for the Idea!

 

And Thanks @DarkXero for literally making that idea work!

 

I appreciate both of you helping me out!

 

But out of curiosity: What If I wanted the effect to follow the target? For example I have:

local function onattack(inst, attacker, target)    local atkfx = SpawnPrefab("mossling_spin_fx")    if atkfx then	    local follower = atkfx.entity:AddFollower()	    follower:FollowSymbol(target.GUID, target.components.combat.hiteffectsymbol, 0, 0, 0 )    endend

So the effect follows the target as it moves. But I only applied this to a weapon. I tried doing the same thing with your code but I seemed to have derped. Why did I derp?

Edited by rons0n
Link to comment
Share on other sites

So the effect follows the target as it moves.
	-- Effect on naked attack	inst:ListenForEvent("onattackother", function(inst, data)		if data.target ~= nil and data.weapon == nil then			local fx = SpawnPrefab("mossling_spin_fx")			local follower = fx.entity:AddFollower()			follower:FollowSymbol(data.target.GUID, data.target.components.combat.hiteffectsymbol, 0, 0, 0)		end	end)
Link to comment
Share on other sites

I know I'm asking far too much questions but I hope 1 more doesn't kill anyone:

 

So my Caped Baldy is almost finished, but I want to add one more trait into him. Is there any way he can cause radius damage per hit? Something like the Abigail ghost except rather it being ticks it'd be per attack. If this is too far-fetched I apologize but I'd appreciate the input!

Link to comment
Share on other sites

@rons0n,
--this goes to the "onattackother" part
local pt = inst:GetPosition()
for k,v in pairs(TheSim:FindEntities(pt.x,pt.y,pt.z,RADIUS)) do
    if v and v:IsValid() and v.components.combat then
        --blablabla you can do this part on your own can't you?
    end
end

 

EDIT: Nice pun, just noticed it. And when I did, it hit me hard... *cricket noise*

Edited by Mobbstar
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...