Jump to content

Recommended Posts

Hi there, I wrote this function "onkill" and it will be listened  inst:ListenForEvent("killed", onkill). It works well for any other creatures but nightmare creatures, when I kill a crawling bug or a terror beak it doesn't give me any feedback. Would somebody please check my code or tell me what's special about killing nightmare creatures? Thanks!!

Spoiler

Part of [character.lua]

local function onkill(inst, data)
    local victim = data.victim
    if victim.components.combat then
    if victim:HasTag("dragonfly") then
    inst.point = inst.point + 14682
    inst.class_S = inst.class_S + 1
    inst.components.talker:Say("Point +14682 \n Badge S +1")
    elseif victim:HasTag ("werepig") then
    inst.point = inst.point + 34
    inst.gcp_2 = inst.gcp_2 + 1
    inst.components.talker:Say("Point +34\n"..inst.gcp_2)
    elseif victim:HasTag("koalefant") then
    inst.point = inst.point + 33
    inst.class_D = inst.class_D + 1
    inst.components.talker:Say("Point +33 \n Badge D +1")
    elseif victim:HasTag("guard") then
    inst.point = inst.point + 30
    inst.components.talker:Say("Point +30")
    elseif victim:HasTag("nightmarecreature") then
    inst.point = inst.point + 27
    inst.gcp_2 = inst.gcp_2 + 1
    inst.components.talker:Say("Point +27\n"..inst.gcp_2)

end
end
end

 

local master_postinit = function(inst)

    inst:ListenForEvent("killed", onkill)

      return inst
end

Here is the character file and the whole mod if you want to test. XD

hisoka.lua      hisoka.rar

Edited by nicknightyx

@nicknightyx

Nightmare creatures are the ones that are visible even when sane.

Shadow creatures are the ones that come when you're no longer sane enough.

 

If you want to apply an effect regardless of which, then check for tags "nightmarecreature" and "shadowcreature".

You can discriminate between the two, of course.

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
×
  • Create New...