Jump to content

Help setting up my mod


Recommended Posts

Hello everyone,
my English is bad(speak spanish).

I try to do it when I have no weapons in my hand: the damage I receive is reduced and do damage to the one who attacks me.

________________________________________________________________________________________________________________
----------000------------no weapon
local function sinarma(inst, data)

        local item = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS)

            if inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS) == nil then
            inst.components.health.absorb = (0.60)
         end
end 
----------000------------

local master_postinit = function(inst)
    inst:ListenForEvent("unequip", function(inst, data) sinarma(inst, data) end)
    --------------------
    inst:ListenForEvent("attacked", function(inst, data)
        
        if data.attacker and data.attacker.components.health and data.attacker:HasTag("player") then
            data.attacker.components.health:DoDelta(math.random(-7, -5))
        end
        if data.attacker and data.attacker.components.health and not data.attacker:HasTag("player") and not data.attacker:HasTag("chess") then
            data.attacker.components.health:DoDelta(math.random(-9, -6))
       end
    end)
 __________________________________________________________________________

Cuando coloco esto siempre redujo el daño y lastimé al atacante.
Pero si uso un arma o no uso un arma, siempre reduce mi daño.
_____________________________________________________________________
Try doing the following

----------000------------
local function sinarma(inst, data)

        local item = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS)

            if inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS) == nil then
            inst.components.health.absorb = (0.20)
         end
end 
----------000------------reflect
local function reflejar(inst, data)
        if data.attacker and data.attacker.components.health and data.attacker:HasTag("player") then
            data.attacker.components.health:DoDelta(math.random(-10, -5))
        end
        if data.attacker and data.attacker.components.health and not data.attacker:HasTag("player") and not data.attacker:HasTag("chess") then
            data.attacker.components.health:DoDelta(math.random(-10, -5))
        end

end
----------000------------

local master_postinit = function(inst)
    inst:ListenForEvent("unequip", function(inst, data) sinarma(inst, data) end)
    inst:ListenForEvent("attacked", function(inst, data) reflejar(inst,data) end)
end
_________________________________________________________________________
And the same thing happens to me ...

You can help me when I do not have weapons in my hands >>  Reduce damage 
and
reflect from -5 to -10, to my attacker

me when I do have weapons in my hands >>No reduce damage
and 
no reflect from -5 to -10, to my attacker
__________________________________________________________________________
PD:How can you model a weapon for the game?(That is fabricable, I need a tutorial: S)

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...