Kirigio Posted June 15, 2021 Share Posted June 15, 2021 Someone could help me so that when my character hits the same sparks as when using the morning estar or the voalt goat, the target comes out, as if it were electrified Like that: Code: local MakePlayerCharacter = require "prefabs/player_common" local assets = { Asset("SCRIPT", "scripts/prefabs/player_common.lua"), } -- Your character's stats TUNING.JINRO_HEALTH = 100 TUNING.JINRO_HUNGER = 125 TUNING.JINRO_SANITY = 200 -- Custom starting inventory TUNING.GAMEMODE_STARTING_ITEMS.DEFAULT.JINRO = { "blowdart_sleep", } local start_inv = {} for k, v in pairs(TUNING.GAMEMODE_STARTING_ITEMS) do start_inv[string.lower(k)] = v.JINRO end local prefabs = FlattenTree(start_inv, true) -- When the character is revived from human local function onbecamehuman(inst) -- Set speed when not a ghost (optional) inst.components.locomotor:SetExternalSpeedMultiplier(inst, "jinro_speed_mod", 1.35) end local function onbecameghost(inst) -- Remove speed modifier when becoming a ghost inst.components.locomotor:RemoveExternalSpeedMultiplier(inst, "jinro_speed_mod") end -- When loading or spawning the character local function onload(inst) inst:ListenForEvent("ms_respawnedfromghost", onbecamehuman) inst:ListenForEvent("ms_becameghost", onbecameghost) if inst:HasTag("playerghost") then onbecameghost(inst) else onbecamehuman(inst) end end -- This initializes for both the server and client. Tags can be added here. local common_postinit = function(inst) inst:AddTag("insomniac") inst:AddTag("fastbuilder") inst:AddTag("masterchef") inst:AddTag("houndfriend") inst:AddTag("monster") inst:AddTag("quagmire_fasthands") inst:RemoveTag("scarytoprey") -- Minimap icon inst.MiniMapEntity:SetIcon( "jinro.tex" ) end -- This initializes for the server only. Components are added here. local master_postinit = function(inst) inst:AddComponent("electricattacks") inst.components.electricattacks:AddSource(inst) -- Set starting inventory inst.starting_inventory = start_inv[TheNet:GetServerGameMode()] or start_inv.default -- choose which sounds this character will play inst.soundsname = "woodie" -- Uncomment if "wathgrithr"(Wigfrid) or "webber" voice is used --inst.talker_path_override = "dontstarve_DLC001/characters/" inst:ListenForEvent("killed",function(inst,data) inst.components.sanity:DoDelta(5) --Restores 5 sanity on kill end) -- Stats inst.components.health:SetMaxHealth(TUNING.JINRO_HEALTH) inst.components.hunger:SetMax(TUNING.JINRO_HUNGER) inst.components.sanity:SetMax(TUNING.JINRO_SANITY) inst.components.foodaffinity:AddPrefabAffinity("californiaroll", TUNING.AFFINITY_15_CALORIES_HUGE ) inst.components.sanity.neg_aura_mult = 0.25 inst.components.sanity.night_drain_mult = 0 inst.components.temperature.inherentinsulation = 60 inst.components.temperature.inherentsummerinsulation = 60 inst.components.health:StartRegen(0.1, 0.5) -- Damage multiplier (optional) inst.components.combat.damagemultiplier = 1.50 -- Hunger rate (optional) inst.components.hunger.hungerrate = 0.80 * TUNING.WILSON_HUNGER_RATE inst.OnLoad = onload inst.OnNewSpawn = onload end return MakePlayerCharacter("jinro", prefabs, assets, common_postinit, master_postinit, prefabs) Link to comment https://forums.kleientertainment.com/forums/topic/130848-help-with-sparks-on-hit/ Share on other sites More sharing options...
DecDuck Posted June 15, 2021 Share Posted June 15, 2021 Next time you post code can you use the code brackets. If you're uploading an entire file you can just attach it. Thanks Anyways, this is from foodbuffs.lua if inst._onattackother == nil then inst._onattackother = function(attacker, data) if data.weapon ~= nil then if data.projectile == nil then --in combat, this is when we're just launching a projectile, so don't do FX yet if data.weapon.components.projectile ~= nil then return elseif data.weapon.components.complexprojectile ~= nil then return elseif data.weapon.components.weapon:CanRangedAttack() then return end end if data.weapon.components.weapon ~= nil and data.weapon.components.weapon.stimuli == "electric" then --weapon already has electric stimuli, so probably does its own FX return end end if data.target ~= nil and data.target:IsValid() and attacker:IsValid() then SpawnPrefab("electrichitsparks"):AlignToTarget(data.target, data.projectile ~= nil and data.projectile:IsValid() and data.projectile or attacker, true) end end This is the code responsible for the spark animation for Warly's Volt Goat Chaud-Froid. Maybe try this? Link to comment https://forums.kleientertainment.com/forums/topic/130848-help-with-sparks-on-hit/#findComment-1468896 Share on other sites More sharing options...
Kirigio Posted June 15, 2021 Author Share Posted June 15, 2021 8 hours ago, decduck3 said: Maybe try this? Could you tell me where to put it, I tried to put it on top of the masterposinit but when I tried it it didn't work, I don't have much idea where to put it, would you tell me where? Link to comment https://forums.kleientertainment.com/forums/topic/130848-help-with-sparks-on-hit/#findComment-1469009 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